Package com.dianping.cat.report.page

Examples of com.dianping.cat.report.page.JsonBuilder$TimestampTypeAdapter


          Pair<LineChart, PieChart> pair = m_graphCreator.queryErrorInfo(startDate, endDate, url, pars);

          jsonObjs.put("lineChart", pair.getKey());
          jsonObjs.put("pieChart", pair.getValue());
        }
        model.setJson(new JsonBuilder().toJson(jsonObjs));
      }
      break;
    }

    if (!ctx.isProcessStopped()) {
View Full Code Here


  public void setStartTime(java.util.Date startTime) {
    m_startTime = startTime;
  }

  public String toString() {
    return new JsonBuilder().toJson(this);
  }
View Full Code Here

      item.setNumber(event.getTotalCount()).setTitle(event.getId());
      items.add(item);
    }

    chart.addItems(items);
    model.setPieChart(new JsonBuilder().toJson(chart));
  }
View Full Code Here

        items = new ArrayList<Code>();
        maps.put(item.getId(), items);
      }
      items.addAll(item.getCodes().values());
    }
    return new JsonBuilder().toJson(maps);
  }
View Full Code Here

        commands = new ArrayList<Command>();
        map.put(domain, commands);
      }
      commands.add(command);
    }
    return new JsonBuilder().toJson(map);
  }
View Full Code Here

  public Map<String, List<TopologyNode>> getNodes() {
    return m_productLines;
  }

  public String toJson() {
    String str = new JsonBuilder().toJson(this);

    return str;
  }
View Full Code Here

      if (lineChartJsonPair != null) {
        Map<String, Object> lineChartObjs = new HashMap<String, Object>();

        lineChartObjs.put("lineCharts", lineChartJsonPair.getKey());
        lineChartObjs.put("lineChartDetails", lineChartJsonPair.getValue());
        model.setFetchData(new JsonBuilder().toJson(lineChartObjs));
      }
      break;
    case PIECHART:
      Pair<PieChart, List<PieChartDetailInfo>> pieChartPair = buildPieChart(model, payload, field);

      if (pieChartPair != null) {
        model.setPieChart(pieChartPair.getKey());
        model.setPieChartDetailInfos(pieChartPair.getValue());
      }
      break;
    case PIECHART_JSON:
      Pair<PieChart, List<PieChartDetailInfo>> pieChartJsonPair = buildPieChart(model, payload, field);

      if (pieChartJsonPair != null) {
        Map<String, Object> pieChartObjs = new HashMap<String, Object>();

        pieChartObjs.put("pieCharts", pieChartJsonPair.getKey());
        pieChartObjs.put("pieChartDetails", pieChartJsonPair.getValue());
        model.setFetchData(new JsonBuilder().toJson(pieChartObjs));
      }
      break;
    case APP_ADD:
      String domain = payload.getDomain();
      String name = payload.getName();
      String title = payload.getTitle();

      if (StringUtil.isEmpty(name)) {
        setUpdateResult(model, 0);
      } else {
        try {
          Pair<Boolean, Integer> addCommandResult = m_manager.addCommand(domain, title, name);

          if (addCommandResult.getKey()) {
            setUpdateResult(model, 1);
            m_appRuleConfigManager.addDefultRule(name, addCommandResult.getValue());
          } else {
            setUpdateResult(model, 2);
          }
        } catch (Exception e) {
          setUpdateResult(model, 2);
        }
      }
      break;
    case APP_DELETE:
      domain = payload.getDomain();
      name = payload.getName();

      if (StringUtil.isEmpty(name)) {
        setUpdateResult(model, 0);
      } else {
        Pair<Boolean, List<Integer>> deleteCommandResult = m_manager.deleteCommand(domain, name);
        if (deleteCommandResult.getKey()) {
          setUpdateResult(model, 1);
          m_appRuleConfigManager.deleteDefaultRule(name, deleteCommandResult.getValue());
        } else {
          setUpdateResult(model, 2);
        }
      }
      break;
    case APP_CONFIG_FETCH:
      String type = payload.getType();

      try {
        if ("xml".equalsIgnoreCase(type)) {
          model.setFetchData(m_manager.getConfig().toString());
        } else if (StringUtils.isEmpty(type) || "json".equalsIgnoreCase(type)) {
          model.setFetchData(new JsonBuilder().toJson(m_manager.getConfig()));
        }
      } catch (Exception e) {
        Cat.logError(e);
      }
      break;
View Full Code Here

  public void enableLogging(Logger logger) {
    m_logger = logger;
  }

  public List<Pair<String, String>> getNetGraphData(Date start, int minute) {
    JsonBuilder jb = new JsonBuilder();
    List<Pair<String, String>> netGraphData = new ArrayList<Pair<String, String>>();
    long current = System.currentTimeMillis();
    long currentHours = current - current % TimeHelper.ONE_HOUR;
    long startTime = start.getTime();
    NetGraphSet netGraphSet = null;

    if (startTime >= currentHours) {
      netGraphSet = m_currentNetGraphSet;
    } else if (startTime == currentHours - TimeHelper.ONE_HOUR) {
      netGraphSet = m_lastNetGraphSet;
    } else {
      netGraphSet = m_reportService.queryNetTopologyReport(Constants.CAT, start, new Date(start.getTime()
            + TimeHelper.ONE_HOUR));
    }

    if (netGraphSet != null) {
      NetGraph netGraph = netGraphSet.findNetGraph(minute);

      if (netGraph != null) {
        for (NetTopology netTopology : netGraph.getNetTopologies()) {
          String topoName = netTopology.getName();
          String data = jb.toJson(netTopology);

          netGraphData.add(new Pair<String, String>(topoName, data));
        }
      }
    }
View Full Code Here

TOP

Related Classes of com.dianping.cat.report.page.JsonBuilder$TimestampTypeAdapter

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.