diff options
Diffstat (limited to 'model/policy-model/src')
-rw-r--r-- | model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java index 248e4fdae..1937edac0 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java @@ -225,19 +225,15 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> { "policyMap may not be empty")); } else { for (final Entry<AxArtifactKey, AxPolicy> policyEntry : policyMap.entrySet()) { - if (policyEntry.getKey().equals(AxArtifactKey.getNullKey())) { + final AxArtifactKey entryKey = policyEntry.getKey(); + if (entryKey.equals(AxArtifactKey.getNullKey())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "key on policy entry " + policyEntry.getKey() + " may not be the null key")); + "key on policy entry " + entryKey + " may not be the null key")); } else if (policyEntry.getValue() == null) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, - "value on policy entry " + policyEntry.getKey() + " may not be null")); + "value on policy entry " + entryKey + " may not be null")); } else { - if (!policyEntry.getKey().equals(policyEntry.getValue().getKey())) { - result.addValidationMessage(new AxValidationMessage(key, this.getClass(), - ValidationResult.INVALID, "key on policy entry key " + policyEntry.getKey() - + " does not equal policy value key " + policyEntry.getValue().getKey())); - } - + validate(result, policyEntry, entryKey); result = policyEntry.getValue().validate(result); } } @@ -246,6 +242,15 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> { return result; } + private void validate(final AxValidationResult result, final Entry<AxArtifactKey, AxPolicy> policyEntry, + final AxArtifactKey entryKey) { + if (!entryKey.equals(policyEntry.getValue().getKey())) { + result.addValidationMessage( + new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key on policy entry key " + + entryKey + " does not equal policy value key " + policyEntry.getValue().getKey())); + } + } + /* * (non-Javadoc) * |