aboutsummaryrefslogtreecommitdiffstats
path: root/models-pdp/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-04-29 12:33:16 -0400
committerJim Hahn <jrh3@att.com>2019-04-29 12:36:14 -0400
commitdf51f5f057f813a1f6873c3208bf002e56e22d86 (patch)
tree2b79dcb2d5609372b73363c7360de4894a748f32 /models-pdp/src/main
parent35b63d77bd8887fcc74f28b2d21f1c8faabc9df5 (diff)
Address sonar issue in policy-models/pdp
Extracted a common constant. Change-Id: I24504109e9c7bbed352fa3e845d7d3f7b07db970 Issue-ID: POLICY-1708 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/PdpGroup.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java
index 8cad58c13..4e7fc4117 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java
@@ -46,6 +46,8 @@ import org.onap.policy.models.pdp.enums.PdpState;
@Data
@NoArgsConstructor
public class PdpGroup implements PfNameVersion, Comparable<PdpGroup> {
+ private static final String SUBGROUP_FIELD = "pdpSubgroups";
+
private String name;
private String description;
private PdpState pdpGroupState;
@@ -88,10 +90,10 @@ public class PdpGroup implements PfNameVersion, Comparable<PdpGroup> {
*/
result.validateNotNull("name", name);
- result.validateNotNullList("pdpSubgroups", pdpSubgroups, PdpSubGroup::validatePapRest);
+ result.validateNotNullList(SUBGROUP_FIELD, pdpSubgroups, PdpSubGroup::validatePapRest);
if (pdpSubgroups != null && pdpSubgroups.isEmpty()) {
- result.addResult(new ObjectValidationResult("pdpSubgroups", pdpSubgroups, ValidationStatus.INVALID,
+ result.addResult(new ObjectValidationResult(SUBGROUP_FIELD, pdpSubgroups, ValidationStatus.INVALID,
"is empty"));
}
@@ -117,7 +119,7 @@ public class PdpGroup implements PfNameVersion, Comparable<PdpGroup> {
}
// different sizes implies duplicates
- result.addResult(new ObjectValidationResult("pdpSubgroups", pdpTypes, ValidationStatus.INVALID,
+ result.addResult(new ObjectValidationResult(SUBGROUP_FIELD, pdpTypes, ValidationStatus.INVALID,
"duplicate subgroups"));
}