Source:
<code>private Boolean isValidLoadAlertRequests(DistroXAutoscaleClusterRequest request, ConstraintValidatorContext context) { Set<String> distinctLoadBasedHostGroups = new HashSet<>(); Set<AdjustmentType> distinctLoadBasedAdjustmentTypes = new HashSet<>(); if (request.getLoadAlertRequests().size() > 1) { String message = String.format("LoadBased autoscaling currently supports a single HostGroup in a Cluster."); <START> com.sequenceiq.cloudbreak.validation.ValidatorUtil.addConstraintViolation(context, message, "loadAlertRequests") <END> .disableDefaultConstraintViolation(); return false; } Set<String> duplicateHostGroups = request.getLoadAlertRequests().stream() .map(loadAlertRequest -> loadAlertRequest.getScalingPolicy()) .map(scalingPolicyRequest -> { distinctLoadBasedAdjustmentTypes.add(scalingPolicyRequest.getAdjustmentType()); return scalingPolicyRequest; }) .map(scalingPolicyRequest -> scalingPolicyRequest.getHostGroup()) .filter(n -> !distinctLoadBasedHostGroups.add(n)) .collect(Collectors.toSet()); if (distinctLoadBasedAdjustmentTypes.size() > 1 || !distinctLoadBasedAdjustmentTypes.contains(AdjustmentType.LOAD_BASED)) { String message = String.format("LoadBased Autoscale policy does not support AdjustmentType of type %s.", distinctLoadBasedAdjustmentTypes.toString()); com.sequenceiq.cloudbreak.validation.ValidatorUtil.addConstraintViolation(context, message, "adjustmentType") .disableDefaultConstraintViolation(); return false; } if (duplicateHostGroups.size() > 0) { String message = String.format("Hostgroup(s) %s configured with multiple LoadBased Autoscaling policies.", duplicateHostGroups.toString()); com.sequenceiq.cloudbreak.validation.ValidatorUtil.addConstraintViolation(context, message, "hostGroup") .disableDefaultConstraintViolation(); return false; } return true; }</code><technical_language>do fully qualified name</technical_language>

Target:
private Boolean isValidLoadAlertRequests(DistroXAutoscaleClusterRequest request, ConstraintValidatorContext context) { Set<String> distinctLoadBasedHostGroups = new HashSet<>(); Set<AdjustmentType> distinctLoadBasedAdjustmentTypes = new HashSet<>(); if (request.getLoadAlertRequests().size() > 1) { String message = String.format("LoadBased autoscaling currently supports a single HostGroup in a Cluster."); ValidatorUtil.addConstraintViolation(context, message, "loadAlertRequests") .disableDefaultConstraintViolation(); return false; } Set<String> duplicateHostGroups = request.getLoadAlertRequests().stream() .map(loadAlertRequest -> loadAlertRequest.getScalingPolicy()) .map(scalingPolicyRequest -> { distinctLoadBasedAdjustmentTypes.add(scalingPolicyRequest.getAdjustmentType()); return scalingPolicyRequest.getHostGroup(); }) .filter(n -> !distinctLoadBasedHostGroups.add(n)) .collect(Collectors.toSet()); if (distinctLoadBasedAdjustmentTypes.size() > 1 || !distinctLoadBasedAdjustmentTypes.contains(AdjustmentType.LOAD_BASED)) { String message = String.format("LoadBased Autoscale policy does not support AdjustmentType of type %s.", distinctLoadBasedAdjustmentTypes.toString()); ValidatorUtil.addConstraintViolation(context, message, "adjustmentType") .disableDefaultConstraintViolation(); return false; } if (duplicateHostGroups.size() > 0) { String message = String.format("Hostgroup(s) %s configured with multiple LoadBased Autoscaling policies.", duplicateHostGroups.toString()); ValidatorUtil.addConstraintViolation(context, message, "hostGroup") .disableDefaultConstraintViolation(); return false; } return true; }