Search in sources :

Example 1 with WebResult

use of com.alibaba.druid.admin.model.dto.WebResult in project druid by alibaba.

the class MonitorStatService method getWebURIStatDataList.

@SuppressWarnings("unchecked")
private String getWebURIStatDataList(Map<String, String> parameters) {
    Map<String, ServiceNode> allNodeMap = getServiceAllNodeMap(parameters);
    List<Map<String, Object>> arrayMap = new ArrayList<>();
    for (String nodeKey : allNodeMap.keySet()) {
        ServiceNode serviceNode = allNodeMap.get(nodeKey);
        String url = getRequestUrl(parameters, serviceNode, "/druid/weburi.json");
        WebResult dataSourceResult = HttpUtil.get(url, WebResult.class);
        if (dataSourceResult != null) {
            List<WebResult.ContentBean> nodeContent = dataSourceResult.getContent();
            if (nodeContent != null) {
                for (WebResult.ContentBean contentBean : nodeContent) {
                    Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(contentBean), Map.class);
                    arrayMap.add(map);
                }
            }
        }
    }
    List<Map<String, Object>> maps = comparatorOrderBy(arrayMap, parameters);
    String jsonString = JSON.toJSONString(maps);
    JSONArray objects = JSON.parseArray(jsonString);
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("ResultCode", RESULT_CODE_SUCCESS);
    jsonObject.put("Content", objects);
    return jsonObject.toJSONString();
}
Also used : ServiceNode(com.alibaba.druid.admin.model.ServiceNode) ArrayList(java.util.ArrayList) JSONArray(com.alibaba.fastjson.JSONArray) JSONObject(com.alibaba.fastjson.JSONObject) JSONObject(com.alibaba.fastjson.JSONObject) WebResult(com.alibaba.druid.admin.model.dto.WebResult) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Aggregations

ServiceNode (com.alibaba.druid.admin.model.ServiceNode)1 WebResult (com.alibaba.druid.admin.model.dto.WebResult)1 JSONArray (com.alibaba.fastjson.JSONArray)1 JSONObject (com.alibaba.fastjson.JSONObject)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1