use of com.ctrip.xpipe.redis.console.model.DcClusterTbl in project x-pipe by ctripcorp.
the class ClusterController method findAllClusters.
@RequestMapping(value = "/clusters/all", method = RequestMethod.GET)
public List<ClusterTbl> findAllClusters(@RequestParam(required = false) String activeDcName) {
if (StringUtil.isEmpty(activeDcName)) {
return valueOrEmptySet(ClusterTbl.class, clusterService.findAllClustersWithOrgInfo());
} else {
DcTbl dc = dcService.findByDcName(activeDcName);
if (dc != null) {
List<ClusterTbl> clusters = clusterService.findClustersWithOrgInfoByActiveDcId(dc.getId());
if (!clusters.isEmpty()) {
List<Long> clusterIds = new ArrayList<Long>(clusters.size());
for (ClusterTbl c : clusters) {
clusterIds.add(c.getId());
}
List<DcClusterTbl> dcClusters = dcClusterService.findByClusterIds(clusterIds);
return joinClusterAndDcCluster(clusters, dcClusters);
}
}
return Collections.emptyList();
}
}
Aggregations