@Test public void testListDetail() { }
@Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @GetMapping("/services") public Object listDetail(@RequestParam(required = false) boolean withInstances, @RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId, @RequestParam(required = false) int pageNo, @RequestParam(required = false) int pageSize, @RequestParam(name = "serviceNameParam", defaultValue = StringUtils.EMPTY) String serviceName, @RequestParam(name = "groupNameParam", defaultValue = StringUtils.EMPTY) String groupName, @RequestParam(name = "instance", defaultValue = StringUtils.EMPTY) String containedInstance, @RequestParam(required = false) boolean hasIpCount) { String param = StringUtils.isBlank(serviceName) && StringUtils.isBlank(groupName) ? StringUtils.EMPTY : NamingUtils.getGroupedName(serviceName, groupName); if (withInstances) { List<ServiceDetailInfo> serviceDetailInfoList = new ArrayList<>(); List<Service> services = new ArrayList<>(8); serviceManager.getPagedService(namespaceId, pageNo, pageSize, param, StringUtils.EMPTY, services, false); for (Service service : services) { ServiceDetailInfo serviceDetailInfo = new ServiceDetailInfo(); serviceDetailInfo.setServiceName(NamingUtils.getServiceName(service.getName())); serviceDetailInfo.setGroupName(NamingUtils.getGroupName(service.getName())); serviceDetailInfo.setMetadata(service.getMetadata()); Map<String, ClusterInfo> clusterInfoMap = getStringClusterInfoMap(service); serviceDetailInfo.setClusterMap(clusterInfoMap); serviceDetailInfoList.add(serviceDetailInfo); } return serviceDetailInfoList; } ObjectNode result = JacksonUtils.createEmptyJsonNode(); List<Service> services = new ArrayList<>(); final int total = serviceManager.getPagedService(namespaceId, pageNo - 1, pageSize, param, containedInstance, services, hasIpCount); if (CollectionUtils.isEmpty(services)) { result.replace("serviceList", JacksonUtils.transferToJsonNode(Collections.emptyList())); result.put("count", 0); return result; } List<ServiceView> serviceViews = new LinkedList<>(); for (Service service : services) { ServiceView serviceView = new ServiceView(); serviceView.setName(NamingUtils.getServiceName(service.getName())); serviceView.setGroupName(NamingUtils.getGroupName(service.getName())); serviceView.setClusterCount(service.getClusterMap().size()); serviceView.setIpCount(service.allIPs().size()); serviceView.setHealthyInstanceCount(service.healthyInstanceCount()); serviceView.setTriggerFlag(service.triggerFlag() ? "true" : "false"); serviceViews.add(serviceView); } result.replace("serviceList", JacksonUtils.transferToJsonNode(serviceViews)); result.put("count", total); return result; }
CatalogController { @Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @GetMapping("/services") public Object listDetail(@RequestParam(required = false) boolean withInstances, @RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId, @RequestParam(required = false) int pageNo, @RequestParam(required = false) int pageSize, @RequestParam(name = "serviceNameParam", defaultValue = StringUtils.EMPTY) String serviceName, @RequestParam(name = "groupNameParam", defaultValue = StringUtils.EMPTY) String groupName, @RequestParam(name = "instance", defaultValue = StringUtils.EMPTY) String containedInstance, @RequestParam(required = false) boolean hasIpCount) { String param = StringUtils.isBlank(serviceName) && StringUtils.isBlank(groupName) ? StringUtils.EMPTY : NamingUtils.getGroupedName(serviceName, groupName); if (withInstances) { List<ServiceDetailInfo> serviceDetailInfoList = new ArrayList<>(); List<Service> services = new ArrayList<>(8); serviceManager.getPagedService(namespaceId, pageNo, pageSize, param, StringUtils.EMPTY, services, false); for (Service service : services) { ServiceDetailInfo serviceDetailInfo = new ServiceDetailInfo(); serviceDetailInfo.setServiceName(NamingUtils.getServiceName(service.getName())); serviceDetailInfo.setGroupName(NamingUtils.getGroupName(service.getName())); serviceDetailInfo.setMetadata(service.getMetadata()); Map<String, ClusterInfo> clusterInfoMap = getStringClusterInfoMap(service); serviceDetailInfo.setClusterMap(clusterInfoMap); serviceDetailInfoList.add(serviceDetailInfo); } return serviceDetailInfoList; } ObjectNode result = JacksonUtils.createEmptyJsonNode(); List<Service> services = new ArrayList<>(); final int total = serviceManager.getPagedService(namespaceId, pageNo - 1, pageSize, param, containedInstance, services, hasIpCount); if (CollectionUtils.isEmpty(services)) { result.replace("serviceList", JacksonUtils.transferToJsonNode(Collections.emptyList())); result.put("count", 0); return result; } List<ServiceView> serviceViews = new LinkedList<>(); for (Service service : services) { ServiceView serviceView = new ServiceView(); serviceView.setName(NamingUtils.getServiceName(service.getName())); serviceView.setGroupName(NamingUtils.getGroupName(service.getName())); serviceView.setClusterCount(service.getClusterMap().size()); serviceView.setIpCount(service.allIPs().size()); serviceView.setHealthyInstanceCount(service.healthyInstanceCount()); serviceView.setTriggerFlag(service.triggerFlag() ? "true" : "false"); serviceViews.add(serviceView); } result.replace("serviceList", JacksonUtils.transferToJsonNode(serviceViews)); result.put("count", total); return result; } }
CatalogController { @Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @GetMapping("/services") public Object listDetail(@RequestParam(required = false) boolean withInstances, @RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId, @RequestParam(required = false) int pageNo, @RequestParam(required = false) int pageSize, @RequestParam(name = "serviceNameParam", defaultValue = StringUtils.EMPTY) String serviceName, @RequestParam(name = "groupNameParam", defaultValue = StringUtils.EMPTY) String groupName, @RequestParam(name = "instance", defaultValue = StringUtils.EMPTY) String containedInstance, @RequestParam(required = false) boolean hasIpCount) { String param = StringUtils.isBlank(serviceName) && StringUtils.isBlank(groupName) ? StringUtils.EMPTY : NamingUtils.getGroupedName(serviceName, groupName); if (withInstances) { List<ServiceDetailInfo> serviceDetailInfoList = new ArrayList<>(); List<Service> services = new ArrayList<>(8); serviceManager.getPagedService(namespaceId, pageNo, pageSize, param, StringUtils.EMPTY, services, false); for (Service service : services) { ServiceDetailInfo serviceDetailInfo = new ServiceDetailInfo(); serviceDetailInfo.setServiceName(NamingUtils.getServiceName(service.getName())); serviceDetailInfo.setGroupName(NamingUtils.getGroupName(service.getName())); serviceDetailInfo.setMetadata(service.getMetadata()); Map<String, ClusterInfo> clusterInfoMap = getStringClusterInfoMap(service); serviceDetailInfo.setClusterMap(clusterInfoMap); serviceDetailInfoList.add(serviceDetailInfo); } return serviceDetailInfoList; } ObjectNode result = JacksonUtils.createEmptyJsonNode(); List<Service> services = new ArrayList<>(); final int total = serviceManager.getPagedService(namespaceId, pageNo - 1, pageSize, param, containedInstance, services, hasIpCount); if (CollectionUtils.isEmpty(services)) { result.replace("serviceList", JacksonUtils.transferToJsonNode(Collections.emptyList())); result.put("count", 0); return result; } List<ServiceView> serviceViews = new LinkedList<>(); for (Service service : services) { ServiceView serviceView = new ServiceView(); serviceView.setName(NamingUtils.getServiceName(service.getName())); serviceView.setGroupName(NamingUtils.getGroupName(service.getName())); serviceView.setClusterCount(service.getClusterMap().size()); serviceView.setIpCount(service.allIPs().size()); serviceView.setHealthyInstanceCount(service.healthyInstanceCount()); serviceView.setTriggerFlag(service.triggerFlag() ? "true" : "false"); serviceViews.add(serviceView); } result.replace("serviceList", JacksonUtils.transferToJsonNode(serviceViews)); result.put("count", total); return result; }  }
CatalogController { @Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @GetMapping("/services") public Object listDetail(@RequestParam(required = false) boolean withInstances, @RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId, @RequestParam(required = false) int pageNo, @RequestParam(required = false) int pageSize, @RequestParam(name = "serviceNameParam", defaultValue = StringUtils.EMPTY) String serviceName, @RequestParam(name = "groupNameParam", defaultValue = StringUtils.EMPTY) String groupName, @RequestParam(name = "instance", defaultValue = StringUtils.EMPTY) String containedInstance, @RequestParam(required = false) boolean hasIpCount) { String param = StringUtils.isBlank(serviceName) && StringUtils.isBlank(groupName) ? StringUtils.EMPTY : NamingUtils.getGroupedName(serviceName, groupName); if (withInstances) { List<ServiceDetailInfo> serviceDetailInfoList = new ArrayList<>(); List<Service> services = new ArrayList<>(8); serviceManager.getPagedService(namespaceId, pageNo, pageSize, param, StringUtils.EMPTY, services, false); for (Service service : services) { ServiceDetailInfo serviceDetailInfo = new ServiceDetailInfo(); serviceDetailInfo.setServiceName(NamingUtils.getServiceName(service.getName())); serviceDetailInfo.setGroupName(NamingUtils.getGroupName(service.getName())); serviceDetailInfo.setMetadata(service.getMetadata()); Map<String, ClusterInfo> clusterInfoMap = getStringClusterInfoMap(service); serviceDetailInfo.setClusterMap(clusterInfoMap); serviceDetailInfoList.add(serviceDetailInfo); } return serviceDetailInfoList; } ObjectNode result = JacksonUtils.createEmptyJsonNode(); List<Service> services = new ArrayList<>(); final int total = serviceManager.getPagedService(namespaceId, pageNo - 1, pageSize, param, containedInstance, services, hasIpCount); if (CollectionUtils.isEmpty(services)) { result.replace("serviceList", JacksonUtils.transferToJsonNode(Collections.emptyList())); result.put("count", 0); return result; } List<ServiceView> serviceViews = new LinkedList<>(); for (Service service : services) { ServiceView serviceView = new ServiceView(); serviceView.setName(NamingUtils.getServiceName(service.getName())); serviceView.setGroupName(NamingUtils.getGroupName(service.getName())); serviceView.setClusterCount(service.getClusterMap().size()); serviceView.setIpCount(service.allIPs().size()); serviceView.setHealthyInstanceCount(service.healthyInstanceCount()); serviceView.setTriggerFlag(service.triggerFlag() ? "true" : "false"); serviceViews.add(serviceView); } result.replace("serviceList", JacksonUtils.transferToJsonNode(serviceViews)); result.put("count", total); return result; }  @Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @GetMapping("/service") ObjectNode serviceDetail(@RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId,
            String serviceName); @Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @RequestMapping(value = "/instances") ObjectNode instanceList(@RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId,
            @RequestParam String serviceName, @RequestParam String clusterName, @RequestParam(name = "pageNo") int page,
            @RequestParam int pageSize); @Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @GetMapping("/services") Object listDetail(@RequestParam(required = false) boolean withInstances,
            @RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId,
            @RequestParam(required = false) int pageNo, @RequestParam(required = false) int pageSize,
            @RequestParam(name = "serviceNameParam", defaultValue = StringUtils.EMPTY) String serviceName,
            @RequestParam(name = "groupNameParam", defaultValue = StringUtils.EMPTY) String groupName,
            @RequestParam(name = "instance", defaultValue = StringUtils.EMPTY) String containedInstance,
            @RequestParam(required = false) boolean hasIpCount); @RequestMapping("/rt/service") ObjectNode rt4Service(HttpServletRequest request); }
