Package com.dianping.cat.home.service.entity

Examples of com.dianping.cat.home.service.entity.ServiceReport


    model.setHeavyReport(heavyReport);
    buildSortedHeavyInfo(model, heavyReport);
  }

  private void buildServiceInfo(Model model, Payload payload) {
    ServiceReport serviceReport = queryServiceReport(payload);
    List<com.dianping.cat.home.service.entity.Domain> dHisList = sort(serviceReport, payload.getSortBy());
    model.setServiceList(dHisList);
    model.setServiceReport(serviceReport);
  }
View Full Code Here


public class ServiceReportService extends AbstractReportService<ServiceReport> {

  @Override
  public ServiceReport makeReport(String domain, Date start, Date end) {
    ServiceReport report = new ServiceReport(domain);

    report.setStartTime(start);
    report.setEndTime(end);
    return report;
  }
View Full Code Here

    return report;
  }

  @Override
  public ServiceReport queryDailyReport(String domain, Date start, Date end) {
    ServiceReportMerger merger = new ServiceReportMerger(new ServiceReport(domain));
    long startTime = start.getTime();
    long endTime = end.getTime();
    String name = Constants.REPORT_SERVICE;

    for (; startTime < endTime; startTime = startTime + TimeHelper.ONE_DAY) {
      try {
        DailyReport report = m_dailyReportDao.findByDomainNamePeriod(domain, name, new Date(startTime),
              DailyReportEntity.READSET_FULL);
        String xml = report.getContent();

        if (xml != null && xml.length() > 0) {
          ServiceReport reportModel = com.dianping.cat.home.service.transform.DefaultSaxParser.parse(xml);
          reportModel.accept(merger);
        } else {
          ServiceReport reportModel = queryFromDailyBinary(report.getId(), domain);
          reportModel.accept(merger);
        }
      } catch (DalNotFoundException e) {
        //ignore
      } catch (Exception e) {
        Cat.logError(e);
      }
    }
    ServiceReport serviceReport = merger.getServiceReport();

    serviceReport.setStartTime(start);
    serviceReport.setEndTime(end);
    return serviceReport;
  }
View Full Code Here

    DailyReportContent content = m_dailyReportContentDao.findByPK(id, DailyReportContentEntity.READSET_FULL);

    if (content != null) {
      return DefaultNativeParser.parse(content.getContent());
    } else {
      return new ServiceReport(domain);
    }
  }
View Full Code Here

    HourlyReportContent content = m_hourlyReportContentDao.findByPK(id, HourlyReportContentEntity.READSET_FULL);

    if (content != null) {
      return DefaultNativeParser.parse(content.getContent());
    } else {
      return new ServiceReport(domain);
    }
  }
View Full Code Here

    MonthlyReportContent content = m_monthlyReportContentDao.findByPK(id, MonthlyReportContentEntity.READSET_FULL);

    if (content != null) {
      return DefaultNativeParser.parse(content.getContent());
    } else {
      return new ServiceReport(domain);
    }
  }
View Full Code Here

    WeeklyReportContent content = m_weeklyReportContentDao.findByPK(id, WeeklyReportContentEntity.READSET_FULL);

    if (content != null) {
      return DefaultNativeParser.parse(content.getContent());
    } else {
      return new ServiceReport(domain);
    }
  }
View Full Code Here

    }
  }

  @Override
  public ServiceReport queryHourlyReport(String domain, Date start, Date end) {
    ServiceReportMerger merger = new ServiceReportMerger(new ServiceReport(domain));
    long startTime = start.getTime();
    long endTime = end.getTime();
    String name = Constants.REPORT_SERVICE;

    for (; startTime < endTime; startTime = startTime + TimeHelper.ONE_HOUR) {
      List<HourlyReport> reports = null;
      try {
        reports = m_hourlyReportDao.findAllByDomainNamePeriod(new Date(startTime), domain, name,
              HourlyReportEntity.READSET_FULL);
      } catch (DalException e) {
        Cat.logError(e);
      }
      if (reports != null) {
        for (HourlyReport report : reports) {
          String xml = report.getContent();

          try {
            if (xml != null && xml.length() > 0) {
              ServiceReport reportModel = com.dianping.cat.home.service.transform.DefaultSaxParser.parse(xml);
              reportModel.accept(merger);
            } else {
              ServiceReport reportModel = queryFromHourlyBinary(report.getId(), domain);
              reportModel.accept(merger);
            }
          } catch (DalNotFoundException e) {
            //ignore
          } catch (Exception e) {
            Cat.logError(e);
          }
        }
      }
    }
    ServiceReport serviceReport = merger.getServiceReport();

    serviceReport.setStartTime(start);
    serviceReport.setEndTime(new Date(end.getTime() - 1));

    return serviceReport;
  }
View Full Code Here

    } catch (DalNotFoundException e) {
      //ignore
    } catch (Exception e) {
      Cat.logError(e);
    }
    return new ServiceReport(domain);
  }
View Full Code Here

    } catch (DalNotFoundException e) {
      //ignore
    } catch (Exception e) {
      Cat.logError(e);
    }
    return new ServiceReport(domain);
  }
View Full Code Here

TOP

Related Classes of com.dianping.cat.home.service.entity.ServiceReport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.