diff options
Diffstat (limited to 'models-pdp/src/main')
-rw-r--r-- | models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java index d0fc216c2..1e77c099d 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java @@ -238,16 +238,7 @@ public class JpaPdpGroup extends PfConcept implements PfAuthorative<PdpGroup> { } if (properties != null) { - for (Entry<String, String> propertyEntry : properties.entrySet()) { - if (!ParameterValidationUtils.validateStringParameter(propertyEntry.getKey())) { - result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "a property key may not be null or blank")); - } - if (!ParameterValidationUtils.validateStringParameter(propertyEntry.getValue())) { - result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "a property value may not be null or blank")); - } - } + result = validateProperties(result); } if (pdpSubGroups == null) { @@ -262,6 +253,29 @@ public class JpaPdpGroup extends PfConcept implements PfAuthorative<PdpGroup> { return result; } + /** + * Validate the properties. + * + * @param resultIn the incoming validation results so far + * @return the revalidation results including the property validation results + */ + private PfValidationResult validateProperties(PfValidationResult resultIn) { + PfValidationResult result = resultIn; + + for (Entry<String, String> propertyEntry : properties.entrySet()) { + if (!ParameterValidationUtils.validateStringParameter(propertyEntry.getKey())) { + result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "a property key may not be null or blank")); + } + if (!ParameterValidationUtils.validateStringParameter(propertyEntry.getValue())) { + result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "a property value may not be null or blank")); + } + } + + return result; + } + @Override public int compareTo(final PfConcept otherConcept) { if (otherConcept == null) { |