示例#1
0
  private String queryMetricItemDes(String type) {
    String des = "";

    if (MetricType.AVG.name().equals(type)) {
      des = Chinese.Suffix_AVG;
    } else if (MetricType.SUM.name().equals(type)) {
      des = Chinese.Suffix_SUM;
    } else if (MetricType.COUNT.name().equals(type)) {
      des = Chinese.Suffix_COUNT;
    }
    return des;
  }
示例#2
0
  public Map<String, LineChart> buildDashboard(Date start, Date end) {
    Collection<ProductLine> productLines =
        m_productLineConfigManager.queryAllProductLines().values();
    Map<String, LineChart> allCharts = new LinkedHashMap<String, LineChart>();

    for (ProductLine productLine : productLines) {
      if (showInDashboard(productLine.getId())) {
        allCharts.putAll(buildChartsByProductLine(productLine.getId(), start, end));
      }
    }
    List<MetricItemConfig> configs =
        new ArrayList<MetricItemConfig>(
            m_metricConfigManager.getMetricConfig().getMetricItemConfigs().values());

    Collections.sort(
        configs,
        new Comparator<MetricItemConfig>() {
          @Override
          public int compare(MetricItemConfig o1, MetricItemConfig o2) {
            return (int) (o1.getShowDashboardOrder() * 100 - o2.getShowDashboardOrder() * 100);
          }
        });

    Map<String, LineChart> result = new LinkedHashMap<String, LineChart>();
    for (MetricItemConfig config : configs) {
      String key = config.getId();
      if (config.getShowAvg() && config.getShowAvgDashboard()) {
        String avgKey = key + ":" + MetricType.AVG.name();
        put(allCharts, result, avgKey);
      }
      if (config.getShowCount() && config.getShowCountDashboard()) {
        String countKey = key + ":" + MetricType.COUNT.name();
        put(allCharts, result, countKey);
      }
      if (config.getShowSum() && config.getShowSumDashboard()) {
        String sumKey = key + ":" + MetricType.SUM.name();
        put(allCharts, result, sumKey);
      }
    }
    return result;
  }
示例#3
0
  private Map<String, double[]> buildGraphData(
      MetricReport metricReport, List<MetricItemConfig> metricConfigs) {
    Map<String, double[]> datas = m_pruductDataFetcher.buildGraphData(metricReport);
    Map<String, double[]> values = new LinkedHashMap<String, double[]>();

    for (MetricItemConfig config : metricConfigs) {
      String key = config.getId();

      if (config.getShowAvg()) {
        String avgKey = key + ":" + MetricType.AVG.name();
        putKey(datas, values, avgKey);
      }
      if (config.getShowCount()) {
        String countKey = key + ":" + MetricType.COUNT.name();
        putKey(datas, values, countKey);
      }
      if (config.getShowSum()) {
        String sumKey = key + ":" + MetricType.SUM.name();
        putKey(datas, values, sumKey);
      }
    }
    return values;
  }