/**
* 获取某个拓扑节点所配置的所有的监控unitId和KPi,包括所关联的子拓扑所配置的数据
* 方法内递归调用
*
* @param mapValue(ID、GRAPH_ID,节点ID和拓扑图的ID)
*
* @return unitId、kpiId集合
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public LinkedHashMap<String, Object> getCurrentTopoNodeConfig(Map<String, String> mapValue) {
boolean isCountinue = true;
LinkedList<String> paramListKbp = new LinkedList<String>();
LinkedList<String> paramListKpi = new LinkedList<String>();
while (isCountinue) {
List<Map> listNodeCount = new ArrayList();
if (mapValue.get("ITETOR_TYPE") != null) {
String subNodeList = mapValue.get("ITETOR_TYPE");
listNodeCount = (ArrayList) JSONUtil.fromJSON(subNodeList);
} else {
listNodeCount.add(mapValue);
}
if (listNodeCount != null && listNodeCount.size() > 0) {
for (int j = 0; j < listNodeCount.size(); j++) {
mapValue = listNodeCount.get(j);
List resultValue = e2eDao.showMonitorTopuResNodeuResNode(mapValue);//获取父页面唯一数据
if (resultValue != null && resultValue.size() > 0) {
Map<String, String> graphMap = (Map<String, String>) resultValue.get(0);
String customPropers = graphMap.get("CUSTOM_PROPS");
if (!"".equals(customPropers)) {
Map unitMapSub = getMonitorResUnitIdAndKpiItem(customPropers);
List unitListItemSub = null;
List kpiListItemSub = null;
if (unitMapSub.get("UNIT_ID_ITEM") != null) {
unitListItemSub = (ArrayList) unitMapSub.get("UNIT_ID_ITEM");
}
if (unitMapSub.get("KPI_ID_ITEM") != null) {
kpiListItemSub = (ArrayList) unitMapSub.get("KPI_ID_ITEM");
}
if (unitListItemSub != null) {// unit集合点
for (int l = 0; l < unitListItemSub.size(); l++) {
paramListKbp.add(unitListItemSub.get(l) + "");
}
}
if (kpiListItemSub != null) {// KPI集合点
for (int l = 0; l < kpiListItemSub.size(); l++) {
paramListKpi.add(kpiListItemSub.get(l) + "");
}
}
Map<String, String> customMap = (Map) JSONUtil.fromJSON(customPropers);
String subGraphId = customMap.get("subGraphId");
// 如果包括子实体页面
if (!"".equals(subGraphId) && !"null".equals(subGraphId) && subGraphId != null) {
Map subMapValue = new HashMap();
subMapValue.put("GRAPH_ID", subGraphId);
List resultValueSub = e2eDao.showMonitorTopuResNodeuResNode(subMapValue);//获取子页面内所有的节点数据
if (resultValueSub != null && resultValueSub.size() > 0) {
List subNodeList = new ArrayList();
for (int k = 0; k < resultValueSub.size(); k++) {
Map<String, String> graphMapSub = (Map<String, String>) resultValueSub.get(k);
mapValue = new HashMap();
mapValue.put("ID", graphMapSub.get("ID"));
mapValue.put("GRAPH_ID", graphMapSub.get("GRAPH_ID"));
subNodeList.add(mapValue);
}
mapValue.put("ITETOR_TYPE", JSONUtil.toJSON(subNodeList));
} else {
isCountinue = false;
}
} else {
isCountinue = false;
}
} else {
isCountinue = false;
}
} else {
isCountinue = false;
}
}
} else {
isCountinue = false;
}
}
LinkedHashMap returnMap = new LinkedHashMap();
returnMap.put("EXT_UNIT_ID", paramListKbp);
returnMap.put("KPI_ID", paramListKpi);
return returnMap;
}
转载于:https://my.oschina.net/runningwork/blog/220648