summaryrefslogtreecommitdiffstats
path: root/models-pdp/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-04-15 14:21:18 -0400
committerJim Hahn <jrh3@att.com>2019-04-15 14:21:18 -0400
commitb9e6ea17dee2b2b0ab5b49bb9eaa72ddcd08e6cf (patch)
treeadc5bd509c66a4f96f740dfcea565370fee370c5 /models-pdp/src/main
parent510092ecd2b01d94066040e69e5b1ad52dc31c92 (diff)
Fix sonar issue in PdpGroups
Extracted common string constant. Change-Id: I5721641d8a45e7dce317cb6a1b75570a715779ea Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-pdp/src/main')
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroups.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroups.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroups.java
index ab9afb00b..06194eaba 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroups.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroups.java
@@ -41,6 +41,8 @@ import org.onap.policy.common.parameters.ValidationStatus;
@Setter
@ToString
public class PdpGroups {
+ private static final String GROUPS_FIELD = "groups";
+
private List<PdpGroup> groups;
/**
@@ -64,9 +66,9 @@ public class PdpGroups {
* @return the validation result
*/
public ValidationResult validatePapRest() {
- BeanValidationResult result = new BeanValidationResult("groups", this);
+ BeanValidationResult result = new BeanValidationResult(GROUPS_FIELD, this);
- result.validateNotNullList("groups", groups, PdpGroup::validatePapRest);
+ result.validateNotNullList(GROUPS_FIELD, groups, PdpGroup::validatePapRest);
if (!result.isValid()) {
return result;
}
@@ -78,6 +80,6 @@ public class PdpGroups {
}
// different sizes implies duplicates
- return new ObjectValidationResult("groups", names, ValidationStatus.INVALID, "duplicate group names");
+ return new ObjectValidationResult(GROUPS_FIELD, names, ValidationStatus.INVALID, "duplicate group names");
}
}