CatalogController { @Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @GetMapping("/services") public Object listDetail(@RequestParam(required = false) boolean withInstances, @RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId, @RequestParam(required = false) int pageNo, @RequestParam(required = false) int pageSize, @RequestParam(name = "serviceNameParam", defaultValue = StringUtils.EMPTY) String serviceName, @RequestParam(name = "groupNameParam", defaultValue = StringUtils.EMPTY) String groupName, @RequestParam(name = "instance", defaultValue = StringUtils.EMPTY) String containedInstance, @RequestParam(required = false) boolean hasIpCount) { String param = StringUtils.isBlank(serviceName) && StringUtils.isBlank(groupName) ? StringUtils.EMPTY : NamingUtils.getGroupedName(serviceName, groupName); if (withInstances) { List<ServiceDetailInfo> serviceDetailInfoList = new ArrayList<>(); List<Service> services = new ArrayList<>(8); serviceManager.getPagedService(namespaceId, pageNo, pageSize, param, StringUtils.EMPTY, services, false); for (Service service : services) { ServiceDetailInfo serviceDetailInfo = new ServiceDetailInfo(); serviceDetailInfo.setServiceName(NamingUtils.getServiceName(service.getName())); serviceDetailInfo.setGroupName(NamingUtils.getGroupName(service.getName())); serviceDetailInfo.setMetadata(service.getMetadata()); Map<String, ClusterInfo> clusterInfoMap = getStringClusterInfoMap(service); serviceDetailInfo.setClusterMap(clusterInfoMap); serviceDetailInfoList.add(serviceDetailInfo); } return serviceDetailInfoList; } ObjectNode result = JacksonUtils.createEmptyJsonNode(); List<Service> services = new ArrayList<>(); final int total = serviceManager.getPagedService(namespaceId, pageNo - 1, pageSize, param, containedInstance, services, hasIpCount); if (CollectionUtils.isEmpty(services)) { result.replace("serviceList", JacksonUtils.transferToJsonNode(Collections.emptyList())); result.put("count", 0); return result; } List<ServiceView> serviceViews = new LinkedList<>(); for (Service service : services) { ServiceView serviceView = new ServiceView(); serviceView.setName(NamingUtils.getServiceName(service.getName())); serviceView.setGroupName(NamingUtils.getGroupName(service.getName())); serviceView.setClusterCount(service.getClusterMap().size()); serviceView.setIpCount(service.allIPs().size()); serviceView.setHealthyInstanceCount(service.healthyInstanceCount()); serviceView.setTriggerFlag(service.triggerFlag() ? "true" : "false"); serviceViews.add(serviceView); } result.replace("serviceList", JacksonUtils.transferToJsonNode(serviceViews)); result.put("count", total); return result; }  @Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @GetMapping("/service") ObjectNode serviceDetail(@RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId,
            String serviceName); @Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @RequestMapping(value = "/instances") ObjectNode instanceList(@RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId,
            @RequestParam String serviceName, @RequestParam String clusterName, @RequestParam(name = "pageNo") int page,
            @RequestParam int pageSize); @Secured(parser = NamingResourceParser.class, action = ActionTypes.READ) @GetMapping("/services") Object listDetail(@RequestParam(required = false) boolean withInstances,
            @RequestParam(defaultValue = Constants.DEFAULT_NAMESPACE_ID) String namespaceId,
            @RequestParam(required = false) int pageNo, @RequestParam(required = false) int pageSize,
            @RequestParam(name = "serviceNameParam", defaultValue = StringUtils.EMPTY) String serviceName,
            @RequestParam(name = "groupNameParam", defaultValue = StringUtils.EMPTY) String groupName,
            @RequestParam(name = "instance", defaultValue = StringUtils.EMPTY) String containedInstance,
            @RequestParam(required = false) boolean hasIpCount); @RequestMapping("/rt/service") ObjectNode rt4Service(HttpServletRequest request);  }