aboutsummaryrefslogtreecommitdiffstats
path: root/models-base/src
diff options
context:
space:
mode:
Diffstat (limited to 'models-base/src')
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfModel.java7
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfValidator.java10
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/Validated.java8
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java3
4 files changed, 9 insertions, 19 deletions
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfModel.java b/models-base/src/main/java/org/onap/policy/models/base/PfModel.java
index 8cdcb90b7..a73616df9 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfModel.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfModel.java
@@ -33,7 +33,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.onap.policy.common.parameters.BeanValidationResult;
-import org.onap.policy.common.parameters.ObjectValidationResult;
import org.onap.policy.common.parameters.ValidationStatus;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.utils.validation.Assertions;
@@ -236,14 +235,12 @@ public abstract class PfModel extends PfConcept {
if (usedKey.getKey() instanceof PfConceptKey) {
// PfConceptKey usage, check the key exists
if (!artifactKeySet.contains(usedKey.getKey())) {
- result.addResult(new ObjectValidationResult("artifact key", usedKey.getId(),
- ValidationStatus.INVALID, NOT_DEFINED));
+ result.addResult("artifact key", usedKey.getId(), ValidationStatus.INVALID, NOT_DEFINED);
}
} else {
// PfReferenceKey usage, check the key exists
if (!referenceKeySet.contains(usedKey.getKey())) {
- result.addResult(new ObjectValidationResult("reference key", usedKey.getId(),
- ValidationStatus.INVALID, NOT_DEFINED));
+ result.addResult("reference key", usedKey.getId(), ValidationStatus.INVALID, NOT_DEFINED);
}
}
}
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfValidator.java b/models-base/src/main/java/org/onap/policy/models/base/PfValidator.java
index cbe9c2ca7..57cc3c81f 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfValidator.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfValidator.java
@@ -22,7 +22,6 @@ package org.onap.policy.models.base;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.BeanValidator;
-import org.onap.policy.common.parameters.ObjectValidationResult;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.common.parameters.ValidationStatus;
import org.onap.policy.common.parameters.ValueValidator;
@@ -100,8 +99,7 @@ public class PfValidator extends BeanValidator {
PfKey pfkey = (PfKey) value;
if (annot.keyNotNull() && pfkey.isNullKey()) {
- result.addResult(new ObjectValidationResult(fieldName, xlate(pfkey), ValidationStatus.INVALID,
- Validated.IS_A_NULL_KEY));
+ result.addResult(fieldName, xlate(pfkey), ValidationStatus.INVALID, Validated.IS_A_NULL_KEY);
return false;
}
@@ -118,13 +116,11 @@ public class PfValidator extends BeanValidator {
PfKeyImpl keyimpl = (PfKeyImpl) pfkey;
if (annot.nameNotNull() && keyimpl.isNullName()) {
- result2.addResult(new ObjectValidationResult("name", pfkey.getName(), ValidationStatus.INVALID,
- Validated.IS_NULL));
+ result2.addResult("name", pfkey.getName(), ValidationStatus.INVALID, Validated.IS_NULL);
}
if (annot.versionNotNull() && keyimpl.isNullVersion()) {
- result2.addResult(new ObjectValidationResult("version", pfkey.getVersion(), ValidationStatus.INVALID,
- Validated.IS_NULL));
+ result2.addResult("version", pfkey.getVersion(), ValidationStatus.INVALID, Validated.IS_NULL);
}
if (!result2.isClean()) {
diff --git a/models-base/src/main/java/org/onap/policy/models/base/Validated.java b/models-base/src/main/java/org/onap/policy/models/base/Validated.java
index 5ec6ab7f7..6ed1a845a 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/Validated.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/Validated.java
@@ -61,8 +61,7 @@ public class Validated {
*/
public static void addResult(@NonNull BeanValidationResult result, @NonNull String fieldName, Object value,
@NonNull String errorMessage) {
- result.addResult(
- new ObjectValidationResult(fieldName, getKeyId(value), ValidationStatus.INVALID, errorMessage));
+ result.addResult(fieldName, getKeyId(value), ValidationStatus.INVALID, errorMessage);
}
/**
@@ -85,13 +84,12 @@ public class Validated {
*/
public static void validateKeyNotNull(BeanValidationResult result, @NonNull String fieldName, PfKey key) {
if (key == null) {
- result.addResult(new ObjectValidationResult(fieldName, key, ValidationStatus.INVALID, IS_A_NULL_KEY));
+ result.addResult(fieldName, key, ValidationStatus.INVALID, IS_A_NULL_KEY);
return;
}
if (key.isNullKey()) {
- result.addResult(new ObjectValidationResult(fieldName, key.getId(), ValidationStatus.INVALID,
- IS_A_NULL_KEY));
+ result.addResult(fieldName, key.getId(), ValidationStatus.INVALID, IS_A_NULL_KEY);
return;
}
diff --git a/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java b/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java
index 8fa757a00..98dfe8919 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java
@@ -30,7 +30,6 @@ import lombok.AllArgsConstructor;
import lombok.NonNull;
import org.junit.Test;
import org.onap.policy.common.parameters.BeanValidationResult;
-import org.onap.policy.common.parameters.ObjectValidationResult;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.common.parameters.ValidationStatus;
import org.onap.policy.common.utils.coder.CoderException;
@@ -163,7 +162,7 @@ public class ValidatedTest {
}
BeanValidationResult result = new BeanValidationResult(fieldName, this);
- result.addResult(new ObjectValidationResult(fieldName, text, ValidationStatus.INVALID, NOT_SAME));
+ result.addResult(fieldName, text, ValidationStatus.INVALID, NOT_SAME);
return result;
}
}