Package com.dianping.cat.home.dal.report

Examples of com.dianping.cat.home.dal.report.Baseline


        values.add(oneDayValue);
      }

      double[] result = m_baselineCreator.createBaseLine(values, weights, POINT_NUMBER);
      Baseline baseline = new Baseline();
      baseline.setDataInDoubleArray(result);
      baseline.setIndexKey(key);
      baseline.setReportName(reportName);
      baseline.setReportPeriod(targetDate);
      m_baselineService.insertBaseline(baseline);

      Date tomorrow = new Date(reportPeriod.getTime() + TimeHelper.ONE_DAY);
      double[] baseLine = m_baselineService.queryDailyBaseline(reportName, key, tomorrow);

      if (baseLine == null) {
        Baseline tomorrowBaseline = new Baseline();

        tomorrowBaseline.setDataInDoubleArray(result);
        tomorrowBaseline.setIndexKey(key);
        tomorrowBaseline.setReportName(reportName);
        tomorrowBaseline.setReportPeriod(tomorrow);
        m_baselineService.insertBaseline(tomorrowBaseline);
      }
    }
  }
View Full Code Here


  }

  @Override
  public double[] queryDailyBaseline(String reportName, String key, Date reportPeriod) {
    String baselineKey = reportName + ":" + key + ":" + reportPeriod;
    Baseline baseline = m_baselines.get(baselineKey);

    if (baseline == null) {
      try {
        String str = m_empties.get(baselineKey);

        if (str == null) {
          baseline = m_baselineDao.findByReportNameKeyTime(reportPeriod, reportName, key,
                BaselineEntity.READSET_FULL);
          m_baselines.put(baselineKey, baseline);
        } else {
          return null;
        }
      } catch (DalNotFoundException e) {
        m_empties.put(baselineKey, baselineKey);
        return null;
      } catch (Exception e) {
        Cat.logError(e);
        return null;
      }
    }

    try {
      return decodeBaselines(baseline.getData());
    } catch (Exception e) {
      Cat.logError(e);
      return null;
    }
  }
View Full Code Here

TOP

Related Classes of com.dianping.cat.home.dal.report.Baseline

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.