in dubbo-admin-server/src/main/java/org/apache/dubbo/admin/controller/WeightController.java [84:109]
public List<WeightDTO> searchWeight(@RequestParam(required = false) String service,
@RequestParam(required = false) String application,
@PathVariable String env,
@RequestParam(required = false) String serviceVersion,
@RequestParam(required = false) String serviceGroup) {
if (StringUtils.isBlank(service) && StringUtils.isBlank(application)) {
throw new ParamValidationException("Either service or application is required");
}
WeightDTO weightDTO;
if (StringUtils.isNotBlank(application)) {
weightDTO = overrideService.findWeight(application);
} else {
WeightDTO dto = new WeightDTO();
dto.setService(service);
dto.setServiceVersion(serviceVersion);
dto.setServiceGroup(serviceGroup);
String id = ConvertUtil.getIdFromDTO(dto);
weightDTO = overrideService.findWeight(id);
}
List<WeightDTO> weightDTOS = new ArrayList<>();
if (weightDTO != null) {
weightDTOS.add(weightDTO);
}
return weightDTOS;
}