Search in sources :

Example 1 with DcClusterTbl

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();
    }
}
Also used : DcClusterTbl(com.ctrip.xpipe.redis.console.model.DcClusterTbl) ClusterTbl(com.ctrip.xpipe.redis.console.model.ClusterTbl) DcTbl(com.ctrip.xpipe.redis.console.model.DcTbl) DcClusterTbl(com.ctrip.xpipe.redis.console.model.DcClusterTbl)

Aggregations

ClusterTbl (com.ctrip.xpipe.redis.console.model.ClusterTbl)1 DcClusterTbl (com.ctrip.xpipe.redis.console.model.DcClusterTbl)1 DcTbl (com.ctrip.xpipe.redis.console.model.DcTbl)1