Package com.dianping.cat.consumer.matrix.model.entity

Examples of com.dianping.cat.consumer.matrix.model.entity.MatrixReport


    return m_reportService.insertMonthlyReport(report, binaryContent);
  }

  @Override
  public boolean buildWeeklyTask(String name, String domain, Date period) {
    MatrixReport matrixReport = queryDailyReportsByDuration(domain, period, new Date(period.getTime()
          + TimeHelper.ONE_WEEK));
    WeeklyReport report = new WeeklyReport();

    report.setContent("");
    report.setCreationDate(new Date());
View Full Code Here


  }

  private MatrixReport queryDailyReportsByDuration(String domain, Date start, Date end) {
    long startTime = start.getTime();
    long endTime = end.getTime();
    MatrixReportMerger merger = new MatrixReportMerger(new MatrixReport(domain));

    for (; startTime < endTime; startTime += TimeHelper.ONE_DAY) {
      try {
        MatrixReport reportModel = m_reportService.queryMatrixReport(domain, new Date(startTime), new Date(
              startTime + TimeHelper.ONE_DAY));

        reportModel.accept(merger);
      } catch (Exception e) {
        Cat.logError(e);
      }
    }
    MatrixReport matrixReport = merger.getMatrixReport();
    new MatrixReportFilter().visitMatrixReport(matrixReport);

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

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

    if (content != null) {
      return DefaultNativeParser.parse(content.getContent());
    } else {
      return new MatrixReport(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 MatrixReport(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 MatrixReport(domain);
    }
  }
View Full Code Here

  private MatrixReport queryHourlyReportByDuration(String name, String domain, Date start, Date end) {
    Set<String> domainSet = m_reportService.queryAllDomainNames(start, end, MatrixAnalyzer.ID);
    long startTime = start.getTime();
    long endTime = end.getTime();
    MatrixReportMerger merger = new MatrixReportMerger(new MatrixReport(domain));

    for (; startTime < endTime; startTime = startTime + TimeHelper.ONE_HOUR) {
      Date date = new Date(startTime);
      MatrixReport reportModel = m_reportService.queryMatrixReport(domain, date, new Date(date.getTime()
            + TimeHelper.ONE_HOUR));

      reportModel.accept(merger);
    }
    MatrixReport matrixReport = merger.getMatrixReport();
    new MatrixReportFilter().visitMatrixReport(matrixReport);

    matrixReport.getDomainNames().addAll(domainSet);
    matrixReport.setStartTime(start);
    matrixReport.setEndTime(end);
    return matrixReport;
  }
View Full Code Here

    }
  }

  @Override
  public MatrixReport queryHourlyReport(String domain, Date start, Date end) {
    MatrixReportMerger merger = new MatrixReportMerger(new MatrixReport(domain));
    long startTime = start.getTime();
    long endTime = end.getTime();
    String name = MatrixAnalyzer.ID;

    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) {// for old xml storage
              MatrixReport reportModel = com.dianping.cat.consumer.matrix.model.transform.DefaultSaxParser
                    .parse(xml);
              reportModel.accept(merger);
            } else {// for new binary storage, binary is same to report id
              MatrixReport reportModel = queryFromHourlyBinary(report.getId(), domain);

              reportModel.accept(merger);
            }
          } catch (DalNotFoundException e) {
            //ignore
          } catch (Exception e) {
            Cat.logError(e);
          }
        }
      }
    }
    MatrixReport matrixReport = merger.getMatrixReport();

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

    Set<String> domains = queryAllDomainNames(start, end, MatrixAnalyzer.ID);
    matrixReport.getDomainNames().addAll(domains);
    return matrixReport;
  }
View Full Code Here

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

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

        CrossReport crossReport = m_reportService.queryCrossReport(domain, start, end);
        m_reportService.insertMonthlyReport(buildMonthlyReport(domain, start, CrossAnalyzer.ID),
              com.dianping.cat.consumer.cross.model.transform.DefaultNativeBuilder.build(crossReport));

        MatrixReport matrixReport = m_reportService.queryMatrixReport(domain, start, end);
        new MatrixReportFilter().visitMatrixReport(matrixReport);
        m_reportService.insertMonthlyReport(buildMonthlyReport(domain, start, MatrixAnalyzer.ID),
              com.dianping.cat.consumer.matrix.model.transform.DefaultNativeBuilder.build(matrixReport));

        t.setStatus(Transaction.SUCCESS);
View Full Code Here

TOP

Related Classes of com.dianping.cat.consumer.matrix.model.entity.MatrixReport

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.