Search in sources :

Example 1 with TopologyRealStatusVO

use of com.ds.retl.rest.vo.topology.TopologyRealStatusVO in project main by JohnPeng739.

the class TopologyManageResource method getTopologyRealStatus.

@Path("topologies/realStatus")
@GET
public DataVO<List<TopologyRealStatusVO>> getTopologyRealStatus(@QueryParam("topologyIds") String topologyIds) {
    if (StringUtils.isBlank(topologyIds)) {
        return new DataVO<>(new UserInterfaceErrorException(UserInterfaceErrors.SYSTEM_ILLEGAL_PARAM));
    }
    try {
        String[] ids = topologyIds.split(",");
        JSONArray topologies = stormClient.getToptologies();
        List<TopologyRealStatusVO> list = new ArrayList<>();
        if (topologies != null && topologies.size() > 0) {
            for (String id : ids) {
                for (int index = 0; index < topologies.size(); index++) {
                    JSONObject item = topologies.getJSONObject(index);
                    if (item == null) {
                        continue;
                    }
                    if (id.equals(item.getString("id"))) {
                        list.add(new TopologyRealStatusVO(item));
                    }
                }
            }
        }
        return new DataVO<>(list);
    } catch (UserInterfaceErrorException ex) {
        return new DataVO<>(ex);
    }
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) PaginationDataVO(org.mx.rest.vo.PaginationDataVO) DataVO(org.mx.rest.vo.DataVO) UserInterfaceErrorException(com.ds.retl.exception.UserInterfaceErrorException) JSONArray(com.alibaba.fastjson.JSONArray) ArrayList(java.util.ArrayList) TopologyRealStatusVO(com.ds.retl.rest.vo.topology.TopologyRealStatusVO)

Aggregations

JSONArray (com.alibaba.fastjson.JSONArray)1 JSONObject (com.alibaba.fastjson.JSONObject)1 UserInterfaceErrorException (com.ds.retl.exception.UserInterfaceErrorException)1 TopologyRealStatusVO (com.ds.retl.rest.vo.topology.TopologyRealStatusVO)1 ArrayList (java.util.ArrayList)1 DataVO (org.mx.rest.vo.DataVO)1 PaginationDataVO (org.mx.rest.vo.PaginationDataVO)1