diff --git a/models-base/pom.xml b/models-base/pom.xml
index 75134b7..cf9c27e 100644
--- a/models-base/pom.xml
+++ b/models-base/pom.xml
@@ -33,6 +33,11 @@
 
     <dependencies>
         <dependency>
+            <groupId>org.onap.policy.common</groupId>
+            <artifactId>common-parameters</artifactId>
+            <version>${policy.common.version}</version>
+        </dependency>
+        <dependency>
             <groupId>org.onap.policy.models</groupId>
             <artifactId>policy-models-errors</artifactId>
             <version>${project.version}</version>
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java b/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java
index 5273bd3..394eb89 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@
  * and interfaces on all concepts that are sub-classes of this class.
  */
 
-public abstract class PfConcept implements Serializable, Comparable<PfConcept> {
+public abstract class PfConcept extends Validated implements Serializable, Comparable<PfConcept> {
     private static final long serialVersionUID = -7434939557282697490L;
 
     /**
@@ -65,15 +65,6 @@
     public abstract List<PfKey> getKeys();
 
     /**
-     * Validate that this concept is structurally correct.
-     *
-     * @param result the parameter in which the result of the validation will be returned
-     * @return the validation result that was passed in in the @{link result} field with the result of this validation
-     *         added
-     */
-    public abstract PfValidationResult validate(@NonNull final PfValidationResult result);
-
-    /**
      * Clean this concept, tidy up any superfluous information such as leading and trailing white space.
      */
     public abstract void clean();
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
index 863a3ef..484632f 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
@@ -45,7 +45,8 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.lang3.StringUtils;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.common.parameters.BeanValidationResult;
+import org.onap.policy.common.parameters.ValidationResult;
 
 // @formatter:off
 /**
@@ -241,19 +242,11 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        if (key.equals(PfConceptKey.getNullKey())) {
-            result.addValidationMessage(
-                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
-        }
-
-        result = key.validate(result);
-
-        if (!conceptMap.isEmpty()) {
-            result = validateConceptMap(result);
-        }
+        result.addResult(validateKeyNotNull("key", key));
+        result.addResult(validateConceptMap());
 
         return result;
     }
@@ -261,29 +254,31 @@
     /**
      * Validate the concept map of the container.
      *
-     * @param resultIn the incoming validation results so far
-     * @return the validation results with the results of this validation added
+     * @return the validation result
      */
-    private PfValidationResult validateConceptMap(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
+    private ValidationResult validateConceptMap() {
+        BeanValidationResult result = new BeanValidationResult("conceptMap", conceptMap);
 
         for (final Entry<PfConceptKey, C> conceptEntry : conceptMap.entrySet()) {
+            BeanValidationResult result2 = null;
+
             if (conceptEntry.getKey().equals(PfConceptKey.getNullKey())) {
-                result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                        "key on concept entry " + conceptEntry.getKey() + " may not be the null key"));
+                addResult(result, "key on concept entry", conceptEntry.getKey(), IS_A_NULL_KEY);
             } else if (conceptEntry.getValue() == null) {
-                result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                        "value on concept entry " + conceptEntry.getKey() + " may not be null"));
+                result2 = new BeanValidationResult(conceptEntry.getKey().getId(), conceptEntry.getKey());
+                addResult(result2, "value", conceptEntry.getValue(), IS_NULL);
             } else if (!conceptEntry.getKey().equals(conceptEntry.getValue().getKey())) {
-                result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                        "key on concept entry key " + conceptEntry.getKey() + " does not equal concept value key "
-                                + conceptEntry.getValue().getKey()));
-                result = conceptEntry.getValue().validate(result);
+                result2 = new BeanValidationResult(conceptEntry.getKey().getId(), conceptEntry.getKey());
+                addResult(result2, "value", conceptEntry.getValue(), "does not equal concept key");
+                result2.addResult(conceptEntry.getValue().validate("value"));
             } else {
-                result = conceptEntry.getValue().validate(result);
+                result2 = new BeanValidationResult(conceptEntry.getKey().getId(), conceptEntry.getKey());
+                result2.addResult(conceptEntry.getValue().validate("value"));
             }
+
+            result.addResult(result2);
         }
-        return result;
+        return (result.isClean() ? null : result);
     }
 
     @Override
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java b/models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java
index 81066c3..3cbef75 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java
@@ -1,7 +1,7 @@
 /*
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2020 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -26,8 +26,9 @@
 import lombok.Getter;
 import lombok.NonNull;
 import lombok.ToString;
+import org.onap.policy.common.parameters.BeanValidationResult;
+import org.onap.policy.common.parameters.ValidationResult;
 import org.onap.policy.common.utils.validation.Assertions;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
 
 /**
  * A key, upon which other key subclasses can be built, providing implementations of the methods.
@@ -241,20 +242,11 @@
     }
 
     @Override
-    public PfValidationResult validate(final PfValidationResult result) {
-        final String nameValidationErrorMessage =
-            Assertions.getStringParameterValidationMessage(NAME_TOKEN, getName(), getNameRegEx());
-        if (nameValidationErrorMessage != null) {
-            result.addValidationMessage(new PfValidationMessage(this, this.getClass(), ValidationResult.INVALID,
-                "name invalid-" + nameValidationErrorMessage));
-        }
+    public ValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        final String versionValidationErrorMessage =
-            Assertions.getStringParameterValidationMessage(VERSION_TOKEN, getVersion(), getVersionRegEx());
-        if (versionValidationErrorMessage != null) {
-            result.addValidationMessage(new PfValidationMessage(this, this.getClass(), ValidationResult.INVALID,
-                "version invalid-" + versionValidationErrorMessage));
-        }
+        result.addResult(validateRegex(NAME_TOKEN, getName(), getNameRegEx()));
+        result.addResult(validateRegex(VERSION_TOKEN, getVersion(), getVersionRegEx()));
 
         return result;
     }
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java b/models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java
index 0387323..616284d 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -25,8 +25,9 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import lombok.ToString;
+import org.onap.policy.common.parameters.BeanValidationResult;
+import org.onap.policy.common.parameters.ValidationResult;
 import org.onap.policy.common.utils.validation.Assertions;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
 
 /**
  * This class records a usage of a key in the system. When the list of keys being used by a concept
@@ -134,12 +135,10 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult result) {
-        if (usedKey.isNullKey()) {
-            result.addValidationMessage(new PfValidationMessage(usedKey, this.getClass(), ValidationResult.INVALID,
-                    "usedKey is a null key"));
-        }
-        return usedKey.validate(result);
+    public ValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
+        result.addResult(validateKeyNotNull("usedKey", usedKey));
+        return result;
     }
 
     @Override
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 340f4e3..c878747 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
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -32,8 +32,10 @@
 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.utils.validation.Assertions;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
 
 /**
  * This class is the base class for all models in the Policy Framework. All model classes inherit
@@ -56,7 +58,7 @@
 @Data
 @EqualsAndHashCode(callSuper = false)
 public abstract class PfModel extends PfConcept {
-    private static final String IS_A_NULL_KEY = " is a null key";
+    private static final String KEYS_TOKEN = "keys";
 
     private static final long serialVersionUID = -771659065637205430L;
 
@@ -110,15 +112,10 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        if (key.isNullKey()) {
-            result.addValidationMessage(
-                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
-        }
-
-        result = key.validate(result);
+        result.addResult(validateKeyNotNull("key", key));
 
         // Key consistency check
         final Set<PfConceptKey> artifactKeySet = new TreeSet<>();
@@ -128,9 +125,9 @@
         for (final PfKey pfKey : this.getKeys()) {
             // Check for the two type of keys we have
             if (pfKey instanceof PfConceptKey) {
-                result = validateArtifactKeyInModel((PfConceptKey) pfKey, artifactKeySet, result);
+                validateArtifactKeyInModel((PfConceptKey) pfKey, artifactKeySet, result);
             } else if (pfKey instanceof PfReferenceKey) {
-                result = validateReferenceKeyInModel((PfReferenceKey) pfKey, referenceKeySet, result);
+                validateReferenceKeyInModel((PfReferenceKey) pfKey, referenceKeySet, result);
             } else {
                 // It must be a PfKeyUse, nothing else is legal
                 usedKeySet.add((PfKeyUse) pfKey);
@@ -140,12 +137,11 @@
         // Check all reference keys have correct parent keys
         for (final PfReferenceKey referenceKey : referenceKeySet) {
             if (!artifactKeySet.contains(referenceKey.getParentConceptKey())) {
-                result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                        "parent artifact key not found for reference key " + referenceKey));
+                addResult(result, "reference key", referenceKey, "parent artifact key not found");
             }
         }
 
-        result = validateKeyUses(usedKeySet, artifactKeySet, referenceKeySet, result);
+        validateKeyUses(usedKeySet, artifactKeySet, referenceKeySet, result);
 
         return result;
     }
@@ -156,78 +152,69 @@
      * @param artifactKey The artifact key to check
      * @param artifactKeySet The set of artifact keys encountered so far, this key is appended to
      *        the set
-     * @param result The validation result to append to
-     * @return the result of the validation
+     * @param result where to add the results
      */
-    private PfValidationResult validateArtifactKeyInModel(final PfConceptKey artifactKey,
-            final Set<PfConceptKey> artifactKeySet, final PfValidationResult result) {
-        // Null key check
-        if (artifactKey.isNullKey()) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "key " + artifactKey + IS_A_NULL_KEY));
-        }
+    private void validateArtifactKeyInModel(final PfConceptKey artifactKey,
+            final Set<PfConceptKey> artifactKeySet, final BeanValidationResult result) {
+
+        result.addResult(validateKeyNotNull(KEYS_TOKEN, artifactKey));
+
+        BeanValidationResult result2 = new BeanValidationResult(KEYS_TOKEN, artifactKey);
 
         // Null key name start check
         if (artifactKey.getName().toUpperCase().startsWith(PfKey.NULL_KEY_NAME)) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "key " + artifactKey + " name starts with keyword " + PfKey.NULL_KEY_NAME));
+            addResult(result2, "name of " + artifactKey.getId(), artifactKey.getName(),
+                            "starts with keyword " + PfKey.NULL_KEY_NAME);
         }
 
         // Unique key check
         if (artifactKeySet.contains(artifactKey)) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "duplicate key " + artifactKey + " found"));
+            addResult(result, KEYS_TOKEN, artifactKey, "duplicate key");
         } else {
             artifactKeySet.add(artifactKey);
         }
-
-        return result;
     }
 
     /**
      * Check for consistent usage of a reference key in the model.
      *
-     * @param artifactKey The reference key to check
+     * @param referenceKey The reference key to check
      * @param referenceKeySet The set of reference keys encountered so far, this key is appended to
      *        the set
-     * @param result The validation result to append to
-     * @return the result of the validation
+     * @param result where to add the results
      */
-    private PfValidationResult validateReferenceKeyInModel(final PfReferenceKey referenceKey,
-            final Set<PfReferenceKey> referenceKeySet, final PfValidationResult result) {
+    private void validateReferenceKeyInModel(final PfReferenceKey referenceKey,
+            final Set<PfReferenceKey> referenceKeySet, final BeanValidationResult result) {
         // Null key check
         if (referenceKey.isNullKey()) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "key " + referenceKey + IS_A_NULL_KEY));
+            addResult(result, KEYS_TOKEN, referenceKey, IS_A_NULL_KEY);
         }
 
+        BeanValidationResult result2 = new BeanValidationResult(KEYS_TOKEN, referenceKey);
+
         // Null parent key check
         if (referenceKey.getParentConceptKey().isNullKey()) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "parent artifact key of key " + referenceKey + IS_A_NULL_KEY));
+            addResult(result2, "parent key of " + referenceKey.getId(), referenceKey.getParentConceptKey().getId(),
+                            IS_A_NULL_KEY);
         }
 
         // Null local name check
         if (referenceKey.getLocalName().equals(PfKey.NULL_KEY_NAME)) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "key " + referenceKey + " has a null local name"));
+            addResult(result2, "local name of " + referenceKey.getId(), referenceKey.getLocalName(), IS_NULL);
         }
 
         // Null key name start check
         if (referenceKey.getParentConceptKey().getName().toUpperCase().startsWith(PfKey.NULL_KEY_NAME)) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "key " + referenceKey + " parent name starts with keyword " + PfKey.NULL_KEY_NAME));
+            addResult(result2, "parent name of " + referenceKey.getId(), referenceKey.getParentConceptKey().getName(),
+                            "starts with keyword " + PfKey.NULL_KEY_NAME);
         }
 
         // Unique key check
         if (referenceKeySet.contains(referenceKey)) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "duplicate key " + referenceKey + " found"));
+            addResult(result, KEYS_TOKEN, referenceKey, "duplicate key");
         } else {
             referenceKeySet.add(referenceKey);
         }
-
-        return result;
     }
 
     /**
@@ -238,29 +225,26 @@
      *        the set
      * @param referenceKeySet The set of reference keys encountered so far, this key is appended to
      *        the set
-     * @param result The validation result to append to
-     * @return the result of the validation
+     * @param result where to add the results
      */
-    private PfValidationResult validateKeyUses(final Set<PfKeyUse> usedKeySet, final Set<PfConceptKey> artifactKeySet,
-            final Set<PfReferenceKey> referenceKeySet, final PfValidationResult result) {
+    private void validateKeyUses(final Set<PfKeyUse> usedKeySet, final Set<PfConceptKey> artifactKeySet,
+            final Set<PfReferenceKey> referenceKeySet, final BeanValidationResult result) {
         // Check all key uses
         for (final PfKeyUse usedKey : usedKeySet) {
             if (usedKey.getKey() instanceof PfConceptKey) {
                 // PfConceptKey usage, check the key exists
                 if (!artifactKeySet.contains(usedKey.getKey())) {
-                    result.addValidationMessage(new PfValidationMessage(usedKey.getKey(), this.getClass(),
-                            ValidationResult.INVALID, "an artifact key used in the model is not defined"));
+                    result.addResult(new ObjectValidationResult("artifact key", usedKey.getId(),
+                                    ValidationStatus.INVALID, NOT_DEFINED));
                 }
             } else {
                 // PfReferenceKey usage, check the key exists
                 if (!referenceKeySet.contains(usedKey.getKey())) {
-                    result.addValidationMessage(new PfValidationMessage(usedKey.getKey(), this.getClass(),
-                            ValidationResult.INVALID, "a reference key used in the model is not defined"));
+                    result.addResult(new ObjectValidationResult("reference key", usedKey.getId(),
+                                    ValidationStatus.INVALID, NOT_DEFINED));
                 }
             }
         }
-
-        return result;
     }
 
     @Override
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java
index 7984e42..83403ac 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -28,8 +28,9 @@
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
+import org.onap.policy.common.parameters.BeanValidationResult;
+import org.onap.policy.common.parameters.ValidationResult;
 import org.onap.policy.common.utils.validation.Assertions;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
 
 /**
  * A reference key identifies entities in the system that are contained in other entities. Every contained concept in
@@ -339,34 +340,13 @@
     }
 
     @Override
-    public PfValidationResult validate(final PfValidationResult result) {
-        final String parentNameValidationErrorMessage = Assertions.getStringParameterValidationMessage(PARENT_KEY_NAME,
-                        parentKeyName, NAME_REGEXP);
-        if (parentNameValidationErrorMessage != null) {
-            result.addValidationMessage(new PfValidationMessage(this, this.getClass(), ValidationResult.INVALID,
-                            "parentKeyName invalid-" + parentNameValidationErrorMessage));
-        }
+    public ValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        final String parentKeyVersionValidationErrorMessage = Assertions
-                        .getStringParameterValidationMessage(PARENT_KEY_VERSION, parentKeyVersion, VERSION_REGEXP);
-        if (parentKeyVersionValidationErrorMessage != null) {
-            result.addValidationMessage(new PfValidationMessage(this, this.getClass(), ValidationResult.INVALID,
-                            "parentKeyVersion invalid-" + parentKeyVersionValidationErrorMessage));
-        }
-
-        final String parentLocalNameValidationErrorMessage = Assertions
-                        .getStringParameterValidationMessage(PARENT_LOCAL_NAME, parentLocalName, LOCAL_NAME_REGEXP);
-        if (parentLocalNameValidationErrorMessage != null) {
-            result.addValidationMessage(new PfValidationMessage(this, this.getClass(), ValidationResult.INVALID,
-                            "parentLocalName invalid-" + parentLocalNameValidationErrorMessage));
-        }
-
-        final String localNameValidationErrorMessage = Assertions.getStringParameterValidationMessage(LOCAL_NAME,
-                        localName, LOCAL_NAME_REGEXP);
-        if (localNameValidationErrorMessage != null) {
-            result.addValidationMessage(new PfValidationMessage(this, this.getClass(), ValidationResult.INVALID,
-                            "localName invalid-" + localNameValidationErrorMessage));
-        }
+        result.addResult(validateRegex(PARENT_KEY_NAME, parentKeyName, NAME_REGEXP));
+        result.addResult(validateRegex(PARENT_KEY_VERSION, parentKeyVersion, VERSION_REGEXP));
+        result.addResult(validateRegex(PARENT_LOCAL_NAME, parentLocalName, LOCAL_NAME_REGEXP));
+        result.addResult(validateRegex(LOCAL_NAME, localName, LOCAL_NAME_REGEXP));
 
         return result;
     }
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfValidationMessage.java b/models-base/src/main/java/org/onap/policy/models/base/PfValidationMessage.java
deleted file mode 100644
index cd8b08b..0000000
--- a/models-base/src/main/java/org/onap/policy/models/base/PfValidationMessage.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.models.base;
-
-import org.onap.policy.common.utils.validation.Assertions;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
-
-/**
- * A validation message is created for each validation observation observed during validation of a
- * concept. The message holds the key and the class of the concept on which the observation was made
- * as well as the type of observation and a message describing the observation.
- */
-public class PfValidationMessage {
-    private final PfKey observedKey;
-    private ValidationResult validationResult = ValidationResult.VALID;
-    private final String observedClass;
-    private final String message;
-
-    /**
-     * Create an validation observation with the given fields.
-     *
-     * @param observedKey the key of the class on which the validation observation was made
-     * @param observedClass the class on which the validation observation was made
-     * @param validationResult the type of observation made
-     * @param message a message describing the observation
-     */
-    public PfValidationMessage(final PfKey observedKey, final Class<?> observedClass,
-            final ValidationResult validationResult, final String message) {
-        Assertions.argumentNotNull(observedKey, "observedKey may not be null");
-        Assertions.argumentNotNull(observedClass, "observedClass may not be null");
-        Assertions.argumentNotNull(validationResult, "validationResult may not be null");
-        Assertions.argumentNotNull(message, "message may not be null");
-
-        this.observedKey = observedKey;
-        this.observedClass = observedClass.getName();
-        this.validationResult = validationResult;
-        this.message = message;
-    }
-
-    /**
-     * Gets the key of the observation.
-     *
-     * @return the key of the observation
-     */
-    public PfKey getObservedKey() {
-        return observedKey;
-    }
-
-    /**
-     * Gets the observed class.
-     *
-     * @return the observed class
-     */
-    public String getObservedClass() {
-        return observedClass;
-    }
-
-    /**
-     * Gets the type of observation made.
-     *
-     * @return the type of observation made
-     */
-    public ValidationResult getValidationResult() {
-        return validationResult;
-    }
-
-    /**
-     * Get a description of the observation.
-     *
-     * @return the observation description
-     */
-    public String getMessage() {
-        return message;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see java.lang.Object#toString()
-     */
-    @Override
-    public String toString() {
-        return observedKey.toString() + ':' + observedClass + ':' + validationResult.name() + ':' + message;
-    }
-}
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfValidationResult.java b/models-base/src/main/java/org/onap/policy/models/base/PfValidationResult.java
deleted file mode 100644
index bbac3b7..0000000
--- a/models-base/src/main/java/org/onap/policy/models/base/PfValidationResult.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2020 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.models.base;
-
-import java.util.LinkedList;
-import java.util.List;
-import lombok.Getter;
-
-/**
- * This class records the result of a validation and holds all validation observation messages.
- */
-@Getter
-public class PfValidationResult {
-    /**
-     * The ValidationResult enumeration describes the severity of a validation result.
-     */
-    public enum ValidationResult {
-        /** No problems or observations were detected during validation. */
-        VALID,
-        /**
-         * Observations were made on a concept (such as blank descriptions) of a nature that will not affect the use of
-         * the concept.
-         */
-        OBSERVATION,
-        /**
-         * Warnings were made on a concept (such as defined but unused concepts) of a nature that may affect the use of
-         * the concept.
-         */
-        WARNING,
-        /**
-         * Errors were detected on a concept (such as referenced but undefined concepts) of a nature that will affect
-         * the use of the concept.
-         */
-        INVALID
-    }
-
-    // The actual verification result
-    private ValidationResult validationResult = ValidationResult.VALID;
-
-    // Messages collected during the verification process
-    private final List<PfValidationMessage> messageList = new LinkedList<>();
-
-    /**
-     * Check if a validation reported a valid concept, returns true if the model is usable (that is, even if the model
-     * has warnings or observations).
-     *
-     * @return true, if the concept is reported as valid and can be used
-     */
-    public boolean isValid() {
-        return validationResult != ValidationResult.INVALID;
-    }
-
-    /**
-     * Check if a validation reported a concept with no errors or warnings, returns true if the model is OK to use.
-     *
-     * @return true, if the concept has no warnings or errors
-     */
-    public boolean isOk() {
-        return validationResult == ValidationResult.VALID || validationResult == ValidationResult.OBSERVATION;
-    }
-
-
-    /**
-     * Append a validation result to another validation result.
-     *
-     * @param result2Append the result to append to the current validation result
-     */
-    public void append(final PfValidationResult result2Append) {
-        for (PfValidationMessage message : result2Append.getMessageList()) {
-            addValidationMessage(message);
-        }
-    }
-
-    /**
-     * Adds a validation message to the validation result, used by validate() implementations on {@link PfConcept}
-     * subclasses to report validaiton observations.
-     *
-     * @param validationMessage the validation message
-     */
-    public void addValidationMessage(final PfValidationMessage validationMessage) {
-        messageList.add(validationMessage);
-
-        // Check if the incoming message has a more sever status than the
-        // current one on the overall validation result,
-        // if so, the overall result goes to that level
-        if (validationMessage.getValidationResult().ordinal() > validationResult.ordinal()) {
-            validationResult = validationMessage.getValidationResult();
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see java.lang.Object#toString()
-     */
-    @Override
-    public String toString() {
-        final StringBuilder builder = new StringBuilder();
-
-        switch (validationResult) {
-            case VALID:
-
-                builder.append("***validation of model successful***");
-                return builder.toString();
-            case OBSERVATION:
-
-                builder.append("\n***observations noted during validation of model***\n");
-                break;
-            case WARNING:
-
-                builder.append("\n***warnings issued during validation of model***\n");
-                break;
-            case INVALID:
-                builder.append("\n***validation of model failed***\n");
-                break;
-            default:
-                break;
-        }
-
-        for (final PfValidationMessage message : messageList) {
-            builder.append(message);
-            builder.append("\n");
-        }
-
-        builder.append("********************************");
-        return builder.toString();
-    }
-}
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 d79d58f..b962d46 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
@@ -20,234 +20,343 @@
 
 package org.onap.policy.models.base;
 
+import com.google.re2j.Pattern;
 import java.util.Collection;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.function.BiFunction;
+import java.util.function.Function;
 import lombok.NonNull;
-import org.onap.policy.common.utils.validation.Assertions;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.apache.commons.lang3.StringUtils;
+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;
 
 /**
  * Classes that can be validated. This can be used as a super class or as a stand-alone
  * utility class.
  */
-public class Validated {
+public abstract class Validated {
+    public static final String IS_BLANK = "is blank";
+    public static final String IS_A_NULL_KEY = "is a null key";
+    public static final String IS_NULL = "is null";
+    public static final String NOT_DEFINED = "not defined";
+    public static final String NOT_FOUND = "not found";
+
+    public static final String KEY_TOKEN = "key";
+    public static final String VALUE_TOKEN = "value";
 
     /**
-     * Validates the fields of the object. The default method simply returns the result.
+     * Validates the fields of the object.
      *
-     * @param result where to place the result
-     * @return the result
+     * @param fieldName name of the field containing this
+     * @return the result, or {@code null}
      */
-    public PfValidationResult validate(@NonNull PfValidationResult result) {
-        return result;
+    public abstract ValidationResult validate(String fieldName);
+
+    /**
+     * Adds a result indicating that a value is invalid.
+     *
+     * @param result where to put the result
+     * @param fieldName name of the field containing the value
+     * @param value the field's value
+     * @param errorMessage the error message
+     */
+    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));
     }
 
     /**
-     * Validates that a field value is not null.
+     * Makes a result that indicates a value is invalid, because it is null.
      *
-     * @param container the object that contains the field
-     * @param fieldName name of the field to be validated
-     * @param value value to be validated
-     * @param result where to place the result
-     * @return the result
+     * @param fieldName name of the field containing the value
+     * @param value the field's value
+     * @return a result indicating the value is invalid
      */
-    public PfValidationResult validateNotNull(@NonNull Object container, @NonNull String fieldName, Object value,
-                    @NonNull PfValidationResult result) {
-
-        if (value == null) {
-            addError(container, fieldName, result, "null");
-        }
-
-        return result;
+    public static ValidationResult makeNullResult(@NonNull String fieldName, Object value) {
+        return new ObjectValidationResult(fieldName, getKeyId(value), ValidationStatus.INVALID, IS_NULL);
     }
 
     /**
-     * Validates that the name and version of a concept key do not have the null default
-     * values.
+     * Validates a value, if is not {@code null}, by invoking it's validate() method.
      *
-     * @param value value to be validated
-     * @param result where to place the result
-     * @return the result
+     * @param result where to put the result
+     * @param fieldName name of the field containing the value
+     * @param value the field's value
      */
-    public PfValidationResult validateNotNull(@NonNull PfConceptKey value, @NonNull PfValidationResult result) {
-
-        if (PfKey.NULL_KEY_NAME.equals(value.getName())) {
-            addError(value, "name", result, "null");
-        }
-
-        if (PfKey.NULL_KEY_VERSION.equals(value.getVersion())) {
-            addError(value, "version", result, "null");
-        }
-
-        return result;
-    }
-
-    /**
-     * Validates the contents of a field, verifying that it matches a pattern, if it is
-     * non-null.
-     *
-     * @param container the object that contains the field
-     * @param fieldName name of the field to be validated
-     * @param value value to be validated
-     * @param pattern pattern used to validate the value
-     * @param result where to place the result
-     * @return the result
-     */
-    public PfValidationResult validateText(@NonNull Object container, @NonNull String fieldName, String value,
-                    @NonNull String pattern, @NonNull PfValidationResult result) {
-
+    public static void validateOptional(@NonNull BeanValidationResult result, @NonNull String fieldName,
+                    Validated value) {
         if (value != null) {
-            addError(container, fieldName, result,
-                            Assertions.getStringParameterValidationMessage(fieldName, value, pattern));
+            result.addResult(value.validate(fieldName));
         }
-
-        return result;
     }
 
     /**
-     * Validates the contents of a property field, verifying that the keys ands values are
-     * non-null.
+     * Validates that a value is not {@code null}. If the value is a subclass of this
+     * class, then it's {@link #validate(String)} method is invoked, too.
      *
-     * @param container the object that contains the field
-     * @param fieldName name of the field to be validated
-     * @param properties properties to be validated
-     * @param resultIn where to place the result
-     * @return the result
+     * @param fieldName name of the field containing the value
+     * @param value the field's value
+     * @return a result, or {@code null}
      */
-    public <T> PfValidationResult validatePropertiesNotNull(@NonNull Object container, @NonNull String fieldName,
-                    Map<String, T> properties, @NonNull PfValidationResult resultIn) {
-
-        PfValidationResult result = resultIn;
-
-        if (properties == null) {
-            return result;
+    public static ValidationResult validateNotNull(@NonNull String fieldName, Object value) {
+        if (value == null) {
+            return new ObjectValidationResult(fieldName, value, ValidationStatus.INVALID, IS_NULL);
         }
 
-        for (Entry<String, T> ent : properties.entrySet()) {
-            String key = ent.getKey();
-            String keyName = fieldName + "." + key;
-            result = validateNotNull(container, keyName, key, result);
-
-            result = validateNotNull(container, keyName, ent.getValue(), result);
+        if (value instanceof Validated) {
+            return ((Validated) value).validate(fieldName);
         }
 
-        return result;
+        return null;
     }
 
     /**
-     * Validates the items in a collection field are non-null.
+     * Validates that a value is not "blank" (i.e., empty). value.
      *
-     * @param container the object that contains the field
-     * @param fieldName name of the field to be validated
-     * @param collection collection whose items are to be validated
-     * @param resultIn where to place the result
-     * @return the result
+     * @param fieldName name of the field containing the value
+     * @param value the field's value
+     * @param checkNull {@code true} if to validate that the value is not {@code null}
+     * @return a result, or {@code null}
      */
-    public <T> PfValidationResult validateCollectionNotNull(@NonNull Object container, @NonNull String fieldName,
-                    Collection<T> collection, @NonNull PfValidationResult resultIn) {
+    public static ValidationResult validateNotBlank(@NonNull String fieldName, String value, boolean checkNull) {
+        if (value == null && !checkNull) {
+            return null;
+        }
 
-        PfValidationResult result = resultIn;
+        if (StringUtils.isBlank(value)) {
+            return new ObjectValidationResult(fieldName, value, ValidationStatus.INVALID, IS_BLANK);
+        }
 
-        if (collection == null) {
+        return null;
+    }
+
+    /**
+     * Validates that a value matches regular expression.
+     *
+     * @param fieldName name of the field containing the value
+     * @param value the field's value
+     * @param pattern regular expression to be matched
+     * @return a result, or {@code null}
+     */
+    public static ValidationResult validateRegex(@NonNull String fieldName, String value, @NonNull String pattern) {
+        if (value == null) {
+            return makeNullResult(fieldName, value);
+        }
+
+        if (!Pattern.matches(pattern, value)) {
+            return new ObjectValidationResult(fieldName, value, ValidationStatus.INVALID,
+                            "does not match regular expression " + pattern);
+        }
+
+        return null;
+    }
+
+    /**
+     * Validates a key, ensuring that it isn't null and that it's structurally sound.
+     *
+     * @param fieldName name of the field containing the key
+     * @param key the field's value
+     * @return a result, or {@code null}
+     */
+    public static ValidationResult validateKeyNotNull(@NonNull String fieldName, PfKey key) {
+        if (key == null) {
+            return new ObjectValidationResult(fieldName, key, ValidationStatus.INVALID, IS_A_NULL_KEY);
+        }
+
+        if (key.isNullKey()) {
+            return new ObjectValidationResult(fieldName, key.getId(), ValidationStatus.INVALID, IS_A_NULL_KEY);
+        }
+
+        return key.validate(fieldName);
+    }
+
+    /**
+     * Validates a key's version, ensuring that it isn't null.
+     *
+     * @param fieldName name of the field containing the key
+     * @param key the field's value
+     * @return a result, or {@code null}
+     */
+    public static BeanValidationResult validateKeyVersionNotNull(@NonNull String fieldName, PfConceptKey key) {
+        if (key != null && key.isNullVersion()) {
+            BeanValidationResult result = new BeanValidationResult(fieldName, key);
+            result.addResult(makeNullResult(PfKeyImpl.VERSION_TOKEN, key.getVersion()));
             return result;
         }
 
-        String prefix = fieldName + ".";
+        return null;
+    }
+
+    /**
+     * Generates a function to validate that a value is not below a minimum.
+     *
+     * @param min minimum value allowed
+     * @param allowedValue {@code null} or an allowed value outside the range
+     * @param checkRef {@code true} to generate an error if the value is {@code null}
+     * @return a function to validate that a value is not below a minimum
+     */
+    public static BiFunction<String, Integer, ValidationResult> validateMin(int min, Integer allowedValue,
+                    boolean checkRef) {
+        return (name, value) -> validateMin(name, value, min, allowedValue, checkRef);
+    }
+
+    /**
+     * Validates that a value is not below a minimum.
+     *
+     * @param fieldName name of the field containing the key
+     * @param value the field's value
+     * @param min minimum value allowed
+     * @param allowedValue {@code null} or an allowed value outside the range
+     * @param checkRef {@code true} to generate an error if the value is {@code null}
+     * @return a result, or {@code null}
+     */
+    public static ValidationResult validateMin(@NonNull String fieldName, Integer value, int min, Integer allowedValue,
+                    boolean checkRef) {
+        if (value == null) {
+            if (checkRef) {
+                return makeNullResult(fieldName, value);
+            }
+
+            return null;
+        }
+
+        if (value < min && !value.equals(allowedValue)) {
+            return new ObjectValidationResult(fieldName, value, ValidationStatus.INVALID,
+                            "is below the minimum value: " + min);
+        }
+
+        return null;
+    }
+
+    /**
+     * Validates the items in a list.
+     *
+     * @param result where to add the results
+     * @param fieldName name of the field containing the list
+     * @param list the field's list (may be {@code null})
+     * @param checker function to validate in individual item in the list
+     */
+    public static <T> void validateList(@NonNull BeanValidationResult result, @NonNull String fieldName,
+                    Collection<T> list, @NonNull BiFunction<String, T, ValidationResult> checker) {
+        if (list == null) {
+            return;
+        }
+
+        BeanValidationResult result2 = new BeanValidationResult(fieldName, list);
+
         int count = 0;
-
-        for (T item : collection) {
-            result = validateNotNull(container, prefix + count, item, result);
-            ++count;
+        for (T value : list) {
+            result2.addResult(checker.apply(String.valueOf(count++), value));
         }
 
-        return result;
-    }
-
-    /**
-     * Invokes the "validate()" method on each item in a collection field, if the item is
-     * non-null.
-     *
-     * @param container the object that contains the field
-     * @param fieldName name of the field to be validated
-     * @param collection collection whose items are to be validated
-     * @param result where to place the result
-     * @return the result
-     */
-    public <T extends Validated> PfValidationResult validateCollection(@NonNull Object container,
-                    @NonNull String fieldName, Collection<T> collection, @NonNull PfValidationResult result) {
-
-        if (collection == null) {
-            return result;
-        }
-
-        for (T item : collection) {
-            if (item != null) {
-                result = item.validate(result);
-            }
-        }
-
-        return result;
-    }
-
-    /**
-     * Invokes the "validate()" method on each item in a concept collection field, if the
-     * item is non-null.
-     *
-     * @param container the object that contains the field
-     * @param fieldName name of the field to be validated
-     * @param collection collection whose items are to be validated
-     * @param result where to place the result
-     * @return the result
-     */
-    public <T extends PfConcept> PfValidationResult validateConceptCollection(@NonNull Object container,
-                    @NonNull String fieldName, Collection<T> collection, @NonNull PfValidationResult result) {
-
-        if (collection == null) {
-            return result;
-        }
-
-        for (T item : collection) {
-            if (item != null) {
-                result = item.validate(result);
-            }
-        }
-
-        return result;
-    }
-
-    /**
-     * Adds an error message to the validation result.
-     *
-     * @param container the object that contains the field
-     * @param fieldName name of the field to be validated
-     * @param result where to place the result
-     * @param errmsg the error message to be added, or {@code null} if nothing to add
-     */
-    public void addError(@NonNull Object container, @NonNull String fieldName, @NonNull PfValidationResult result,
-                    String errmsg) {
-        if (errmsg != null) {
-            result.addValidationMessage(new PfValidationMessage(makeKey(container), container.getClass(),
-                            ValidationResult.INVALID, fieldName + " invalid-" + errmsg));
+        if (!result2.isClean()) {
+            result.addResult(result2);
         }
     }
 
     /**
-     * Makes a PfKey suitable for insertion into a validation message. Note: the
-     * "toString()" method of the key simply invokes container.toString();
+     * Validates the items in a map.
      *
-     * @param container the container object for which the key should be made
-     * @return a key for the container
+     * @param result where to add the results
+     * @param fieldName name of the field containing the list
+     * @param map the field's map (may be {@code null})
+     * @param checker function to validate in individual item in the list
      */
-    public PfKey makeKey(@NonNull Object container) {
+    public static <T> void validateMap(@NonNull BeanValidationResult result, @NonNull String fieldName,
+                    Map<String, T> map, @NonNull Function<Map.Entry<String, T>, ValidationResult> checker) {
+        if (map == null) {
+            return;
+        }
 
-        return new PfConceptKey() {
-            private static final long serialVersionUID = 1L;
+        BeanValidationResult result2 = new BeanValidationResult(fieldName, map);
 
-            @Override
-            public String toString() {
-                return container.toString();
-            }
-        };
+        for (Entry<String, T> entry : map.entrySet()) {
+            result2.addResult(checker.apply(entry));
+        }
+
+        if (!result2.isClean()) {
+            result.addResult(result2);
+        }
+    }
+
+    /**
+     * Validates a Map entry, ensuring that neither the key nor the value are "blank"
+     * (i.e., empty or {@code null}).
+     *
+     * @param entry entry to be validated
+     * @return a result, or {@code null}
+     */
+    public static BeanValidationResult validateEntryNotBlankNotBlank(Map.Entry<String, String> entry) {
+        BeanValidationResult result = new BeanValidationResult("" + entry.getKey(), entry.getKey());
+
+        if (StringUtils.isBlank(entry.getKey())) {
+            Validated.addResult(result, KEY_TOKEN, entry.getKey(), IS_BLANK);
+        }
+
+        if (StringUtils.isBlank(entry.getValue())) {
+            Validated.addResult(result, VALUE_TOKEN, entry.getValue(), IS_BLANK);
+        }
+
+        return (result.isClean() ? null : result);
+    }
+
+    /**
+     * Validates a Map entry, ensuring that the key is not "blank" (i.e., empty or
+     * {@code null}) and the value is not {@code null}.
+     *
+     * @param entry entry to be validated
+     * @return a result, or {@code null}
+     */
+    public static BeanValidationResult validateEntryNotBlankNotNull(Map.Entry<String, String> entry) {
+        BeanValidationResult result = new BeanValidationResult("" + entry.getKey(), entry.getKey());
+
+        if (StringUtils.isBlank(entry.getKey())) {
+            Validated.addResult(result, KEY_TOKEN, entry.getKey(), IS_BLANK);
+        }
+
+        if (entry.getValue() == null) {
+            result.addResult(makeNullResult(VALUE_TOKEN, entry.getValue()));
+        }
+
+        return (result.isClean() ? null : result);
+    }
+
+    /**
+     * Validates a Map entry, ensuring that neither the key nor the value are
+     * {@code null}. If the value is a subclass of this class, then it's
+     * {@link #validate(String)} method is invoked.
+     *
+     * @param entry entry to be validated
+     * @return a result, or {@code null}
+     */
+    public static <V> BeanValidationResult validateEntryValueNotNull(Map.Entry<String, V> entry) {
+        BeanValidationResult result = new BeanValidationResult("" + entry.getKey(), entry.getKey());
+
+        if (entry.getKey() == null) {
+            result.addResult(makeNullResult(KEY_TOKEN, entry.getKey()));
+        }
+
+        V value = entry.getValue();
+        if (value == null) {
+            result.addResult(makeNullResult(VALUE_TOKEN, value));
+        } else if (value instanceof Validated) {
+            result.addResult(((Validated) value).validate(VALUE_TOKEN));
+        }
+
+        return (result.isClean() ? null : result);
+    }
+
+    /**
+     * Gets a key's ID, if the value is a {@link PfKey}.
+     *
+     * @param value value from which to get the ID
+     * @return the value's ID, if it's a key, the original value otherwise
+     */
+    private static Object getKeyId(Object value) {
+        return (value instanceof PfKey ? ((PfKey) value).getId() : value);
     }
 }
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java
index 062f6f9..8c74850 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java
@@ -21,6 +21,7 @@
 
 package org.onap.policy.models.base;
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -111,9 +112,7 @@
         container.clean();
         assertEquals(clonedContainer, container);
 
-        PfValidationResult result = new PfValidationResult();
-        result = container.validate(result);
-        assertTrue(result.isOk());
+        assertThat(container.validate("").getResult()).isNull();
 
         assertEquals(0, container.compareTo(clonedContainer));
 
@@ -136,30 +135,30 @@
 
         final DummyPfConceptContainer container3 = container;
         assertThatThrownBy(() -> container3.validate(null))
-            .hasMessageMatching("^resultIn is marked .*on.*ull but is null$");
+            .hasMessageMatching("^fieldName is marked .*on.*ull but is null$");
 
         DummyPfConceptContainer validateContainer = new DummyPfConceptContainer();
-        assertFalse(validateContainer.validate(new PfValidationResult()).isOk());
+        assertFalse(validateContainer.validate("").isValid());
         validateContainer.setKey(new PfConceptKey("VCKey", VERSION0_0_1));
-        assertTrue(validateContainer.validate(new PfValidationResult()).isOk());
+        assertTrue(validateContainer.validate("").isValid());
 
         validateContainer.getConceptMap().put(testConceptKey, new DummyPfConcept(testConceptKey));
-        assertTrue(validateContainer.validate(new PfValidationResult()).isOk());
+        assertTrue(validateContainer.validate("").isValid());
 
         validateContainer.getConceptMap().put(PfConceptKey.getNullKey(), new DummyPfConcept(PfConceptKey.getNullKey()));
-        assertFalse(validateContainer.validate(new PfValidationResult()).isOk());
+        assertFalse(validateContainer.validate("").isValid());
         validateContainer.getConceptMap().remove(PfConceptKey.getNullKey());
-        assertTrue(validateContainer.validate(new PfValidationResult()).isOk());
+        assertTrue(validateContainer.validate("").isValid());
 
         validateContainer.getConceptMap().put(testConceptKey, null);
-        assertFalse(validateContainer.validate(new PfValidationResult()).isOk());
+        assertFalse(validateContainer.validate("").isValid());
         validateContainer.getConceptMap().put(testConceptKey, new DummyPfConcept(testConceptKey));
-        assertTrue(validateContainer.validate(new PfValidationResult()).isOk());
+        assertTrue(validateContainer.validate("").isValid());
 
         validateContainer.getConceptMap().put(testConceptKey, new DummyPfConcept(conceptKey));
-        assertFalse(validateContainer.validate(new PfValidationResult()).isOk());
+        assertFalse(validateContainer.validate("").isValid());
         validateContainer.getConceptMap().put(testConceptKey, new DummyPfConcept(testConceptKey));
-        assertTrue(validateContainer.validate(new PfValidationResult()).isOk());
+        assertTrue(validateContainer.validate("").isValid());
 
         assertEquals(conceptKey, container.get(conceptKey).getKey());
         assertEquals(conceptKey, container.get(conceptKey.getName()).getKey());
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java
index 8b94a48..8d6b1b9 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java
@@ -21,6 +21,7 @@
 
 package org.onap.policy.models.base;
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
@@ -35,6 +36,7 @@
 import lombok.NoArgsConstructor;
 import lombok.Setter;
 import org.junit.Test;
+import org.onap.policy.common.parameters.ValidationResult;
 import org.onap.policy.models.base.PfKey.Compatibility;
 import org.onap.policy.models.base.testconcepts.DummyPfKey;
 
@@ -109,20 +111,13 @@
         assertFalse(someKey1.isCompatible(someKey5));
         assertFalse(someKey1.isCompatible(new DummyPfKey()));
 
-        assertEquals(PfValidationResult.ValidationResult.VALID,
-            someKey0.validate(new PfValidationResult()).getValidationResult());
-        assertEquals(PfValidationResult.ValidationResult.VALID,
-            someKey1.validate(new PfValidationResult()).getValidationResult());
-        assertEquals(PfValidationResult.ValidationResult.VALID,
-            someKey2.validate(new PfValidationResult()).getValidationResult());
-        assertEquals(PfValidationResult.ValidationResult.VALID,
-            someKey3.validate(new PfValidationResult()).getValidationResult());
-        assertEquals(PfValidationResult.ValidationResult.VALID,
-            someKey4.validate(new PfValidationResult()).getValidationResult());
-        assertEquals(PfValidationResult.ValidationResult.VALID,
-            someKey5.validate(new PfValidationResult()).getValidationResult());
-        assertEquals(PfValidationResult.ValidationResult.VALID,
-            someKey6.validate(new PfValidationResult()).getValidationResult());
+        assertTrue(someKey0.validate("").isValid());
+        assertTrue(someKey1.validate("").isValid());
+        assertTrue(someKey2.validate("").isValid());
+        assertTrue(someKey3.validate("").isValid());
+        assertTrue(someKey4.validate("").isValid());
+        assertTrue(someKey5.validate("").isValid());
+        assertTrue(someKey6.validate("").isValid());
 
         someKey0.clean();
         assertNotNull(someKey0.toString());
@@ -179,22 +174,20 @@
         Field nameField = testKey.getClass().getDeclaredField("name");
         nameField.setAccessible(true);
         nameField.set(testKey, "Key Name");
-        PfValidationResult validationResult = new PfValidationResult();
-        testKey.validate(validationResult);
+        ValidationResult validationResult = testKey.validate("");
         nameField.set(testKey, "TheKey");
         nameField.setAccessible(false);
-        assertEquals("name invalid-parameter name with value Key Name " + "does not match regular expression "
-            + PfKey.NAME_REGEXP, validationResult.getMessageList().get(0).getMessage());
+        assertThat(validationResult.getResult()).contains("\"name\"").doesNotContain("\"version\"")
+            .contains("does not match regular expression " + PfKey.NAME_REGEXP);
 
         Field versionField = testKey.getClass().getDeclaredField("version");
         versionField.setAccessible(true);
         versionField.set(testKey, "Key Version");
-        PfValidationResult validationResult2 = new PfValidationResult();
-        testKey.validate(validationResult2);
+        ValidationResult validationResult2 = testKey.validate("");
         versionField.set(testKey, VERSION001);
         versionField.setAccessible(false);
-        assertEquals("version invalid-parameter version with value Key Version " + "does not match regular expression "
-            + PfKey.VERSION_REGEXP, validationResult2.getMessageList().get(0).getMessage());
+        assertThat(validationResult2.getResult()).doesNotContain("\"name\"").contains("\"version\"")
+            .contains("does not match regular expression " + PfKey.VERSION_REGEXP);
     }
 
     @Test
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java
index f9ad889..d2aebdc 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java
@@ -62,9 +62,7 @@
         keyUse.clean();
         assertNotNull(keyUse);
 
-        PfValidationResult result = new PfValidationResult();
-        result = keyUse.validate(result);
-        assertNotNull(result);
+        assertNotNull(keyUse.validate(""));
 
         assertNotEquals(0, keyUse.hashCode());
 
@@ -84,8 +82,7 @@
         assertEquals(0, keyUse.compareTo(new PfKeyUse(key)));
 
         PfKeyUse keyUseNull = new PfKeyUse(PfConceptKey.getNullKey());
-        PfValidationResult resultNull = new PfValidationResult();
-        assertEquals(false, keyUseNull.validate(resultNull).isValid());
+        assertEquals(false, keyUseNull.validate("").isValid());
 
         assertThatThrownBy(() -> keyUse.setKey(null)).hasMessageMatching("^key is marked .*on.*ull but is null$");
 
@@ -93,7 +90,8 @@
 
         assertThatThrownBy(() -> keyUse.isCompatible(null)).hasMessageMatching(OTHER_KEY_IS_NULL);
 
-        assertThatThrownBy(() -> keyUse.validate(null)).hasMessageMatching("^result is marked .*on.*ull but is null$");
+        assertThatThrownBy(() -> keyUse.validate(null))
+                        .hasMessageMatching("^fieldName is marked .*on.*ull but is null$");
 
         PfKeyUse testKeyUse = new PfKeyUse(new DummyPfConceptKeySub(new PfConceptKey()));
         assertEquals(testKeyUse, new PfKeyUse(testKeyUse));
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java
index 9e4e350..760231a 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java
@@ -73,59 +73,59 @@
     public void testPfModelValidation() {
         PfConceptKey dpmKey = new PfConceptKey("modelKey", VERSION001);
         DummyPfModel dpm = new DummyPfModel(dpmKey);
-        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+        assertTrue(dpm.validate("").isValid());
 
-        assertThatThrownBy(() -> dpm.validate(null)).hasMessageMatching("^resultIn is marked .*on.*ull but is null$");
+        assertThatThrownBy(() -> dpm.validate(null)).hasMessageMatching("^fieldName is marked .*on.*ull but is null$");
 
         dpm.setKey(PfConceptKey.getNullKey());
-        assertFalse(dpm.validate(new PfValidationResult()).isValid());
+        assertFalse(dpm.validate("").isValid());
         dpm.setKey(dpmKey);
-        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+        assertTrue(dpm.validate("").isValid());
 
         dpm.getKeyList().add(PfReferenceKey.getNullKey());
         dpm.getKeyList().add(new PfKeyUse(PfReferenceKey.getNullKey()));
-        assertFalse(dpm.validate(new PfValidationResult()).isValid());
+        assertFalse(dpm.validate("").isValid());
         dpm.getKeyList().clear();
-        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+        assertTrue(dpm.validate("").isValid());
 
         PfConceptKey goodCKey = new PfConceptKey("goodCKey", VERSION001);
         PfReferenceKey goodRKey = new PfReferenceKey(goodCKey, "goodLocalName");
 
         dpm.getKeyList().add(goodCKey);
         dpm.getKeyList().add(goodRKey);
-        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+        assertTrue(dpm.validate("").isValid());
 
         PfConceptKey goodCKeyDup = new PfConceptKey(goodCKey);
         dpm.getKeyList().add(goodCKeyDup);
-        assertFalse(dpm.validate(new PfValidationResult()).isValid());
+        assertFalse(dpm.validate("").isValid());
         dpm.getKeyList().remove(goodCKeyDup);
-        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+        assertTrue(dpm.validate("").isValid());
 
         PfReferenceKey goodRKeyDup = new PfReferenceKey(goodRKey);
         dpm.getKeyList().add(goodRKeyDup);
-        assertFalse(dpm.validate(new PfValidationResult()).isValid());
+        assertFalse(dpm.validate("").isValid());
         dpm.getKeyList().remove(goodRKeyDup);
-        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+        assertTrue(dpm.validate("").isValid());
 
         PfKeyUse goodCKeyUse = new PfKeyUse(goodCKey);
         dpm.getKeyList().add(goodCKeyUse);
-        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+        assertTrue(dpm.validate("").isValid());
 
         PfKeyUse goodRKeyUse = new PfKeyUse(goodRKey);
         dpm.getKeyList().add(goodRKeyUse);
-        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+        assertTrue(dpm.validate("").isValid());
 
         PfConceptKey badCKey = new PfConceptKey("badCKey", VERSION001);
         PfKeyUse badCKeyUse = new PfKeyUse(badCKey);
         dpm.getKeyList().add(badCKeyUse);
-        assertFalse(dpm.validate(new PfValidationResult()).isValid());
+        assertFalse(dpm.validate("").isValid());
         dpm.getKeyList().remove(badCKeyUse);
-        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+        assertTrue(dpm.validate("").isValid());
 
         PfKeyUse badRKeyUse = new PfKeyUse(new PfReferenceKey(badCKey, "badLocalName"));
         dpm.getKeyList().add(badRKeyUse);
-        assertFalse(dpm.validate(new PfValidationResult()).isValid());
+        assertFalse(dpm.validate("").isValid());
         dpm.getKeyList().remove(badRKeyUse);
-        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+        assertTrue(dpm.validate("").isValid());
     }
 }
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java
index a27a5dd..de328e9 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java
@@ -21,6 +21,7 @@
 
 package org.onap.policy.models.base;
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -30,6 +31,7 @@
 
 import java.lang.reflect.Field;
 import org.junit.Test;
+import org.onap.policy.common.parameters.ValidationResult;
 
 public class PfReferenceKeyTest {
 
@@ -93,9 +95,7 @@
         assertEquals(PfKey.Compatibility.DIFFERENT, testReferenceKey.getCompatibility(PfReferenceKey.getNullKey()));
         assertEquals(PfKey.Compatibility.IDENTICAL, testReferenceKey.getCompatibility(testReferenceKey));
 
-        PfValidationResult result = new PfValidationResult();
-        result = testReferenceKey.validate(result);
-        assertEquals(PfValidationResult.ValidationResult.VALID, result.getValidationResult());
+        assertTrue(testReferenceKey.validate("").isValid());
 
         testReferenceKey.clean();
 
@@ -139,49 +139,37 @@
         Field parentNameField = testReferenceKey.getClass().getDeclaredField("parentKeyName");
         parentNameField.setAccessible(true);
         parentNameField.set(testReferenceKey, "Parent Name");
-        PfValidationResult validationResult = new PfValidationResult();
-        testReferenceKey.validate(validationResult);
+        ValidationResult validationResult = testReferenceKey.validate("");
         parentNameField.set(testReferenceKey, "ParentName");
         parentNameField.setAccessible(false);
-        assertEquals(
-            "parentKeyName invalid-parameter parentKeyName with value Parent Name "
-                + "does not match regular expression " + PfKey.NAME_REGEXP,
-            validationResult.getMessageList().get(0).getMessage());
+        assertThat(validationResult.getResult()).contains("\"parentKeyName\"")
+                        .contains("does not match regular expression " + PfKey.NAME_REGEXP);
 
         Field parentVersionField = testReferenceKey.getClass().getDeclaredField("parentKeyVersion");
         parentVersionField.setAccessible(true);
         parentVersionField.set(testReferenceKey, "Parent Version");
-        PfValidationResult validationResult2 = new PfValidationResult();
-        testReferenceKey.validate(validationResult2);
+        ValidationResult validationResult2 = testReferenceKey.validate("");
         parentVersionField.set(testReferenceKey, VERSION001);
         parentVersionField.setAccessible(false);
-        assertEquals(
-            "parentKeyVersion invalid-parameter parentKeyVersion with value Parent Version "
-                + "does not match regular expression " + PfKey.VERSION_REGEXP,
-            validationResult2.getMessageList().get(0).getMessage());
+        assertThat(validationResult2.getResult()).contains("\"parentKeyVersion\"")
+            .contains("does not match regular expression " + PfKey.VERSION_REGEXP);
 
         Field parentLocalNameField = testReferenceKey.getClass().getDeclaredField("parentLocalName");
         parentLocalNameField.setAccessible(true);
         parentLocalNameField.set(testReferenceKey, "Parent Local Name");
-        PfValidationResult validationResult3 = new PfValidationResult();
-        testReferenceKey.validate(validationResult3);
+        ValidationResult validationResult3 = testReferenceKey.validate("");
         parentLocalNameField.set(testReferenceKey, PARENT_LOCAL_NAME);
         parentLocalNameField.setAccessible(false);
-        assertEquals(
-            "parentLocalName invalid-parameter parentLocalName with value "
-                + "Parent Local Name does not match regular expression [A-Za-z0-9\\-_\\.]+|^$",
-            validationResult3.getMessageList().get(0).getMessage());
+        assertThat(validationResult3.getResult()).contains("\"parentLocalName\"")
+            .contains("does not match regular expression [A-Za-z0-9\\-_\\.]+|^$");
 
         Field localNameField = testReferenceKey.getClass().getDeclaredField("localName");
         localNameField.setAccessible(true);
         localNameField.set(testReferenceKey, "Local Name");
-        PfValidationResult validationResult4 = new PfValidationResult();
-        testReferenceKey.validate(validationResult4);
+        ValidationResult validationResult4 = testReferenceKey.validate("");
         localNameField.set(testReferenceKey, LOCAL_NAME);
         localNameField.setAccessible(false);
-        assertEquals(
-            "localName invalid-parameter localName with value Local Name "
-                + "does not match regular expression [A-Za-z0-9\\-_\\.]+|^$",
-            validationResult4.getMessageList().get(0).getMessage());
+        assertThat(validationResult4.getResult()).contains("\"localName\"")
+        .contains("does not match regular expression [A-Za-z0-9\\-_\\.]+|^$");
     }
 }
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 5d13670..8534d82 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
@@ -1,9 +1,8 @@
-/*
+/*-
  * ============LICENSE_START=======================================================
- * ONAP Policy Models
+ * ONAP
  * ================================================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,424 +20,426 @@
 
 package org.onap.policy.models.base;
 
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import org.junit.Before;
+import java.util.function.BiFunction;
+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;
+import org.onap.policy.common.utils.coder.StandardCoder;
 
 public class ValidatedTest {
-    private static final String COLLECTION_TEXT = "collection";
-    private static final String ERROR_MESSAGE = "error message";
-    private static final String COLLECTION_FIELD = "coll";
-    private static final String VALID_VALUE = "abc123";
-    private static final String PROPS_FIELD = "props";
-    private static final String MY_NAME = "my.name";
-    private static final String VALID_FIELD = "validField";
-    private static final String INVALID_FIELD = "invalidField";
-    private static final String NULL_FIELD = "nullField";
-    private static final String WORD_PAT = "\\w*";
-    private static final String MY_TO_STRING = "[some text]";
-    private static final String VERSION = "1.2.3";
+    private static final @NonNull String MY_FIELD = "myField";
+    private static final @NonNull String Q_KEY = "\"" + Validated.KEY_TOKEN + "\"";
+    private static final @NonNull String Q_VALUE = "\"" + Validated.VALUE_TOKEN + "\"";
+    private static final String NOT_SAME = "not same";
+    private static final String TEXT = "some text";
+    private static final String OTHER = "other text";
+    private static final String NAME = "myKey";
+    private static final String VERSION = "1.0.0";
+    private static final String BLANKS = "\t \n";
 
-    private Validated validated;
+    @Test
+    public void testAddResult() {
+        BeanValidationResult result = new BeanValidationResult("", this);
+        Validated.addResult(result, MY_FIELD, TEXT, "some message");
+        assertThat(result.getResult()).contains(MY_FIELD).contains(TEXT).contains("some message");
 
-    @Before
-    public void setUp() {
-        validated = new Validated();
+        assertThatThrownBy(() -> Validated.addResult(null, MY_FIELD, TEXT, OTHER))
+                        .isInstanceOf(NullPointerException.class);
+
+        assertThatThrownBy(() -> Validated.addResult(result, null, TEXT, OTHER))
+                        .isInstanceOf(NullPointerException.class);
+
+        assertThatCode(() -> Validated.addResult(result, MY_FIELD, null, OTHER)).doesNotThrowAnyException();
+
+        assertThatThrownBy(() -> Validated.addResult(result, MY_FIELD, TEXT, null))
+                        .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void testValidate() {
-        assertThatThrownBy(() -> validated.validate(null)).isInstanceOf(NullPointerException.class);
+    public void testMakeNullResult() {
+        ValidationResult rnull = Validated.makeNullResult(MY_FIELD, TEXT);
+        assertEquals(MY_FIELD, rnull.getName());
+        assertThat(rnull.getResult()).contains(MY_FIELD).contains(TEXT).contains(Validated.IS_NULL);
+        assertFalse(rnull.isValid());
 
-        PfValidationResult result = new PfValidationResult();
-        assertSame(result, validated.validate(result));
-        assertTrue(result.isValid());
-        assertEquals(0, result.getMessageList().size());
+        assertThatThrownBy(() -> Validated.makeNullResult(null, TEXT)).isInstanceOf(NullPointerException.class);
+
+        assertThatCode(() -> Validated.makeNullResult(MY_FIELD, null)).doesNotThrowAnyException();
+    }
+
+    @Test
+    public void testValidateOptional() {
+        BeanValidationResult result = new BeanValidationResult("", this);
+        Validated.validateOptional(result, MY_FIELD, null);
+        assertTrue(result.isClean());
+
+        Validated.validateOptional(result, MY_FIELD, new MyString(TEXT));
+        assertTrue(result.isClean());
+
+        Validated.validateOptional(result, MY_FIELD, new MyString(OTHER));
+        assertThat(result.getResult()).contains(MY_FIELD).contains(OTHER).contains(NOT_SAME);
+
+        assertThatThrownBy(() -> Validated.validateOptional(null, MY_FIELD, new MyString(TEXT)))
+                        .isInstanceOf(NullPointerException.class);
+
+        assertThatThrownBy(() -> Validated.validateOptional(result, null, new MyString(TEXT)))
+                        .isInstanceOf(NullPointerException.class);
+
+        assertThatCode(() -> Validated.validateOptional(result, MY_FIELD, null)).doesNotThrowAnyException();
     }
 
     @Test
     public void testValidateNotNull() {
-        PfValidationResult result = new PfValidationResult();
+        assertThat(Validated.validateNotNull(MY_FIELD, TEXT)).isNull();
 
-        final PfValidationResult result2 = result;
-        assertThatThrownBy(() -> validated.validateNotNull(null, VALID_FIELD, VALID_VALUE, result2))
-                        .isInstanceOf(NullPointerException.class);
-        assertThatThrownBy(() -> validated.validateNotNull(this, null, VALID_VALUE, result2))
-                        .isInstanceOf(NullPointerException.class);
-        assertThatThrownBy(() -> validated.validateNotNull(this, VALID_FIELD, VALID_VALUE, null))
-                        .isInstanceOf(NullPointerException.class);
+        assertThat(Validated.validateNotNull(MY_FIELD, null).getResult()).contains(MY_FIELD)
+                        .contains(Validated.IS_NULL);
 
-        // null text
-        result = validated.validateNotNull(this, NULL_FIELD, null, result);
+        // should invoke the value's validate() method, which should return success
+        assertThat(Validated.validateNotNull(MY_FIELD, new MyString(TEXT))).isNull();
 
-        // invalid text
-        result = validated.validateNotNull(this, INVALID_FIELD, "!!!", result);
+        // should invoke the value's validate() method, which should return failure
+        assertThat(Validated.validateNotNull(MY_FIELD, new MyString(OTHER)).getResult()).contains(MY_FIELD)
+                        .contains(NOT_SAME);
 
-        // valid text
-        result = validated.validateNotNull(this, VALID_FIELD, VALID_VALUE, result);
+        assertThatThrownBy(() -> Validated.validateNotNull(null, TEXT)).isInstanceOf(NullPointerException.class);
 
-        // different value
-        result = validated.validateNotNull(this, VALID_FIELD, Integer.valueOf(10), result);
-
-        assertFalse(result.isValid());
-        assertEquals(1, result.getMessageList().size());
-
-        // check result for null text
-        PfValidationMessage msg = result.getMessageList().get(0);
-        assertEquals(ValidatedTest.class.getName(), msg.getObservedClass());
-        assertEquals(MY_TO_STRING, msg.getObservedKey().toString());
-        assertTrue(msg.getMessage().contains("nullField invalid-null"));
+        assertThatCode(() -> Validated.validateNotNull(MY_FIELD, null)).doesNotThrowAnyException();
     }
 
     @Test
-    public void testValidateNotNullConceptKey() {
-        PfValidationResult result = new PfValidationResult();
+    public void testValidateNotBlank() {
+        assertThat(Validated.validateNotBlank(MY_FIELD, TEXT, false)).isNull();
+        assertThat(Validated.validateNotBlank(MY_FIELD, TEXT, true)).isNull();
 
-        // null key
-        PfConceptKey key = new PfConceptKey();
-        key.setVersion(VERSION);
-        result = validated.validateNotNull(key, result);
+        assertThat(Validated.validateNotBlank(MY_FIELD, null, false)).isNull();
+        assertThat(Validated.validateNotBlank(MY_FIELD, null, true).getResult()).contains(MY_FIELD)
+                        .contains(Validated.IS_BLANK);
 
-        // null value
-        key = new PfConceptKey();
-        key.setName(MY_NAME);
-        result = validated.validateNotNull(key, result);
+        assertThat(Validated.validateNotBlank(MY_FIELD, "", false).getResult()).contains(MY_FIELD)
+                        .contains(Validated.IS_BLANK);
+        assertThat(Validated.validateNotBlank(MY_FIELD, "", true).getResult()).contains(MY_FIELD)
+                        .contains(Validated.IS_BLANK);
 
-        // both null
-        key = new PfConceptKey();
-        result = validated.validateNotNull(key, result);
+        assertThatThrownBy(() -> Validated.validateNotBlank(null, TEXT, false))
+                        .isInstanceOf(NullPointerException.class);
 
-        assertFalse(result.isValid());
-        assertEquals(4, result.getMessageList().size());
+        assertThatCode(() -> Validated.validateNotBlank(MY_FIELD, null, false)).doesNotThrowAnyException();
+    }
 
-        // valid key & value
-        key = new PfConceptKey();
-        key.setName(MY_NAME);
-        key.setVersion(VERSION);
-        result = validated.validateNotNull(key, result);
+    @Test
+    public void testValidateRegex() {
+        assertThat(Validated.validateRegex(MY_FIELD, "hello", ".*ll.*")).isNull();
 
-        // no change
-        assertFalse(result.isValid());
-        assertEquals(4, result.getMessageList().size());
+        assertThat(Validated.validateRegex(MY_FIELD, "hello", "[x-z]").getResult()).contains(MY_FIELD).contains("hello")
+                        .contains("does not match regular expression [x-z]");
 
-        Iterator<PfValidationMessage> it = result.getMessageList().iterator();
+        assertThatThrownBy(() -> Validated.validateRegex(null, "hello", "ll")).isInstanceOf(NullPointerException.class);
 
-        // check null key
-        PfValidationMessage msg = it.next();
-        assertEquals(PfConceptKey.class.getName(), msg.getObservedClass());
-        assertTrue(msg.getMessage().contains("name invalid-null"));
+        assertThatCode(() -> Validated.validateRegex(MY_FIELD, null, "ll")).doesNotThrowAnyException();
 
-        // check null value
-        msg = it.next();
-        assertEquals(PfConceptKey.class.getName(), msg.getObservedClass());
-        assertTrue(msg.getMessage().contains("version invalid-null"));
-
-        // check both null
-        msg = it.next();
-        assertEquals(PfConceptKey.class.getName(), msg.getObservedClass());
-        assertTrue(msg.getMessage().contains("name invalid-null"));
-        assertTrue(it.next().getMessage().contains("version invalid-null"));
-
-        PfValidationResult pfValidationResult = new PfValidationResult();
-        final PfConceptKey key2 = key;
-        assertThatThrownBy(() -> validated.validateNotNull(key2, null)).isInstanceOf(NullPointerException.class);
-        assertThatThrownBy(() -> validated.validateNotNull(null, pfValidationResult))
+        assertThatThrownBy(() -> Validated.validateRegex(MY_FIELD, "hello", null))
                         .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void testValidateText() {
-        PfValidationResult result = new PfValidationResult();
+    public void testValidateKeyNotNull() throws CoderException {
+        assertThat(Validated.validateKeyNotNull(MY_FIELD, new PfConceptKey(NAME, VERSION)).getResult()).isNull();
+        assertThat(Validated.validateKeyNotNull(MY_FIELD, new PfConceptKey(NAME, PfConceptKey.NULL_KEY_VERSION))
+                        .getResult()).isNull();
+        assertThat(Validated.validateKeyNotNull(MY_FIELD, new PfConceptKey(PfConceptKey.NULL_KEY_NAME, VERSION))
+                        .getResult()).isNull();
 
-        final PfValidationResult result2 = result;
-        assertThatThrownBy(() -> validated.validateText(null, VALID_FIELD, VALID_VALUE, WORD_PAT, result2))
-                        .isInstanceOf(NullPointerException.class);
-        assertThatThrownBy(() -> validated.validateText(this, null, VALID_VALUE, WORD_PAT, result2))
-                        .isInstanceOf(NullPointerException.class);
-        assertThatThrownBy(() -> validated.validateText(this, VALID_FIELD, VALID_VALUE, null, result2))
-                        .isInstanceOf(NullPointerException.class);
-        assertThatThrownBy(() -> validated.validateText(this, VALID_FIELD, VALID_VALUE, WORD_PAT, null))
+        // key is null
+        assertThat(Validated.validateKeyNotNull(MY_FIELD, new PfConceptKey()).getResult()).contains(MY_FIELD)
+                        .doesNotContain("\"name\"").doesNotContain("\"version\"").contains(Validated.IS_A_NULL_KEY);
+
+        /*
+         * Key is not null, but key.validate() should fail due to an invalid version.
+         * Note: have to create the key by decoding from json, as the class will prevent
+         * an invalid version from being assigned.
+         */
+        PfConceptKey key = new StandardCoder().decode("{'name':'myKey','version':'bogus'}".replace('\'', '"'),
+                        PfConceptKey.class);
+        assertThat(Validated.validateKeyNotNull(MY_FIELD, key).getResult()).contains(MY_FIELD).contains("version")
+                        .contains("does not match regular expression");
+
+        // null parameter tests
+        assertThatThrownBy(() -> Validated.validateKeyNotNull(null, new PfConceptKey()))
                         .isInstanceOf(NullPointerException.class);
 
-        // null text
-        result = validated.validateText(this, NULL_FIELD, null, WORD_PAT, result);
-
-        // invalid text
-        result = validated.validateText(this, INVALID_FIELD, "!!!", WORD_PAT, result);
-
-        // valid text
-        result = validated.validateText(this, VALID_FIELD, VALID_VALUE, WORD_PAT, result);
-
-        assertFalse(result.isValid());
-        assertEquals(1, result.getMessageList().size());
-
-        // check result for invalid text
-        PfValidationMessage msg = result.getMessageList().get(0);
-        assertEquals(ValidatedTest.class.getName(), msg.getObservedClass());
-        assertEquals(MY_TO_STRING, msg.getObservedKey().toString());
-        assertTrue(msg.getMessage().contains("invalidField invalid-parameter invalidField"));
+        assertThatCode(() -> Validated.validateKeyNotNull(MY_FIELD, null)).doesNotThrowAnyException();
     }
 
     @Test
-    public void testValidatePropertiesNotNull() {
-        PfValidationResult result = new PfValidationResult();
-        result = validated.validatePropertiesNotNull(this, "properties", null, result);
-        assertTrue(result.isValid());
-        assertEquals(0, result.getMessageList().size());
+    public void testValidateKeyVersionNotNull() {
+        assertThat(Validated.validateKeyVersionNotNull(MY_FIELD, null)).isNull();
 
-        Map<String, Integer> map = new LinkedHashMap<>();
+        assertThat(Validated.validateKeyVersionNotNull(MY_FIELD, new PfConceptKey(NAME, VERSION))).isNull();
 
-        // null key
-        map.put(null, 10);
+        assertThat(Validated.validateKeyVersionNotNull(MY_FIELD, new PfConceptKey(NAME, PfConceptKey.NULL_KEY_VERSION))
+                        .getResult()).contains(MY_FIELD).contains("version").contains(Validated.IS_NULL);
 
-        // null value
-        map.put("abc", null);
-
-        // valid key & value
-        map.put("def", 11);
-
-
-        result = validated.validatePropertiesNotNull(this, PROPS_FIELD, map, result);
-
-        assertFalse(result.isValid());
-        assertEquals(2, result.getMessageList().size());
-
-        Iterator<PfValidationMessage> it = result.getMessageList().iterator();
-
-        // check null key
-        PfValidationMessage msg = it.next();
-        assertEquals(ValidatedTest.class.getName(), msg.getObservedClass());
-        assertEquals(MY_TO_STRING, msg.getObservedKey().toString());
-        assertTrue(msg.getMessage().contains("props.null invalid-null"));
-
-        // check null value
-        msg = it.next();
-        assertEquals(ValidatedTest.class.getName(), msg.getObservedClass());
-        assertEquals(MY_TO_STRING, msg.getObservedKey().toString());
-        assertTrue(msg.getMessage().contains("props.abc invalid-null"));
-
-        final PfValidationResult result2 = result;
-        assertThatThrownBy(() -> validated.validatePropertiesNotNull(null, PROPS_FIELD, map, result2))
+        assertThatThrownBy(() -> Validated.validateKeyVersionNotNull(null, new PfConceptKey()))
                         .isInstanceOf(NullPointerException.class);
-        assertThatThrownBy(() -> validated.validatePropertiesNotNull(this, null, map, result2))
+
+        assertThatCode(() -> Validated.validateKeyVersionNotNull(MY_FIELD, null)).doesNotThrowAnyException();
+    }
+
+    @Test
+    public void testValidateMinIntIntegerBoolean_testValidateMinStringIntegerIntIntegerBoolean() {
+        /*
+         * No "special" value, don't check the reference.
+         */
+        BiFunction<String, Integer, ValidationResult> func = Validated.validateMin(10, null, false);
+        assertThat(func.apply(MY_FIELD, null)).isNull();
+
+        // exact match
+        assertThat(func.apply(MY_FIELD, 10)).isNull();
+
+        assertThat(func.apply(MY_FIELD, 20)).isNull();
+
+        assertThat(func.apply(MY_FIELD, 9).getResult()).contains(MY_FIELD).contains("9")
+                        .contains("is below the minimum value: 10");
+
+        /*
+         * "special" value, don't check the reference.
+         */
+        func = Validated.validateMin(10, 7, false);
+        assertThat(func.apply(MY_FIELD, null)).isNull();
+
+        // exact match
+        assertThat(func.apply(MY_FIELD, 10)).isNull();
+
+        assertThat(func.apply(MY_FIELD, 20)).isNull();
+
+        // special value - should be ok
+        assertThat(func.apply(MY_FIELD, 7)).isNull();
+
+        assertThat(func.apply(MY_FIELD, 9).getResult()).contains(MY_FIELD).contains("9")
+                        .contains("is below the minimum value: 10");
+
+        /*
+         * Check the reference (i.e., generate an error if the value is null).
+         */
+        func = Validated.validateMin(10, null, true);
+        assertThat(func.apply(MY_FIELD, null).getResult()).contains(MY_FIELD).contains(Validated.IS_NULL);
+
+        // exact match
+        assertThat(func.apply(MY_FIELD, 10)).isNull();
+
+        assertThat(func.apply(MY_FIELD, 20)).isNull();
+
+        assertThat(func.apply(MY_FIELD, 9).getResult()).contains(MY_FIELD).contains("9")
+                        .contains("is below the minimum value: 10");
+
+
+        BiFunction<String, Integer, ValidationResult> func2 = func;
+        assertThatThrownBy(() -> func2.apply(null, 30)).isInstanceOf(NullPointerException.class);
+
+        assertThatCode(() -> func2.apply(MY_FIELD, null)).doesNotThrowAnyException();
+    }
+
+    @Test
+    public void testValidateList() {
+        BeanValidationResult result = new BeanValidationResult("", this);
+        Validated.validateList(result, MY_FIELD, null, Validated::validateNotNull);
+        assertThat(result.getResult()).isNull();
+
+        result = new BeanValidationResult("", this);
+        Validated.validateList(result, MY_FIELD, List.of(TEXT, OTHER), Validated::validateNotNull);
+        assertThat(result.getResult()).isNull();
+
+        List<String> list = new ArrayList<>();
+        list.add(TEXT);
+        list.add(null);
+        list.add(OTHER);
+        list.add(null);
+        result = new BeanValidationResult("", this);
+        Validated.validateList(result, MY_FIELD, list, Validated::validateNotNull);
+        assertThat(result.getResult()).doesNotContain("0").contains("1").doesNotContain("2").contains("3")
+                        .contains(Validated.IS_NULL);
+
+        BeanValidationResult result2 = result;
+        assertThatThrownBy(() -> Validated.validateList(null, MY_FIELD, List.of(), Validated::validateNotNull))
                         .isInstanceOf(NullPointerException.class);
-        assertThatThrownBy(() -> validated.validatePropertiesNotNull(this, PROPS_FIELD, map, null))
+
+        assertThatThrownBy(() -> Validated.validateList(result2, null, List.of(), Validated::validateNotNull))
+                        .isInstanceOf(NullPointerException.class);
+
+        assertThatCode(() -> Validated.validateList(result2, MY_FIELD, null, Validated::validateNotNull))
+                        .doesNotThrowAnyException();
+
+        assertThatThrownBy(() -> Validated.validateList(result2, MY_FIELD, List.of(), null))
                         .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void testValidateCollectionNotNull() {
-        PfValidationResult result = new PfValidationResult();
-        result = validated.validateCollectionNotNull(this, COLLECTION_TEXT, null, result);
-        assertTrue(result.isValid());
-        assertEquals(0, result.getMessageList().size());
+    public void testValidateMap() {
+        BeanValidationResult result = new BeanValidationResult("", this);
+        Validated.validateMap(result, MY_FIELD, null, Validated::validateEntryNotBlankNotBlank);
+        assertThat(result.getResult()).isNull();
 
-        final List<String> lst = Arrays.asList("abc", null, "def", null);
+        result = new BeanValidationResult("", this);
+        Validated.validateMap(result, MY_FIELD, Map.of("abc", TEXT, "def", OTHER),
+                        Validated::validateEntryNotBlankNotBlank);
+        assertThat(result.getResult()).isNull();
 
-        result = validated.validateCollectionNotNull(this, COLLECTION_FIELD, lst, result);
+        // invalid values
+        Map<String, String> map = new HashMap<>();
+        map.put("ghi", TEXT);
+        map.put("jkl", "");
+        map.put("mno", OTHER);
+        map.put("pqr", "");
+        result = new BeanValidationResult("", this);
+        Validated.validateMap(result, MY_FIELD, map, Validated::validateEntryNotBlankNotBlank);
+        assertThat(result.getResult()).doesNotContain("abc").contains("jkl").doesNotContain("mno").contains("pqr")
+                        .contains(Q_VALUE).doesNotContain(Q_KEY).contains(Validated.IS_BLANK);
 
-        assertFalse(result.isValid());
-        assertEquals(2, result.getMessageList().size());
+        // invalid keys
+        map = new HashMap<>();
+        map.put("stu", TEXT);
+        map.put("", TEXT);
+        map.put("vwx", OTHER);
+        map.put(null, OTHER);
+        result = new BeanValidationResult("", this);
+        Validated.validateMap(result, MY_FIELD, map, Validated::validateEntryNotBlankNotBlank);
+        assertThat(result.getResult()).doesNotContain("stu").contains("\"\"").doesNotContain("vwx").contains("null")
+                        .contains(Q_KEY).doesNotContain(Q_VALUE).contains(Validated.IS_BLANK);
 
-        Iterator<PfValidationMessage> it = result.getMessageList().iterator();
-
-        // check first item
-        PfValidationMessage msg = it.next();
-        assertEquals(ValidatedTest.class.getName(), msg.getObservedClass());
-        assertEquals(MY_TO_STRING, msg.getObservedKey().toString());
-        assertTrue(msg.getMessage().contains("coll.1 invalid-null"));
-
-        // check null value
-        msg = it.next();
-        assertEquals(ValidatedTest.class.getName(), msg.getObservedClass());
-        assertEquals(MY_TO_STRING, msg.getObservedKey().toString());
-        assertTrue(msg.getMessage().contains("coll.3 invalid-null"));
-
-        final PfValidationResult result2 = result;
-        assertThatThrownBy(() -> validated.validateCollectionNotNull(null, COLLECTION_FIELD, lst, result2))
+        BeanValidationResult result2 = result;
+        Map<String, String> map2 = map;
+        assertThatThrownBy(() -> Validated.validateMap(null, MY_FIELD, map2, Validated::validateEntryNotBlankNotBlank))
                         .isInstanceOf(NullPointerException.class);
-        assertThatThrownBy(() -> validated.validateCollectionNotNull(this, null, lst, result2))
+
+        assertThatThrownBy(() -> Validated.validateMap(result2, null, map2, Validated::validateEntryNotBlankNotBlank))
                         .isInstanceOf(NullPointerException.class);
-        assertThatThrownBy(() -> validated.validateCollectionNotNull(this, COLLECTION_FIELD, lst, null))
+
+        assertThatCode(() -> Validated.validateMap(result2, MY_FIELD, null, Validated::validateEntryNotBlankNotBlank))
+                        .doesNotThrowAnyException();
+
+        assertThatThrownBy(() -> Validated.validateMap(result2, MY_FIELD, map2, null))
                         .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void testValidateCollection() {
-        PfValidationResult result = new PfValidationResult();
-        result = validated.validateCollection(this, COLLECTION_TEXT, null, result);
-        assertTrue(result.isValid());
-        assertEquals(0, result.getMessageList().size());
+    public void testValidateEntryNotBlankNotBlank() {
+        assertThat(Validated.validateEntryNotBlankNotBlank(makeEntry(TEXT, OTHER))).isNull();
 
-        List<MyValid> lst = Arrays.asList(new MyValid(0, false), new MyValid(1, true), null, new MyValid(2, false),
-                        new MyValid(3, true));
-        result = validated.validateCollection(this, COLLECTION_FIELD, lst, result);
+        // try invalid values for the key
+        assertThat(Validated.validateEntryNotBlankNotBlank(makeEntry(null, OTHER)).getResult()).contains(Q_KEY)
+                        .contains(Validated.IS_BLANK).doesNotContain(Q_VALUE);
 
-        assertFalse(result.isValid());
-        assertEquals(2, result.getMessageList().size());
+        assertThat(Validated.validateEntryNotBlankNotBlank(makeEntry(BLANKS, OTHER)).getResult()).contains(Q_KEY)
+                        .contains(Validated.IS_BLANK).doesNotContain(Q_VALUE);
 
-        Iterator<PfValidationMessage> it = result.getMessageList().iterator();
+        // try invalid values for the value
+        assertThat(Validated.validateEntryNotBlankNotBlank(makeEntry(TEXT, null)).getResult()).contains(Q_VALUE)
+                        .contains(Validated.IS_BLANK).doesNotContain(Q_KEY);
 
-        // check first item
-        PfValidationMessage msg = it.next();
-        assertEquals(MyValid.class.getName(), msg.getObservedClass());
-        assertEquals(MY_TO_STRING, msg.getObservedKey().toString());
-        assertTrue(msg.getMessage().contains("index.0 invalid-wrong value"));
+        assertThat(Validated.validateEntryNotBlankNotBlank(makeEntry(TEXT, BLANKS)).getResult()).contains(Q_VALUE)
+                        .contains(Validated.IS_BLANK).doesNotContain(Q_KEY);
 
-        // check null value
-        msg = it.next();
-        assertEquals(MyValid.class.getName(), msg.getObservedClass());
-        assertEquals(MY_TO_STRING, msg.getObservedKey().toString());
-        assertTrue(msg.getMessage().contains("index.2 invalid-wrong value"));
-
-        final PfValidationResult result2 = result;
-        assertThatThrownBy(() -> validated.validateCollection(null, COLLECTION_FIELD, lst, result2))
-                        .isInstanceOf(NullPointerException.class);
-        assertThatThrownBy(() -> validated.validateCollection(this, null, lst, result2))
-                        .isInstanceOf(NullPointerException.class);
-        assertThatThrownBy(() -> validated.validateCollection(this, COLLECTION_FIELD, lst, null))
-                        .isInstanceOf(NullPointerException.class);
+        // both invalid
+        assertThat(Validated.validateEntryNotBlankNotBlank(makeEntry(BLANKS, BLANKS)).getResult()).contains(Q_KEY)
+                        .contains(Q_VALUE);
     }
 
     @Test
-    public void testValidateConceptCollection() {
-        PfValidationResult result = new PfValidationResult();
-        result = validated.validateConceptCollection(this, COLLECTION_TEXT, null, result);
-        assertTrue(result.isValid());
-        assertEquals(0, result.getMessageList().size());
+    public void testValidateEntryNotBlankNotNull() {
+        assertThat(Validated.validateEntryNotBlankNotNull(makeEntry(TEXT, OTHER))).isNull();
 
-        List<MyConcept> lst = Arrays.asList(new MyConcept(0, false), new MyConcept(1, true), null,
-                        new MyConcept(2, false), new MyConcept(3, true));
-        result = validated.validateConceptCollection(this, COLLECTION_FIELD, lst, result);
+        // try invalid values for the key
+        assertThat(Validated.validateEntryNotBlankNotNull(makeEntry(null, OTHER)).getResult()).contains(Q_KEY)
+                        .contains(Validated.IS_BLANK).doesNotContain(Q_VALUE);
 
-        assertFalse(result.isValid());
-        assertEquals(2, result.getMessageList().size());
+        assertThat(Validated.validateEntryNotBlankNotNull(makeEntry(BLANKS, OTHER)).getResult()).contains(Q_KEY)
+                        .contains(Validated.IS_BLANK).doesNotContain(Q_VALUE);
 
-        Iterator<PfValidationMessage> it = result.getMessageList().iterator();
+        // try invalid values for the value
+        assertThat(Validated.validateEntryNotBlankNotNull(makeEntry(TEXT, null)).getResult()).contains(Q_VALUE)
+                        .contains(Validated.IS_NULL).doesNotContain(Q_KEY);
 
-        // check first item
-        PfValidationMessage msg = it.next();
-        assertEquals(MyConcept.class.getName(), msg.getObservedClass());
-        assertEquals(MY_TO_STRING, msg.getObservedKey().toString());
-        assertTrue(msg.getMessage().contains("index.0 invalid-wrong value"));
+        // blanks should have no impact for the value
+        assertThat(Validated.validateEntryNotBlankNotNull(makeEntry(TEXT, BLANKS))).isNull();
 
-        // check null value
-        msg = it.next();
-        assertEquals(MyConcept.class.getName(), msg.getObservedClass());
-        assertEquals(MY_TO_STRING, msg.getObservedKey().toString());
-        assertTrue(msg.getMessage().contains("index.2 invalid-wrong value"));
-
-        final PfValidationResult result2 = result;
-        assertThatThrownBy(() -> validated.validateConceptCollection(null, COLLECTION_FIELD, lst, result2))
-                        .isInstanceOf(NullPointerException.class);
-        assertThatThrownBy(() -> validated.validateConceptCollection(this, null, lst, result2))
-                        .isInstanceOf(NullPointerException.class);
-        assertThatThrownBy(() -> validated.validateConceptCollection(this, COLLECTION_FIELD, lst, null))
-                        .isInstanceOf(NullPointerException.class);
+        // both invalid
+        assertThat(Validated.validateEntryNotBlankNotNull(makeEntry(BLANKS, null)).getResult()).contains(Q_KEY)
+                        .contains(Q_VALUE);
     }
 
     @Test
-    public void testAddError() {
-        final PfValidationResult result = new PfValidationResult();
-        final PfValidationResult result2 = result;
+    public void testValidateEntryValueNotNull() {
+        assertThat(Validated.validateEntryValueNotNull(makeEntry(TEXT, OTHER))).isNull();
 
-        assertThatThrownBy(() -> validated.addError(null, VALID_FIELD, result2, ERROR_MESSAGE))
-                        .isInstanceOf(NullPointerException.class);
-        assertThatThrownBy(() -> validated.addError(this, null, result2, ERROR_MESSAGE))
-                        .isInstanceOf(NullPointerException.class);
-        assertThatThrownBy(() -> validated.addError(this, VALID_FIELD, null, ERROR_MESSAGE))
-                        .isInstanceOf(NullPointerException.class);
+        // blanks should have no impact
+        assertThat(Validated.validateEntryValueNotNull(makeEntry(BLANKS, OTHER))).isNull();
+        assertThat(Validated.validateEntryNotBlankNotNull(makeEntry(TEXT, BLANKS))).isNull();
 
-        validated.addError(this, VALID_FIELD, result, "error-A");
-        validated.addError(this, VALID_FIELD, result, null);
-        validated.addError(this, VALID_FIELD, result, "error-B");
+        assertThat(Validated.validateEntryValueNotNull(makeEntry(null, OTHER)).getResult()).contains(Q_KEY)
+                        .contains(Validated.IS_NULL).doesNotContain(Q_VALUE);
 
-        assertFalse(result.isValid());
-        assertEquals(2, result.getMessageList().size());
+        assertThat(Validated.validateEntryValueNotNull(makeEntry(TEXT, null)).getResult()).contains(Q_VALUE)
+                        .contains(Validated.IS_NULL).doesNotContain(Q_KEY);
 
-        Iterator<PfValidationMessage> it = result.getMessageList().iterator();
+        // should invoke the value's validate() method, which should return success
+        assertThat(Validated.validateEntryValueNotNull(makeEntry(TEXT, new MyString(TEXT)))).isNull();
 
-        PfValidationMessage msg = it.next();
-        assertEquals(ValidatedTest.class.getName(), msg.getObservedClass());
-        assertEquals(MY_TO_STRING, msg.getObservedKey().toString());
-        assertTrue(msg.getMessage().contains("validField invalid-error-A"));
+        // should invoke the value's validate() method, which should return failure
+        assertThat(Validated.validateEntryValueNotNull(makeEntry(TEXT, new MyString(OTHER))).getResult())
+                        .contains(Q_VALUE).contains(NOT_SAME).doesNotContain(Q_KEY);
 
-        msg = it.next();
-        assertEquals(ValidatedTest.class.getName(), msg.getObservedClass());
-        assertEquals(MY_TO_STRING, msg.getObservedKey().toString());
-        assertTrue(msg.getMessage().contains("validField invalid-error-B"));
+        // both invalid
+        assertThat(Validated.validateEntryValueNotNull(makeEntry(null, null)).getResult()).contains(Q_KEY)
+                        .contains(Q_VALUE);
     }
 
     @Test
-    public void testMakeKey() {
-        assertThatThrownBy(() -> validated.makeKey(null)).isInstanceOf(NullPointerException.class);
+    public void testGetKeyId() {
+        // not a key field - should just use the given value
+        BeanValidationResult result = new BeanValidationResult("", this);
+        Validated.addResult(result, MY_FIELD, TEXT, "some message");
+        assertThat(result.getResult()).contains(MY_FIELD).contains(TEXT).contains("some message");
 
-        PfKey key = validated.makeKey(this);
-        assertEquals(MY_TO_STRING, key.toString());
+        // repeat with a key field - should use the key's ID
+        result = new BeanValidationResult("", this);
+        Validated.addResult(result, MY_FIELD, new PfConceptKey(NAME, VERSION), "some message");
+        assertThat(result.getResult()).contains(MY_FIELD).contains("myKey:1.0.0").contains("some message");
     }
 
-    @Override
-    public String toString() {
-        return MY_TO_STRING;
+    private <V> Map.Entry<String, V> makeEntry(String key, V value) {
+        Map<String, V> map = new HashMap<>();
+        map.put(key, value);
+        return map.entrySet().iterator().next();
     }
 
-    private static class MyValid extends Validated {
-        private boolean valid;
-        private int index;
-
-        public MyValid(int index, boolean valid) {
-            this.index = index;
-            this.valid = valid;
-        }
+    @AllArgsConstructor
+    private static class MyString extends Validated {
+        private final String text;
 
         @Override
-        public PfValidationResult validate(PfValidationResult result) {
-            if (!valid) {
-                this.addError(this, "index." + index, result, "wrong value");
+        public ValidationResult validate(String fieldName) {
+            if (TEXT.equals(text)) {
+                return null;
             }
 
-            return result;
-        }
-
-        @Override
-        public String toString() {
-            return MY_TO_STRING;
-        }
-    }
-
-    private static class MyConcept extends PfConceptKey {
-        private static final long serialVersionUID = 1L;
-
-        private boolean valid;
-        private int index;
-
-        public MyConcept(int index, boolean valid) {
-            this.index = index;
-            this.valid = valid;
-        }
-
-        @Override
-        public PfValidationResult validate(PfValidationResult result) {
-            if (!valid) {
-                new Validated().addError(this, "index." + index, result, "wrong value");
-            }
-
-            return result;
-        }
-
-        @Override
-        public String toString() {
-            return MY_TO_STRING;
+            return new ObjectValidationResult(fieldName, text, ValidationStatus.INVALID, NOT_SAME);
         }
     }
 }
diff --git a/models-base/src/test/java/org/onap/policy/models/base/ValidationTest.java b/models-base/src/test/java/org/onap/policy/models/base/ValidationTest.java
deleted file mode 100644
index 6030d2a..0000000
--- a/models-base/src/test/java/org/onap/policy/models/base/ValidationTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2019-2020 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.models.base;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
-
-public class ValidationTest {
-
-    private static final String HELLO = "hello";
-    private static final String SOME_MESSAGE = "Some message";
-
-    @Test
-    public void testValidation1() {
-        PfValidationResult result = new PfValidationResult();
-        PfConceptKey pfKeyey = new PfConceptKey("PK", "0.0.1");
-        result = pfKeyey.validate(result);
-
-        assertNotNull(result);
-        assertTrue(result.isOk());
-        assertTrue(result.isValid());
-        assertEquals(PfValidationResult.ValidationResult.VALID, result.getValidationResult());
-        assertNotNull(result.getMessageList());
-
-        PfValidationMessage vmess0 = new PfValidationMessage(PfConceptKey.getNullKey(), PfConceptKey.class,
-                ValidationResult.VALID, SOME_MESSAGE);
-        result.addValidationMessage(vmess0);
-
-        assertTrue(result.isOk());
-        assertTrue(result.isValid());
-        assertEquals(PfValidationResult.ValidationResult.VALID, result.getValidationResult());
-        assertNotNull(result.getMessageList());
-        assertNotNull(HELLO, result.toString());
-
-        PfValidationMessage vmess1 = new PfValidationMessage(PfConceptKey.getNullKey(), PfConceptKey.class,
-                ValidationResult.OBSERVATION, SOME_MESSAGE);
-        result.addValidationMessage(vmess1);
-
-        assertTrue(result.isOk());
-        assertTrue(result.isValid());
-        assertEquals(PfValidationResult.ValidationResult.OBSERVATION, result.getValidationResult());
-        assertNotNull(result.getMessageList());
-        assertNotNull(HELLO, result.toString());
-    }
-
-
-    @Test
-    public void testValidation2() {
-        PfValidationResult result = new PfValidationResult();
-
-        PfValidationMessage vmess2 = new PfValidationMessage(PfConceptKey.getNullKey(), PfConceptKey.class,
-                ValidationResult.WARNING, SOME_MESSAGE);
-        result.addValidationMessage(vmess2);
-
-        assertFalse(result.isOk());
-        assertTrue(result.isValid());
-        assertEquals(PfValidationResult.ValidationResult.WARNING, result.getValidationResult());
-        assertNotNull(result.getMessageList());
-        assertNotNull(HELLO, result.toString());
-
-        PfValidationMessage vmess3 = new PfValidationMessage(PfConceptKey.getNullKey(), PfConceptKey.class,
-                ValidationResult.INVALID, SOME_MESSAGE);
-        result.addValidationMessage(vmess3);
-
-        assertFalse(result.isOk());
-        assertFalse(result.isValid());
-        assertEquals(PfValidationResult.ValidationResult.INVALID, result.getValidationResult());
-        assertNotNull(result.getMessageList());
-        assertNotNull(HELLO, result.toString());
-
-        assertEquals(PfValidationResult.ValidationResult.INVALID, result.getMessageList().get(1).getValidationResult());
-        assertEquals(SOME_MESSAGE, result.getMessageList().get(1).getMessage());
-        assertEquals(PfConceptKey.class.getName(), result.getMessageList().get(1).getObservedClass());
-        assertEquals(PfConceptKey.getNullKey(), result.getMessageList().get(1).getObservedKey());
-    }
-
-    @Test
-    public void testValidationAppend() {
-        PfValidationResult result = new PfValidationResult();
-
-        PfValidationResult result2 = new PfValidationResult();
-        PfValidationMessage vmess1 = new PfValidationMessage(PfConceptKey.getNullKey(), PfConceptKey.class,
-                ValidationResult.OBSERVATION, "Message 1");
-        result2.addValidationMessage(vmess1);
-
-        result.append(result2);
-        assertEquals(1, result.getMessageList().size());
-        assertEquals(ValidationResult.OBSERVATION, result.getValidationResult());
-
-        PfValidationResult result3 = new PfValidationResult();
-        PfValidationMessage vmess2 = new PfValidationMessage(PfConceptKey.getNullKey(), PfConceptKey.class,
-                ValidationResult.WARNING, "Message 2");
-        result3.addValidationMessage(vmess2);
-        result.append(result3);
-        assertEquals(2, result.getMessageList().size());
-        assertEquals(ValidationResult.WARNING, result.getValidationResult());
-
-        PfValidationResult result4 = new PfValidationResult();
-        PfValidationMessage vmess3 = new PfValidationMessage(PfConceptKey.getNullKey(), PfConceptKey.class,
-                ValidationResult.INVALID, "Message 3");
-        PfValidationMessage vmess4 = new PfValidationMessage(PfConceptKey.getNullKey(), PfConceptKey.class,
-                ValidationResult.VALID, "Message 4");
-        result4.addValidationMessage(vmess3);
-        result4.addValidationMessage(vmess4);
-        result.append(result4);
-        assertEquals(4, result.getMessageList().size());
-        assertEquals(ValidationResult.INVALID, result.getValidationResult());
-    }
-}
diff --git a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConcept.java b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConcept.java
index be398b9..67a4507 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConcept.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConcept.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -27,13 +27,12 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.lang3.ObjectUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
+import org.onap.policy.common.parameters.ValidationResult;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
 
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -102,20 +101,11 @@
     }
 
     @Override
-    public PfValidationResult validate(PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
+    public ValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        if (key.isNullKey()) {
-            result.addValidationMessage(
-                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
-        }
-
-        result = key.validate(result);
-
-        if (description != null && description.trim().length() == 0) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "property description may not be blank"));
-        }
+        result.addResult(validateKeyNotNull("key", key));
+        result.addResult(validateNotBlank("description", description, false));
 
         return result;
     }
diff --git a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java
index 81ebb6e..5a5891a 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -24,9 +24,9 @@
 import java.util.Arrays;
 import java.util.List;
 import lombok.NonNull;
+import org.onap.policy.common.parameters.ValidationResult;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfKey;
-import org.onap.policy.models.base.PfValidationResult;
 
 public class DummyPfKey extends PfKey {
     private static final long serialVersionUID = 1L;
@@ -75,7 +75,7 @@
     }
 
     @Override
-    public PfValidationResult validate(PfValidationResult result) {
+    public ValidationResult validate(@NonNull String fieldName) {
         return null;
     }
 
diff --git a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfModel.java b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfModel.java
index 764b91b..f828fba 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfModel.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfModel.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -25,12 +25,13 @@
 import java.util.List;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
+import lombok.NonNull;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfModel;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationResult;
 
 @Data
 @EqualsAndHashCode(callSuper = true)
@@ -108,11 +109,12 @@
     }
 
     @Override
-    public PfValidationResult validate(final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
+        int count = 0;
         for (PfKey pfKey : keyList) {
-            result = pfKey.validate(result);
+            result.addResult(pfKey.validate("keyList." + (count++)));
         }
 
         return result;
diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/DummyConceptEntity.java b/models-dao/src/test/java/org/onap/policy/models/dao/DummyConceptEntity.java
index 6656515..4ef3eb9 100644
--- a/models-dao/src/test/java/org/onap/policy/models/dao/DummyConceptEntity.java
+++ b/models-dao/src/test/java/org/onap/policy/models/dao/DummyConceptEntity.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -31,11 +31,11 @@
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.common.utils.validation.Assertions;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
-import org.onap.policy.models.base.PfValidationResult;
 
 @Entity
 @Table(name = "DummyConceptEntity")
@@ -100,8 +100,10 @@
     }
 
     @Override
-    public PfValidationResult validate(final PfValidationResult result) {
-        return key.validate(result);
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
+        result.addResult(key.validate("key"));
+        return result;
     }
 
     @Override
diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/DummyReferenceEntity.java b/models-dao/src/test/java/org/onap/policy/models/dao/DummyReferenceEntity.java
index ee755b4..abd9e53 100644
--- a/models-dao/src/test/java/org/onap/policy/models/dao/DummyReferenceEntity.java
+++ b/models-dao/src/test/java/org/onap/policy/models/dao/DummyReferenceEntity.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -30,11 +30,11 @@
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.common.utils.validation.Assertions;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationResult;
 
 @Entity
 @Table(name = "DummyReferenceEntity")
@@ -82,8 +82,10 @@
     }
 
     @Override
-    public PfValidationResult validate(final PfValidationResult result) {
-        return key.validate(result);
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
+        result.addResult(key.validate("key"));
+        return result;
     }
 
     @Override
diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/DummyTimestampEntity.java b/models-dao/src/test/java/org/onap/policy/models/dao/DummyTimestampEntity.java
index 18d87ae..37b18c1 100644
--- a/models-dao/src/test/java/org/onap/policy/models/dao/DummyTimestampEntity.java
+++ b/models-dao/src/test/java/org/onap/policy/models/dao/DummyTimestampEntity.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,10 +30,10 @@
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfTimestampKey;
-import org.onap.policy.models.base.PfValidationResult;
 
 @Entity
 @Table(name = "DummyTimestampEntity")
@@ -80,8 +81,10 @@
     }
 
     @Override
-    public PfValidationResult validate(final PfValidationResult result) {
-        return key.validate(result);
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
+        result.addResult(key.validate("key"));
+        return result;
     }
 
     @Override
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java
index 5820a35..d231fe7 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP Policy Model
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -35,14 +35,11 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.lang3.ObjectUtils;
-import org.apache.commons.lang3.StringUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
 import org.onap.policy.models.pdp.concepts.Pdp;
 import org.onap.policy.models.pdp.enums.PdpHealthStatus;
 import org.onap.policy.models.pdp.enums.PdpState;
@@ -163,40 +160,19 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        if (key.isNullKey()) {
-            result.addValidationMessage(
-                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
-        }
-
-        result = key.validate(result);
-
-        if (key.getParentConceptKey().isNullKey()) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "parent of key is a null key"));
-        }
+        result.addResult(validateKeyNotNull("key", key));
+        result.addResult(validateKeyNotNull("parent of key", key.getParentConceptKey()));
 
         if (PfKey.NULL_KEY_NAME.equals(key.getParentLocalName())) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "local name of parent of key is null"));
+            addResult(result, "local name of parent of key", key.getParentLocalName(), IS_NULL);
         }
 
-        if (pdpState == null) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "PDP state may not be null"));
-        }
-
-        if (healthy == null) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "PDP health status may not be null"));
-        }
-
-        if (message != null && StringUtils.isBlank(message)) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "message may not be blank"));
-        }
+        result.addResult(validateNotNull("pdpState", pdpState));
+        result.addResult(validateNotNull("healthy", healthy));
+        result.addResult(validateNotBlank("message", message, false));
 
         return result;
     }
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 67458cf..66d36d8 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
@@ -44,17 +44,14 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.lang3.ObjectUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.policy.common.utils.validation.ParameterValidationUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfReferenceKey;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.pdp.concepts.PdpGroup;
 import org.onap.policy.models.pdp.concepts.PdpSubGroup;
 import org.onap.policy.models.pdp.enums.PdpState;
@@ -218,61 +215,21 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        if (key.isNullKey()) {
-            result.addValidationMessage(
-                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
-        }
+        result.addResult(validateKeyNotNull("key", key));
+        result.addResult(validateNotBlank("description", description, false));
+        result.addResult(validateNotNull("pdpGroupState", pdpGroupState));
 
-        result = key.validate(result);
+        validateMap(result, "properties", properties, Validated::validateEntryNotBlankNotBlank);
 
-        if (description != null && StringUtils.isBlank(description)) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "description may not be blank"));
-        }
-
-        if (pdpGroupState == null) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "pdpGroupState may not be null"));
-        }
-
-        if (properties != null) {
-            validateProperties(result);
-        }
-
-        if (pdpSubGroups == null) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "a PDP group must have a list of PDP subgroups"));
-        } else {
-            for (JpaPdpSubGroup jpaPdpSubgroup : pdpSubGroups) {
-                result = jpaPdpSubgroup.validate(result);
-            }
-        }
+        result.addResult(validateNotNull("pdpSubGroups", pdpSubGroups));
+        validateList(result, "pdpSubGroups", pdpSubGroups, Validated::validateNotNull);
 
         return result;
     }
 
-    /**
-     * Validate the properties.
-     *
-     * @param result where to place any new validation results
-     */
-    private void validateProperties(PfValidationResult result) {
-
-        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"));
-            }
-        }
-    }
-
     @Override
     public int compareTo(final PfConcept otherConcept) {
         if (otherConcept == null) {
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatistics.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatistics.java
index d08a19a..49163ee 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatistics.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatistics.java
@@ -3,6 +3,7 @@
  * ONAP Policy Model
  * ================================================================================
  * Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -37,14 +38,12 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.lang3.builder.CompareToBuilder;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfTimestampKey;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
 import org.onap.policy.models.pdp.concepts.PdpEngineWorkerStatistics;
 import org.onap.policy.models.pdp.concepts.PdpStatistics;
 
@@ -203,15 +202,10 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        if (key.isNullKey()) {
-            result.addValidationMessage(
-                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
-        }
-
-        result = key.validate(result);
+        result.addResult(validateKeyNotNull("key", key));
 
         return result;
     }
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java
index 7d01886..c3d172a 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP Policy Model
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -43,7 +43,7 @@
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
-import org.onap.policy.common.utils.validation.ParameterValidationUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
@@ -52,9 +52,7 @@
 import org.onap.policy.models.base.PfReferenceKey;
 import org.onap.policy.models.base.PfSearchableKey;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.pdp.concepts.Pdp;
 import org.onap.policy.models.pdp.concepts.PdpSubGroup;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
@@ -279,80 +277,33 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        if (key.isNullKey()) {
-            result.addValidationMessage(
-                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
-        }
-
-        result = key.validate(result);
-
-        if (key.getParentConceptKey().isNullKey()) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "parent of key is a null key"));
-        }
+        result.addResult(validateKeyNotNull("key", key));
+        result.addResult(validateKeyNotNull("parent of key", key.getParentConceptKey()));
 
         if (currentInstanceCount < 0) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "the current instance count of a PDP sub group may not be negative"));
+            addResult(result, "currentInstanceCount", currentInstanceCount, "is negative");
         }
 
         if (desiredInstanceCount < 0) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "the desired instance count of a PDP sub group may not be negative"));
+            addResult(result, "desiredInstanceCount", desiredInstanceCount, "is negative");
         }
 
-        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"));
-                }
-            }
-        }
+        validateMap(result, "properties", properties, Validated::validateEntryNotBlankNotBlank);
 
-        return validateSubConcepts(result);
-    }
-
-    /**
-     * Validate collections of sub concepts.
-     *
-     * @param result the result in which to store the validation result
-     * @return the validation result including the results of this method
-     */
-    private PfValidationResult validateSubConcepts(PfValidationResult result) {
         if (supportedPolicyTypes == null || supportedPolicyTypes.isEmpty()) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "a PDP subgroup must support at least one policy type"));
+            addResult(result, "supportedPolicyTypes", supportedPolicyTypes, "is empty");
         } else {
-            for (PfSearchableKey supportedPolicyType : supportedPolicyTypes) {
-                result = supportedPolicyType.validate(result);
-            }
+            validateList(result, "supportedPolicyTypes", supportedPolicyTypes, Validated::validateNotNull);
         }
 
-        if (policies == null) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "a PDP subgroup must have a list of policies"));
-        } else {
-            for (PfConceptKey policyKey : policies) {
-                result = policyKey.validate(result);
-            }
-        }
+        result.validateNotNull("policies", policies);
+        validateList(result, "policies", policies, Validated::validateNotNull);
 
-        if (pdpInstances == null) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "a PDP subgroup must have a list of PDPs"));
-        } else {
-            for (JpaPdp jpaPdp : pdpInstances) {
-                result = jpaPdp.validate(result);
-            }
-        }
+        result.validateNotNull("pdpInstances", pdpInstances);
+        validateList(result, "pdpInstances", pdpInstances, Validated::validateNotNull);
 
         return result;
     }
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java
index 7ea7cd3..e496521 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -25,12 +25,12 @@
 import java.util.List;
 import javax.ws.rs.core.Response;
 import lombok.NonNull;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfModelException;
 import org.onap.policy.models.base.PfModelRuntimeException;
 import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.dao.PfDao;
 import org.onap.policy.models.pdp.concepts.Pdp;
 import org.onap.policy.models.pdp.concepts.PdpGroup;
@@ -40,8 +40,6 @@
 import org.onap.policy.models.pdp.persistence.concepts.JpaPdp;
 import org.onap.policy.models.pdp.persistence.concepts.JpaPdpGroup;
 import org.onap.policy.models.pdp.persistence.concepts.JpaPdpSubGroup;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * This class provides the provision of information on PAP concepts in the database to callers.
@@ -49,10 +47,6 @@
  * @author Liam Fallon (liam.fallon@est.tech)
  */
 public class PdpProvider {
-    private static final Logger LOGGER = LoggerFactory.getLogger(PdpProvider.class);
-
-    // Recurring string constants
-    private static final String NOT_VALID = "\" is not valid \n";
 
     /**
      * Get PDP groups.
@@ -96,11 +90,9 @@
             JpaPdpGroup jpaPdpGroup = new JpaPdpGroup();
             jpaPdpGroup.fromAuthorative(pdpGroup);
 
-            PfValidationResult validationResult = jpaPdpGroup.validate(new PfValidationResult());
-            if (!validationResult.isOk()) {
-                String errorMessage = "pdp group \"" + jpaPdpGroup.getId() + NOT_VALID + validationResult;
-                LOGGER.warn(errorMessage);
-                throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, errorMessage);
+            BeanValidationResult validationResult = jpaPdpGroup.validate("PDP group");
+            if (!validationResult.isValid()) {
+                throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, validationResult.getResult());
             }
 
             dao.create(jpaPdpGroup);
@@ -133,11 +125,9 @@
             JpaPdpGroup jpaPdpGroup = new JpaPdpGroup();
             jpaPdpGroup.fromAuthorative(pdpGroup);
 
-            PfValidationResult validationResult = jpaPdpGroup.validate(new PfValidationResult());
-            if (!validationResult.isOk()) {
-                String errorMessage = "pdp group \"" + jpaPdpGroup.getId() + NOT_VALID + validationResult;
-                LOGGER.warn(errorMessage);
-                throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, errorMessage);
+            BeanValidationResult validationResult = jpaPdpGroup.validate("PDP group");
+            if (!validationResult.isValid()) {
+                throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, validationResult.getResult());
             }
 
             dao.update(jpaPdpGroup);
@@ -171,11 +161,9 @@
         final JpaPdpSubGroup jpaPdpSubgroup = new JpaPdpSubGroup(subGroupKey);
         jpaPdpSubgroup.fromAuthorative(pdpSubGroup);
 
-        PfValidationResult validationResult = jpaPdpSubgroup.validate(new PfValidationResult());
-        if (!validationResult.isOk()) {
-            String errorMessage = "PDP subgroup \"" + jpaPdpSubgroup.getId() + NOT_VALID + validationResult;
-            LOGGER.warn(errorMessage);
-            throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, errorMessage);
+        BeanValidationResult validationResult = jpaPdpSubgroup.validate("PDP sub group");
+        if (!validationResult.isValid()) {
+            throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, validationResult.getResult());
         }
 
         dao.update(jpaPdpSubgroup);
@@ -198,11 +186,9 @@
         final JpaPdp jpaPdp = new JpaPdp(pdpKey);
         jpaPdp.fromAuthorative(pdp);
 
-        PfValidationResult validationResult = jpaPdp.validate(new PfValidationResult());
-        if (!validationResult.isOk()) {
-            String errorMessage = "PDP \"" + jpaPdp.getId() + NOT_VALID + validationResult;
-            LOGGER.warn(errorMessage);
-            throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, errorMessage);
+        BeanValidationResult validationResult = jpaPdp.validate("PDP");
+        if (!validationResult.isValid()) {
+            throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, validationResult.getResult());
         }
 
         dao.update(jpaPdp);
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProvider.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProvider.java
index 3b17180..7901246 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProvider.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProvider.java
@@ -3,6 +3,7 @@
  * ONAP Policy Model
  * ================================================================================
  * Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -30,16 +31,14 @@
 import java.util.stream.Collectors;
 import javax.ws.rs.core.Response;
 import lombok.NonNull;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfModelException;
 import org.onap.policy.models.base.PfModelRuntimeException;
 import org.onap.policy.models.base.PfTimestampKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.dao.PfDao;
 import org.onap.policy.models.pdp.concepts.PdpStatistics;
 import org.onap.policy.models.pdp.persistence.concepts.JpaPdpStatistics;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
@@ -48,10 +47,7 @@
  * @author Ning Xi (ning.xi@est.tech)
  */
 public class PdpStatisticsProvider {
-    private static final Logger LOGGER = LoggerFactory.getLogger(PdpStatisticsProvider.class);
-
     // Recurring string constants
-    private static final String NOT_VALID = "\" is not valid \n";
     private static final String DESC_ORDER = "DESC";
 
     /**
@@ -118,11 +114,9 @@
             JpaPdpStatistics jpaPdpStatistics = new JpaPdpStatistics();
             jpaPdpStatistics.fromAuthorative(pdpStatistics);
 
-            PfValidationResult validationResult = jpaPdpStatistics.validate(new PfValidationResult());
-            if (!validationResult.isOk()) {
-                String errorMessage = "pdp statictics \"" + jpaPdpStatistics.getName() + NOT_VALID + validationResult;
-                LOGGER.warn(errorMessage);
-                throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, errorMessage);
+            BeanValidationResult validationResult = jpaPdpStatistics.validate("pdp statistics");
+            if (!validationResult.isValid()) {
+                throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, validationResult.getResult());
             }
 
             dao.create(jpaPdpStatistics);
@@ -156,11 +150,9 @@
             JpaPdpStatistics jpaPdpStatistics = new JpaPdpStatistics();
             jpaPdpStatistics.fromAuthorative(pdpStatistics);
 
-            PfValidationResult validationResult = jpaPdpStatistics.validate(new PfValidationResult());
-            if (!validationResult.isOk()) {
-                String errorMessage = "pdp statistics \"" + jpaPdpStatistics.getId() + NOT_VALID + validationResult;
-                LOGGER.warn(errorMessage);
-                throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, errorMessage);
+            BeanValidationResult validationResult = jpaPdpStatistics.validate("pdp statistics");
+            if (!validationResult.isValid()) {
+                throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, validationResult.getResult());
             }
 
             dao.update(jpaPdpStatistics);
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java
index a013add..a4bf252 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java
@@ -35,7 +35,6 @@
 import org.junit.Test;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.pdp.concepts.PdpGroup;
 import org.onap.policy.models.pdp.enums.PdpState;
 import org.onap.policy.models.pdp.testconcepts.DummyJpaPdpSubgroupChild;
@@ -130,44 +129,44 @@
 
         assertThatThrownBy(() -> {
             testJpaPdpGroup.validate(null);
-        }).hasMessageMatching("resultIn" + NULL_ERROR);
+        }).hasMessageMatching("fieldName" + NULL_ERROR);
 
-        assertFalse(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdpGroup.validate("").isValid());
         testJpaPdpGroup.setPdpGroupState(PdpState.PASSIVE);
-        assertTrue(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpGroup.validate("").isValid());
 
         testJpaPdpGroup.setKey(PfConceptKey.getNullKey());
-        assertFalse(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdpGroup.validate("").isValid());
         testJpaPdpGroup.setKey(new PfConceptKey("PdpGroup0", VERSION));
-        assertTrue(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpGroup.validate("").isValid());
 
         testJpaPdpGroup.setDescription("   ");
-        assertFalse(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdpGroup.validate("").isValid());
         testJpaPdpGroup.setDescription("  A Description ");
-        assertTrue(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpGroup.validate("").isValid());
         testJpaPdpGroup.setDescription(null);
-        assertTrue(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpGroup.validate("").isValid());
 
         testJpaPdpGroup.setProperties(new LinkedHashMap<>());
         testJpaPdpGroup.getProperties().put(null, null);
-        assertFalse(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdpGroup.validate("").isValid());
         testJpaPdpGroup.getProperties().remove(null);
-        assertTrue(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpGroup.validate("").isValid());
 
         testJpaPdpGroup.setProperties(new LinkedHashMap<>());
         testJpaPdpGroup.getProperties().put("NullKey", null);
-        assertFalse(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdpGroup.validate("").isValid());
         testJpaPdpGroup.getProperties().remove("NullKey");
-        assertTrue(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpGroup.validate("").isValid());
 
         List<JpaPdpSubGroup> jpaPdpSubgroups = testJpaPdpGroup.getPdpSubGroups();
         assertNotNull(jpaPdpSubgroups);
         testJpaPdpGroup.setPdpSubGroups(null);
-        assertFalse(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdpGroup.validate("").isValid());
         testJpaPdpGroup.setPdpSubGroups(new ArrayList<>());
-        assertTrue(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpGroup.validate("").isValid());
         testJpaPdpGroup.setPdpSubGroups(jpaPdpSubgroups);
-        assertTrue(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpGroup.validate("").isValid());
 
         JpaPdpGroup otherJpaPdpGroup = new JpaPdpGroup(testJpaPdpGroup);
         assertEquals(0, testJpaPdpGroup.compareTo(otherJpaPdpGroup));
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatisticsTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatisticsTest.java
index b8d8d99..83cf85b 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatisticsTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatisticsTest.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -31,7 +32,6 @@
 import java.util.Date;
 import org.junit.Test;
 import org.onap.policy.models.base.PfTimestampKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.pdp.concepts.PdpStatistics;
 
 /**
@@ -92,11 +92,11 @@
     @Test
     public void testValidate() {
         JpaPdpStatistics nullKeyJpaPdpStat = new JpaPdpStatistics();
-        assertFalse(nullKeyJpaPdpStat.validate(new PfValidationResult()).isOk());
+        assertFalse(nullKeyJpaPdpStat.validate("").isValid());
 
         PdpStatistics pdpStat = createPdpStatistics();
         JpaPdpStatistics jpaPdpStat2 = new JpaPdpStatistics(pdpStat);
-        assertTrue(jpaPdpStat2.validate(new PfValidationResult()).isOk());
+        assertTrue(jpaPdpStat2.validate("").isValid());
     }
 
     @Test
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java
index cb27151..969b59c 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java
@@ -21,6 +21,7 @@
 
 package org.onap.policy.models.pdp.persistence.concepts;
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -36,7 +37,7 @@
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfReferenceKey;
 import org.onap.policy.models.base.PfSearchableKey;
-import org.onap.policy.models.base.PfValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.pdp.concepts.PdpSubGroup;
 import org.onap.policy.models.pdp.testconcepts.DummyJpaPdpSubgroupChild;
 
@@ -138,82 +139,79 @@
 
         assertThatThrownBy(() -> {
             testJpaPdpSubGroup.validate(null);
-        }).hasMessageMatching("resultIn is marked .*ull but is null");
+        }).hasMessageMatching("fieldName is marked .*ull but is null");
 
-        assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
-        assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).toString()
-                .contains("INVALID:parent of key is a null key"));
+        assertFalse(testJpaPdpSubGroup.validate("").isValid());
+        assertThat(testJpaPdpSubGroup.validate("").getResult())
+                .contains("parent of key").contains(Validated.IS_A_NULL_KEY);
 
         testJpaPdpSubGroup.getKey().setParentConceptKey(new PfConceptKey("Parent:1.0.0"));
-        assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
-        assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).toString()
-                .contains("INVALID:parent of key is a null key"));
-        assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).toString()
-                .contains("INVALID:a PDP subgroup must support at least one policy type"));
+        assertFalse(testJpaPdpSubGroup.validate("").isValid());
+        assertThat(testJpaPdpSubGroup.validate("").getResult())
+                .doesNotContain("parent of key")
+                .contains("supportedPolicyTypes").contains("is empty");
 
         testJpaPdpSubGroup.setSupportedPolicyTypes(new ArrayList<>());
         testJpaPdpSubGroup.getSupportedPolicyTypes().add(new PfSearchableKey("APolicyType:1.0.0"));
-        assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
-        assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).toString()
-                .contains("INVALID:a PDP subgroup must support at least one policy type"));
+        assertTrue(testJpaPdpSubGroup.validate("").isValid());
 
         PfReferenceKey savedKey = testJpaPdpSubGroup.getKey();
         testJpaPdpSubGroup.setKey(PfReferenceKey.getNullKey());
-        assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdpSubGroup.validate("").isValid());
         testJpaPdpSubGroup.setKey(savedKey);
-        assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpSubGroup.validate("").isValid());
 
         testJpaPdpSubGroup.setProperties(new LinkedHashMap<>());
         testJpaPdpSubGroup.getProperties().put(null, null);
-        assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdpSubGroup.validate("").isValid());
         testJpaPdpSubGroup.getProperties().remove(null);
-        assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpSubGroup.validate("").isValid());
 
         testJpaPdpSubGroup.setProperties(new LinkedHashMap<>());
         testJpaPdpSubGroup.getProperties().put("NullKey", null);
-        assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdpSubGroup.validate("").isValid());
         testJpaPdpSubGroup.getProperties().remove("NullKey");
-        assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpSubGroup.validate("").isValid());
 
         testJpaPdpSubGroup.setDesiredInstanceCount(-1);
-        assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdpSubGroup.validate("").isValid());
         testJpaPdpSubGroup.setDesiredInstanceCount(0);
-        assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpSubGroup.validate("").isValid());
         testJpaPdpSubGroup.setProperties(null);
 
         testJpaPdpSubGroup.setCurrentInstanceCount(-1);
-        assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdpSubGroup.validate("").isValid());
         testJpaPdpSubGroup.setCurrentInstanceCount(0);
-        assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpSubGroup.validate("").isValid());
         testJpaPdpSubGroup.setProperties(null);
-        assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpSubGroup.validate("").isValid());
 
         List<PfSearchableKey> supportedPolicyTypes = testJpaPdpSubGroup.getSupportedPolicyTypes();
         assertNotNull(supportedPolicyTypes);
         testJpaPdpSubGroup.setSupportedPolicyTypes(null);
-        assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdpSubGroup.validate("").isValid());
         testJpaPdpSubGroup.setSupportedPolicyTypes(new ArrayList<>());
-        assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdpSubGroup.validate("").isValid());
         testJpaPdpSubGroup.setSupportedPolicyTypes(supportedPolicyTypes);
-        assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpSubGroup.validate("").isValid());
 
         List<PfConceptKey> supportedPolicies = testJpaPdpSubGroup.getPolicies();
         assertNotNull(supportedPolicies);
         testJpaPdpSubGroup.setPolicies(null);
-        assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdpSubGroup.validate("").isValid());
         testJpaPdpSubGroup.setPolicies(new ArrayList<>());
-        assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpSubGroup.validate("").isValid());
         testJpaPdpSubGroup.setPolicies(supportedPolicies);
-        assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpSubGroup.validate("").isValid());
 
         List<JpaPdp> pdpInstances = testJpaPdpSubGroup.getPdpInstances();
         assertNotNull(pdpInstances);
         testJpaPdpSubGroup.setPdpInstances(null);
-        assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdpSubGroup.validate("").isValid());
         testJpaPdpSubGroup.setPdpInstances(new ArrayList<>());
-        assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpSubGroup.validate("").isValid());
         testJpaPdpSubGroup.setPdpInstances(pdpInstances);
-        assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdpSubGroup.validate("").isValid());
 
         JpaPdpSubGroup otherJpaPdpSubGroup = new JpaPdpSubGroup(testJpaPdpSubGroup);
         assertEquals(0, testJpaPdpSubGroup.compareTo(otherJpaPdpSubGroup));
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java
index 74a3c9e..3102c50 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java
@@ -21,6 +21,7 @@
 
 package org.onap.policy.models.pdp.persistence.concepts;
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -31,7 +32,7 @@
 import org.junit.Test;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.pdp.concepts.Pdp;
 import org.onap.policy.models.pdp.enums.PdpHealthStatus;
 import org.onap.policy.models.pdp.enums.PdpState;
@@ -115,48 +116,45 @@
 
         assertThatThrownBy(() -> {
             testJpaPdp.validate(null);
-        }).hasMessageMatching("resultIn is marked .*ull but is null");
+        }).hasMessageMatching("fieldName is marked .*ull but is null");
 
-        assertFalse(testJpaPdp.validate(new PfValidationResult()).isOk());
-        assertTrue(testJpaPdp.validate(new PfValidationResult()).toString()
-                .contains("INVALID:parent of key is a null key"));
+        assertFalse(testJpaPdp.validate("").isValid());
+        assertThat(testJpaPdp.validate("").getResult())
+                .contains("parent").contains(Validated.IS_A_NULL_KEY);
 
         testJpaPdp.getKey().setParentConceptKey(new PfConceptKey("Parent:1.0.0"));
-        assertFalse(testJpaPdp.validate(new PfValidationResult()).isOk());
-        assertFalse(testJpaPdp.validate(new PfValidationResult()).toString()
-                .contains("INVALID:parent of key is a null key"));
-        assertTrue(testJpaPdp.validate(new PfValidationResult()).toString()
-                .contains("INVALID:local name of parent of key is null"));
+        assertFalse(testJpaPdp.validate("").isValid());
+        assertThat(testJpaPdp.validate("").getResult())
+            .doesNotContain("\"parent\"")
+            .contains("local name").contains(Validated.IS_NULL);
 
         testJpaPdp.getKey().setParentLocalName("ParentLocal");
-        assertFalse(testJpaPdp.validate(new PfValidationResult()).isOk());
-        assertFalse(testJpaPdp.validate(new PfValidationResult()).toString()
-                .contains("INVALID:local name of parent of key is null"));
-        assertTrue(testJpaPdp.validate(new PfValidationResult()).toString()
-                .contains("INVALID:PDP state may not be null"));
+        assertFalse(testJpaPdp.validate("").isValid());
+        assertThat(testJpaPdp.validate("").getResult())
+            .doesNotContain("local name")
+            .contains("pdpState").contains(Validated.IS_NULL);
 
         testJpaPdp.setPdpState(PdpState.ACTIVE);
-        assertFalse(testJpaPdp.validate(new PfValidationResult()).isOk());
-        assertFalse(testJpaPdp.validate(new PfValidationResult()).toString()
-                .contains("INVALID:PDP state may not be null"));
-        assertTrue(testJpaPdp.validate(new PfValidationResult()).toString()
-                .contains("INVALID:PDP health status may not be null"));
+        assertFalse(testJpaPdp.validate("").isValid());
+        assertThat(testJpaPdp.validate("").getResult())
+            .doesNotContain("pdpState")
+            .contains("healthy").contains(Validated.IS_NULL);
 
         testJpaPdp.setHealthy(PdpHealthStatus.HEALTHY);
-        assertTrue(testJpaPdp.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdp.validate("").isValid());
 
         PfReferenceKey savedKey = testJpaPdp.getKey();
         testJpaPdp.setKey(PfReferenceKey.getNullKey());
-        assertFalse(testJpaPdp.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdp.validate("").isValid());
         testJpaPdp.setKey(savedKey);
-        assertTrue(testJpaPdp.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdp.validate("").isValid());
 
         testJpaPdp.setMessage(null);
-        assertTrue(testJpaPdp.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdp.validate("").isValid());
         testJpaPdp.setMessage("");
-        assertFalse(testJpaPdp.validate(new PfValidationResult()).isOk());
+        assertFalse(testJpaPdp.validate("").isValid());
         testJpaPdp.setMessage("Valid Message");
-        assertTrue(testJpaPdp.validate(new PfValidationResult()).isOk());
+        assertTrue(testJpaPdp.validate("").isValid());
 
         JpaPdp otherJpaPdp = new JpaPdp(testJpaPdp);
         assertEquals(0, testJpaPdp.compareTo(otherJpaPdp));
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java
index 7dc5d3a..b687472 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@
 import org.onap.policy.common.utils.coder.StandardCoder;
 import org.onap.policy.common.utils.resources.ResourceUtils;
 import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.dao.DaoParameters;
 import org.onap.policy.models.dao.PfDao;
 import org.onap.policy.models.dao.PfDaoFactory;
@@ -204,7 +205,8 @@
         pdpGroups0.getGroups().get(0).setPdpGroupState(null);
         assertThatThrownBy(() -> {
             new PdpProvider().createPdpGroups(pfDao, pdpGroups0.getGroups());
-        }).hasMessageContaining("INVALID:pdpGroupState may not be null");
+        }).hasMessageContaining("PDP group").hasMessageContaining("pdpGroupState")
+                        .hasMessageContaining(Validated.IS_NULL);
     }
 
     @Test
@@ -269,7 +271,8 @@
         pdpGroups0.getGroups().get(0).setPdpGroupState(null);
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpGroups(pfDao, pdpGroups0.getGroups());
-        }).hasMessageContaining("INVALID:pdpGroupState may not be null");
+        }).hasMessageContaining("PDP group").hasMessageContaining("pdpGroupState")
+                    .hasMessageContaining(Validated.IS_NULL);
     }
 
     @Test
@@ -375,7 +378,8 @@
         existingSubGroup.setDesiredInstanceCount(-1);
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpSubGroup(pfDao, PDP_GROUP0, existingSubGroup);
-        }).hasMessageContaining("INVALID:the desired instance count of a PDP sub group may not be negative");
+        }).hasMessageContaining("PDP sub group").hasMessageContaining("desiredInstanceCount")
+                        .hasMessageContaining("is negative");
         existingSubGroup.setDesiredInstanceCount(10);
     }
 
@@ -473,7 +477,7 @@
         existingPdp.setMessage("");
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(pfDao, PDP_GROUP0, "APEX", existingPdp);
-        }).hasMessageContaining("INVALID:message may not be blank");
+        }).hasMessageContaining("PDP").hasMessageContaining("message").hasMessageContaining(Validated.IS_BLANK);
         existingPdp.setMessage("A Message");
     }
 
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProviderTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProviderTest.java
index 904e5f1..d8eeab4 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProviderTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProviderTest.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -32,6 +33,7 @@
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.dao.DaoParameters;
 import org.onap.policy.models.dao.PfDao;
 import org.onap.policy.models.dao.PfDaoFactory;
@@ -141,11 +143,13 @@
 
         assertThatThrownBy(() -> {
             new PdpStatisticsProvider().createPdpStatistics(pfDao, pdpStatisticsNullList);
-        }).hasMessageContaining("pdp statictics \"NULL\" is not valid");
+        }).hasMessageContaining("pdp statistics").hasMessageContaining("key")
+                        .hasMessageContaining(Validated.IS_A_NULL_KEY);
 
         assertThatThrownBy(() -> {
             new PdpStatisticsProvider().updatePdpStatistics(pfDao, pdpStatisticsNullList);
-        }).hasMessageContaining("pdp statistics \"NULL:0.0.0:0\" is not valid");
+        }).hasMessageContaining("pdp statistics").hasMessageContaining("key")
+                        .hasMessageContaining(Validated.IS_A_NULL_KEY);
     }
 
     @Test
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignment.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignment.java
index 6394517..81c4642 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignment.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignment.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  * Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -24,7 +25,6 @@
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 import javax.persistence.ElementCollection;
 import javax.persistence.Entity;
 import javax.persistence.Inheritance;
@@ -34,14 +34,13 @@
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.common.utils.coder.YamlJsonTranslator;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaCapabilityAssignment;
 
 /**
@@ -160,78 +159,13 @@
     }
 
     @Override
-    public PfValidationResult validate(final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
-        if (properties != null) {
-            result.append(validateProperties(new PfValidationResult()));
-        }
+        validateMap(result, "properties", properties, Validated::validateEntryValueNotNull);
+        validateMap(result, "attributes", attributes, Validated::validateEntryValueNotNull);
 
-        if (attributes != null) {
-            result.append(validateAttributes(new PfValidationResult()));
-        }
-
-        if (occurrences != null) {
-            result.append(validateOccurrences(new PfValidationResult()));
-        }
-
-        return result;
-    }
-
-    /**
-     * Validate the properties.
-     *
-     * @param resultIn The result of validations up to now
-     * @return the validation result
-     */
-    private PfValidationResult validateProperties(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        for (Entry<String, String> propertyEntry : properties.entrySet()) {
-            if (propertyEntry.getValue() == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "capability assignment property " + propertyEntry.getKey() + " value may not be null"));
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Validate the attributes.
-     *
-     * @param resultIn The result of validations up to now
-     * @return the validation result
-     */
-    private PfValidationResult validateAttributes(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        for (Entry<String, String> attributeEntry : attributes.entrySet()) {
-            if (attributeEntry.getValue() == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "capability assignment attribute " + attributeEntry.getKey() + " value may not be null"));
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Validate the occurrences.
-     *
-     * @param resultIn The result of validations up to now
-     * @return the validation result
-     */
-    private PfValidationResult validateOccurrences(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        for (Integer occurrence : occurrences) {
-            if (occurrence == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "capability assignment occurrence value may not be null "));
-            } else if (occurrence < 0 && !occurrence.equals(JPA_UNBOUNDED_VALUE)) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "capability assignment occurrence value may not be negative"));
-            }
-        }
+        validateList(result, "occurrences", occurrences, validateMin(0, JPA_UNBOUNDED_VALUE, true));
 
         return result;
     }
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignments.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignments.java
index 5afc892..18e77bb 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignments.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignments.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -31,10 +32,10 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import lombok.ToString;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConceptContainer;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaCapabilityAssignment;
 import org.onap.policy.models.tosca.utils.ToscaUtils;
 
@@ -105,8 +106,8 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
         for (JpaToscaCapabilityAssignment assignment : this.getConceptMap().values()) {
             ToscaUtils.getEntityTypeAncestors(this, assignment, result);
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityType.java
index 4db7795..3a4956c 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityType.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  * Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -37,15 +38,14 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.collections4.CollectionUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfReferenceKey;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaCapabilityType;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
 import org.onap.policy.models.tosca.utils.ToscaUtils;
@@ -156,41 +156,16 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
-        if (getKey().isNullVersion()) {
-            result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                    "key version is a null version"));
-        }
+        result.addResult(validateKeyVersionNotNull("key", getKey()));
 
-        if (properties != null) {
-            result = validateProperties(result);
-        }
+        validateMap(result, "properties", properties, Validated::validateEntryValueNotNull);
 
         return result;
     }
 
-    /**
-     * Validate the capabiltiy type properties.
-     *
-     * @param resultIn The result of validations up to now
-     * @return the validation result
-     */
-    private PfValidationResult validateProperties(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        for (JpaToscaProperty property : properties.values()) {
-            if (property == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "capability type property may not be null "));
-            } else {
-                result = property.validate(result);
-            }
-        }
-        return result;
-    }
-
     @Override
     public int compareTo(final PfConcept otherConcept) {
         if (otherConcept == null) {
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityTypes.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityTypes.java
index 6ec6de5..e1feaed 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityTypes.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityTypes.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -31,9 +32,9 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import lombok.ToString;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConceptContainer;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaCapabilityType;
 import org.onap.policy.models.tosca.utils.ToscaUtils;
 
@@ -99,8 +100,8 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
         // Check that all ancestors of this policy type exist
         for (JpaToscaCapabilityType capabilityType : this.getConceptMap().values()) {
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java
index 58ac9e3..d80c14a 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java
@@ -41,15 +41,14 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.collections4.CollectionUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfReferenceKey;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaDataType;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
 import org.onap.policy.models.tosca.utils.ToscaUtils;
@@ -165,51 +164,12 @@
     }
 
     @Override
-    public PfValidationResult validate(final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
-        if (constraints != null) {
-            validateConstraints(result);
-        }
+        validateList(result, "constraints", constraints, Validated::validateNotNull);
+        validateMap(result, "properties", properties, Validated::validateEntryValueNotNull);
 
-        if (properties != null) {
-            result = validateProperties(result);
-        }
-
-        return result;
-    }
-
-    /**
-     * Validate the constraints.
-     *
-     * @param result where to put the validation results
-     */
-    private void validateConstraints(@NonNull final PfValidationResult result) {
-        for (JpaToscaConstraint constraint : constraints) {
-            if (constraint == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "data type constraint may not be null "));
-            }
-        }
-    }
-
-    /**
-     * Validate the properties.
-     *
-     * @param resultIn The result of validations up to now
-     * @return the validation result
-     */
-    private PfValidationResult validateProperties(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        for (JpaToscaProperty property : properties.values()) {
-            if (property == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "data type property may not be null "));
-            } else {
-                result = property.validate(result);
-            }
-        }
         return result;
     }
 
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypes.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypes.java
index e570c05..faa1ce1 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypes.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypes.java
@@ -30,11 +30,10 @@
 import javax.persistence.Table;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
-import lombok.NonNull;
 import lombok.ToString;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConceptContainer;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaDataType;
 import org.onap.policy.models.tosca.utils.ToscaUtils;
 
@@ -103,8 +102,8 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
         for (JpaToscaDataType dataType : this.getConceptMap().values()) {
             ToscaUtils.getEntityTypeAncestors(this, dataType, result);
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java
index 549d93e..169d7f2 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2020 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -35,15 +35,13 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.lang3.ObjectUtils;
-import org.onap.policy.common.utils.validation.ParameterValidationUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
 
 /**
@@ -188,38 +186,17 @@
     }
 
     @Override
-    public PfValidationResult validate(PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        if (key.isNullKey()) {
-            result.addValidationMessage(
-                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+        result.addResult(validateKeyNotNull("key", key));
+
+        if (derivedFrom != null) {
+            result.addResult(validateKeyNotNull("derivedFrom", derivedFrom));
         }
 
-        result = key.validate(result);
-
-        if (derivedFrom != null && derivedFrom.isNullKey()) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "derived from key is a null key"));
-        }
-
-        if (metadata != null) {
-            for (Entry<String, String> metadataEntry : metadata.entrySet()) {
-                if (!ParameterValidationUtils.validateStringParameter(metadataEntry.getKey())) {
-                    result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                            "property metadata key may not be null"));
-                }
-                if (!ParameterValidationUtils.validateStringParameter(metadataEntry.getValue())) {
-                    result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                            "property metadata value may not be null"));
-                }
-            }
-        }
-
-        if (description != null && description.trim().length() == 0) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "property description may not be blank"));
-        }
+        validateMap(result, "metadata", metadata, Validated::validateEntryNotBlankNotBlank);
+        result.addResult(validateNotBlank("description", description, false));
 
         return result;
     }
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilter.java
index 90bb0a8..f0d7b9c 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilter.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilter.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP Policy Model
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2019-2020 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -34,13 +34,11 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.lang3.ObjectUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
 
 /**
  * Class to represent the EventFilter in TOSCA definition.
@@ -124,30 +122,13 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        if (key.isNullKey()) {
-            result.addValidationMessage(
-                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
-        }
-
-        result = key.validate(result);
-
-        if (node == null || node.isNullKey()) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "node on an event filter may not be null"));
-        }
-
-        if (requirement != null && requirement.trim().length() == 0) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "event filter requirement may not be blank"));
-        }
-
-        if (capability != null && capability.trim().length() == 0) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "event filter capability may not be blank"));
-        }
+        result.addResult(validateKeyNotNull("key", key));
+        result.addResult(validateKeyNotNull("node", node));
+        result.addResult(validateNotBlank("requirement", requirement, false));
+        result.addResult(validateNotBlank("capability", capability, false));
 
         return result;
     }
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java
index d65689d..c86c34b 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2020 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -32,12 +32,12 @@
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfModel;
 import org.onap.policy.models.base.PfModelService;
-import org.onap.policy.models.base.PfValidationResult;
 
 /**
  * A container class for a TOSCA model with multiple service templates. This class is a container class that allows a
@@ -117,10 +117,12 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
-        return serviceTemplates.validate(result);
+        result.addResult(serviceTemplates.validate("serviceTemplates"));
+
+        return result;
     }
 
     @Override
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java
index 5fccbe2..05aefa7 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  * Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -41,7 +42,7 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.lang3.ObjectUtils;
-import org.apache.commons.lang3.StringUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.common.utils.coder.CoderException;
 import org.onap.policy.common.utils.coder.StandardCoder;
 import org.onap.policy.models.base.PfAuthorative;
@@ -50,9 +51,7 @@
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfModelRuntimeException;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaCapabilityAssignment;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
 
@@ -231,44 +230,15 @@
     }
 
     @Override
-    public PfValidationResult validate(final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
-        if (StringUtils.isBlank(type)) {
-            result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                    "node template type may not be null"));
-        }
+        result.addResult(validateNotBlank("type", type, true));
 
-        if (properties != null) {
-            result.append(validateProperties(new PfValidationResult()));
-        }
+        validateMap(result, "properties", properties, Validated::validateEntryValueNotNull);
+        validateOptional(result, "requirements", requirements);
+        validateOptional(result, "capabilities", capabilities);
 
-        if (requirements != null) {
-            result.append(requirements.validate(result));
-        }
-
-        if (capabilities != null) {
-            result.append(validateProperties(capabilities.validate(result)));
-        }
-
-        return result;
-    }
-
-    /**
-     * Validate the properties.
-     *
-     * @param resultIn The result of validations up to now
-     * @return the validation result
-     */
-    private PfValidationResult validateProperties(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        for (String property : properties.values()) {
-            if (property == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "topology template property may not be null "));
-            }
-        }
         return result;
     }
 
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplates.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplates.java
index 6c83f67..6cc7a1f 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplates.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplates.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,11 +30,10 @@
 import javax.persistence.Table;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
-import lombok.NonNull;
 import lombok.ToString;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConceptContainer;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
 import org.onap.policy.models.tosca.utils.ToscaUtils;
 
@@ -99,8 +99,8 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
         // Check that all ancestors of this node template exist
         for (JpaToscaNodeTemplate nodeTemplate : this.getConceptMap().values()) {
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java
index 26684b5..f39f9b9 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  * Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -43,15 +44,14 @@
 import lombok.NonNull;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.ObjectUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfReferenceKey;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeType;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
 import org.onap.policy.models.tosca.utils.ToscaUtils;
@@ -185,42 +185,14 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
-        if (PfKey.NULL_KEY_VERSION.equals(getKey().getVersion())) {
-            result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                    "key version is a null version"));
-        }
+        result.addResult(validateKeyVersionNotNull("key", getKey()));
 
-        if (properties != null) {
-            result = validateProperties(result);
-        }
+        validateMap(result, "properties", properties, Validated::validateEntryValueNotNull);
+        validateOptional(result, "requirements", requirements);
 
-        if (requirements != null) {
-            result = requirements.validate(result);
-        }
-
-        return result;
-    }
-
-    /**
-     * Validate the capabiltiy type properties.
-     *
-     * @param resultIn The result of validations up to now
-     * @return the validation result
-     */
-    private PfValidationResult validateProperties(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        for (JpaToscaProperty property : properties.values()) {
-            if (property == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "node type property may not be null "));
-            } else {
-                result = property.validate(result);
-            }
-        }
         return result;
     }
 
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTypes.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTypes.java
index 5eb5a2c..b1fe40b 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTypes.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTypes.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,11 +30,10 @@
 import javax.persistence.Table;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
-import lombok.NonNull;
 import lombok.ToString;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConceptContainer;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeType;
 import org.onap.policy.models.tosca.utils.ToscaUtils;
 
@@ -99,8 +99,8 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
         // Check that all ancestors of this policy type exist
         for (JpaToscaNodeType nodeType : this.getConceptMap().values()) {
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java
index 216e877..19e0e5f 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  * Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -31,15 +32,13 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.lang3.StringUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.common.utils.coder.YamlJsonTranslator;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaParameter;
 
 /**
@@ -161,20 +160,11 @@
     }
 
     @Override
-    public PfValidationResult validate(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        if (key.isNullKey()) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "paremeter key is a null key"));
-        }
-
-        result = key.validate(result);
-
-        if (type == null || type.isNullKey()) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "parameter type may not be null"));
-        }
+        result.addResult(validateKeyNotNull("key", key));
+        result.addResult(validateKeyNotNull("type", type));
 
         return result;
     }
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicies.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicies.java
index ba32ac3..7c1022c 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicies.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicies.java
@@ -30,12 +30,11 @@
 import javax.persistence.Table;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
-import lombok.NonNull;
 import lombok.ToString;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConceptContainer;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
 import org.onap.policy.models.tosca.utils.ToscaUtils;
 
@@ -105,8 +104,8 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
         for (JpaToscaPolicy policy : this.getConceptMap().values()) {
             ToscaUtils.getEntityTypeAncestors(this, policy, result);
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
index 518a088..ae7b342 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
@@ -26,7 +26,6 @@
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 import javax.persistence.AttributeOverride;
 import javax.persistence.AttributeOverrides;
 import javax.persistence.Column;
@@ -40,18 +39,16 @@
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.common.utils.coder.CoderException;
 import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.common.utils.validation.ParameterValidationUtils;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfModelRuntimeException;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
 
 /**
@@ -234,67 +231,15 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
-        if (PfKey.NULL_KEY_VERSION.equals(getKey().getVersion())) {
-            result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                    "key version is a null version"));
-        }
+        result.addResult(validateKeyVersionNotNull("key", getKey()));
+        result.addResult(validateKeyNotNull("type", type));
 
-        if (type == null || type.isNullKey()) {
-            result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                    "type is null or a null key"));
-        } else {
-            result = type.validate(result);
-        }
+        validateMap(result, "properties", properties, Validated::validateEntryNotBlankNotNull);
+        validateList(result, "targets", targets, Validated::validateNotNull);
 
-        if (properties != null) {
-            validateProperties(result);
-        }
-
-        if (targets != null) {
-            result = validateTargets(result);
-        }
-
-        return result;
-    }
-
-    /**
-     * Validate the policy properties.
-     *
-     * @param result where to put the validation results
-     */
-    private void validateProperties(final PfValidationResult result) {
-
-        for (Entry<String, String> propertyEntry : properties.entrySet()) {
-            if (!ParameterValidationUtils.validateStringParameter(propertyEntry.getKey())) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "policy property key may not be null "));
-            } else if (propertyEntry.getValue() == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "policy property value may not be null "));
-            }
-        }
-    }
-
-    /**
-     * Validate the policy targets.
-     *
-     * @param resultIn The result of validations up to now
-     * @return the validation result
-     */
-    private PfValidationResult validateTargets(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        for (PfConceptKey target : targets) {
-            if (target == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "policy target may not be null "));
-            } else {
-                result = target.validate(result);
-            }
-        }
         return result;
     }
 
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java
index 7a5493c..665c79d 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP Policy Model
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2019-2020 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -40,15 +40,14 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.collections4.CollectionUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfReferenceKey;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
 import org.onap.policy.models.tosca.utils.ToscaUtils;
@@ -188,86 +187,15 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
-        if (PfKey.NULL_KEY_VERSION.equals(getKey().getVersion())) {
-            result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                    "key version is a null version"));
-        }
+        result.addResult(validateKeyVersionNotNull("key", getKey()));
 
-        if (properties != null) {
-            result = validateProperties(result);
-        }
+        validateMap(result, "properties", properties, Validated::validateEntryValueNotNull);
+        validateList(result, "targets", targets, Validated::validateNotNull);
+        validateList(result, "triggers", triggers, Validated::validateNotNull);
 
-        if (targets != null) {
-            result = validateTargets(result);
-        }
-
-        if (triggers != null) {
-            result = validateTriggers(result);
-        }
-
-        return result;
-    }
-
-    /**
-     * Validate the policy properties.
-     *
-     * @param result The result of validations up to now
-     * @return the validation result
-     */
-    private PfValidationResult validateProperties(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        for (JpaToscaProperty property : properties.values()) {
-            if (property == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "policy property may not be null "));
-            } else {
-                result = property.validate(result);
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Validate the policy targets.
-     *
-     * @param result The result of validations up to now
-     * @return the validation result
-     */
-    private PfValidationResult validateTargets(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        for (PfConceptKey target : targets) {
-            if (target == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "policy target may not be null "));
-            } else {
-                result = target.validate(result);
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Validate the policy triggers.
-     *
-     * @param result The result of validations up to now
-     * @return the validation result
-     */
-    private PfValidationResult validateTriggers(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        for (JpaToscaTrigger trigger : triggers) {
-            if (trigger == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "policy trigger may not be null "));
-            } else {
-                result = trigger.validate(result);
-            }
-        }
         return result;
     }
 
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypes.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypes.java
index 0a3d070..c20cada 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypes.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypes.java
@@ -30,11 +30,10 @@
 import javax.persistence.Table;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
-import lombok.NonNull;
 import lombok.ToString;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConceptContainer;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
 import org.onap.policy.models.tosca.utils.ToscaUtils;
 
@@ -103,8 +102,8 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
         // Check that all ancestors of this policy type exist
         for (JpaToscaPolicyType policyType : this.getConceptMap().values()) {
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java
index c56dc6a..a7156bb 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP Policy Model
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2019-2020 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -38,6 +38,7 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.lang3.ObjectUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.common.utils.coder.YamlJsonTranslator;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
@@ -45,9 +46,7 @@
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfReferenceKey;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty.Status;
 
@@ -241,52 +240,18 @@
     }
 
     @Override
-    public PfValidationResult validate(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        if (key.isNullKey()) {
-            result.addValidationMessage(
-                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
-        }
+        result.addResult(validateKeyNotNull("key", key));
+        result.addResult(validateKeyNotNull("type", type));
+        result.addResult(validateNotBlank("description", description, false));
+        result.addResult(validateNotBlank("defaultValue", defaultValue, false));
 
-        result = key.validate(result);
+        validateList(result, "constraints", constraints, Validated::validateNotNull);
+        validateOptional(result, "entrySchema", entrySchema);
 
-        if (type == null || type.isNullKey()) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "property type may not be null"));
-        }
-
-        return validateFields(result);
-    }
-
-    /**
-     * Validate the property fields.
-     *
-     * @param resultIn the incoming validation results so far
-     * @return the validation results including this validation
-     */
-    private PfValidationResult validateFields(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        if (description != null && description.trim().length() == 0) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "property description may not be blank"));
-        }
-
-        if (defaultValue != null && defaultValue.trim().length() == 0) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "property default value may not be null"));
-        }
-
-        if (constraints != null) {
-            for (JpaToscaConstraint constraint : constraints) {
-                if (constraint == null) {
-                    result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                            "property constraint may not be null "));
-                }
-            }
-        }
-        return (entrySchema != null ? entrySchema.validate(result) : result);
+        return result;
     }
 
     @Override
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipType.java
index d3d06d4..4bbcea4 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipType.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  * Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -37,15 +38,14 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.collections4.CollectionUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfReferenceKey;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaRelationshipType;
 import org.onap.policy.models.tosca.utils.ToscaUtils;
@@ -153,41 +153,16 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
-        if (PfKey.NULL_KEY_VERSION.equals(getKey().getVersion())) {
-            result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                    "key version is a null version"));
-        }
+        result.addResult(validateKeyVersionNotNull("key", getKey()));
 
-        if (properties != null) {
-            result = validateProperties(result);
-        }
+        validateMap(result, "properties", properties, Validated::validateEntryValueNotNull);
 
         return result;
     }
 
-    /**
-     * Validate the capabiltiy type properties.
-     *
-     * @param resultIn The result of validations up to now
-     * @return the validation result
-     */
-    private PfValidationResult validateProperties(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        for (JpaToscaProperty property : properties.values()) {
-            if (property == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "relationship type property may not be null "));
-            } else {
-                result = property.validate(result);
-            }
-        }
-        return result;
-    }
-
     @Override
     public int compareTo(final PfConcept otherConcept) {
         if (otherConcept == null) {
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipTypes.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipTypes.java
index 28e1d60..eed351d 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipTypes.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRelationshipTypes.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,11 +30,10 @@
 import javax.persistence.Table;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
-import lombok.NonNull;
 import lombok.ToString;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConceptContainer;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaRelationshipType;
 import org.onap.policy.models.tosca.utils.ToscaUtils;
 
@@ -100,8 +100,8 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
         // Check that all ancestors of this policy type exist
         for (JpaToscaRelationshipType relationshipType : this.getConceptMap().values()) {
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirement.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirement.java
index aebc31c..bf1249d 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirement.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirement.java
@@ -37,14 +37,13 @@
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.common.utils.coder.YamlJsonTranslator;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaRequirement;
 
 /**
@@ -63,7 +62,7 @@
 
     private static final long serialVersionUID = 2785481541573683089L;
     private static final String AUTHORATIVE_UNBOUNDED_LITERAL = "UNBOUNDED";
-    private static final Double JPA_UNBOUNDED_VALUE = -1.0;
+    private static final Integer JPA_UNBOUNDED_VALUE = -1;
 
     @Column
     private String capability;
@@ -75,7 +74,7 @@
     private String relationship;
 
     @ElementCollection
-    private List<Double> occurrences;
+    private List<Integer> occurrences;
 
     @ElementCollection
     @Lob
@@ -133,11 +132,11 @@
 
         if (occurrences != null) {
             List<Object> occurrencesList = new ArrayList<>(occurrences);
-            for (Double occurrence : occurrences) {
-                if (occurrence == JPA_UNBOUNDED_VALUE) {
+            for (Integer occurrence : occurrences) {
+                if (JPA_UNBOUNDED_VALUE.equals(occurrence)) {
                     occurrencesList.add(AUTHORATIVE_UNBOUNDED_LITERAL);
                 } else {
-                    occurrencesList.add(occurrence.doubleValue());
+                    occurrencesList.add(occurrence);
                 }
             }
             toscaRequirement.setOccurrences(occurrencesList);
@@ -170,7 +169,7 @@
                 if (occurrence.equals(AUTHORATIVE_UNBOUNDED_LITERAL)) {
                     occurrences.add(JPA_UNBOUNDED_VALUE);
                 } else {
-                    occurrences.add((Double) occurrence);
+                    occurrences.add(((Number) occurrence).intValue());
                 }
             }
         }
@@ -186,11 +185,6 @@
     }
 
     @Override
-    public List<PfKey> getKeys() {
-        return super.getKeys();
-    }
-
-    @Override
     public void clean() {
         super.clean();
 
@@ -202,58 +196,11 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
-        if (properties != null) {
-            result = validateProperties(result);
-        }
-
-        if (occurrences != null) {
-            result = validateOccurrences(result);
-        }
-
-        return result;
-    }
-
-    /**
-     * Validate the properties.
-     *
-     * @param resultIn The result of validations up to now
-     * @return the validation result
-     */
-    private PfValidationResult validateProperties(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        for (String property : properties.values()) {
-            if (property == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(),
-                        PfValidationResult.ValidationResult.INVALID, "topology template property may not be null "));
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Validate the occurrences.
-     *
-     * @param resultIn The result of validations up to now
-     * @return the validation result
-     */
-    private PfValidationResult validateOccurrences(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        for (Double occurrence : occurrences) {
-            if (occurrence == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(),
-                        PfValidationResult.ValidationResult.INVALID, "requirement occurrence value may not be null "));
-            }
-            if (occurrence < -1.0) {
-                result.addValidationMessage(
-                        new PfValidationMessage(getKey(), this.getClass(), PfValidationResult.ValidationResult.INVALID,
-                                "requirement occurrence value may not be negative"));
-            }
-        }
+        validateMap(result, "properties", properties, Validated::validateEntryValueNotNull);
+        validateList(result, "occurrences", occurrences, validateMin(0, JPA_UNBOUNDED_VALUE, true));
 
         return result;
     }
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirements.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirements.java
index 08dbb43..283c161 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirements.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaRequirements.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,12 +30,11 @@
 import javax.persistence.Table;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
-import lombok.NonNull;
 import lombok.ToString;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConceptContainer;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaRequirement;
 import org.onap.policy.models.tosca.utils.ToscaUtils;
 
@@ -104,8 +104,8 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
         for (JpaToscaRequirement requirement : this.getConceptMap().values()) {
             ToscaUtils.getEntityTypeAncestors(this, requirement, result);
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinition.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinition.java
index 6bd1b44..bae3629 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinition.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinition.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP Policy Model
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2019-2020 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,14 +33,13 @@
 import lombok.NoArgsConstructor;
 import lombok.NonNull;
 import org.apache.commons.lang3.ObjectUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.common.utils.validation.Assertions;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaConstraint;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaSchemaDefinition;
 
@@ -53,14 +52,11 @@
 @Data
 @EqualsAndHashCode(callSuper = false)
 @NoArgsConstructor
-public class JpaToscaSchemaDefinition
+public class JpaToscaSchemaDefinition extends Validated
         implements PfAuthorative<ToscaSchemaDefinition>, Serializable, Comparable<JpaToscaSchemaDefinition> {
 
     private static final long serialVersionUID = 3645882081163287058L;
 
-    // Recurring string constants
-    private static final String ENTRY_SCHEMA = "EntrySchema";
-
     @Column
     private PfConceptKey type;
 
@@ -147,34 +143,14 @@
         description = (description != null ? description.trim() : null);
     }
 
-    /**
-     * Validate the entry schema.
-     *
-     * @param resultIn the incoming result
-     * @return the ooutput result witht he result of this validation
-     */
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
+    @Override
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        if (type == null || type.isNullKey()) {
-            result.addValidationMessage(new PfValidationMessage(new PfConceptKey(ENTRY_SCHEMA, PfKey.NULL_KEY_VERSION),
-                    this.getClass(), ValidationResult.INVALID, "entry schema type may not be null"));
-        }
+        result.addResult(validateKeyNotNull("type", type));
+        result.addResult(validateNotBlank("description", description, false));
 
-        if (description != null && description.trim().length() == 0) {
-            result.addValidationMessage(new PfValidationMessage(new PfConceptKey(ENTRY_SCHEMA, PfKey.NULL_KEY_VERSION),
-                    this.getClass(), ValidationResult.INVALID, "entry schema description may not be blank"));
-        }
-
-        if (constraints != null) {
-            for (JpaToscaConstraint constraint : constraints) {
-                if (constraint == null) {
-                    result.addValidationMessage(
-                            new PfValidationMessage(new PfConceptKey(ENTRY_SCHEMA, PfKey.NULL_KEY_VERSION),
-                                    this.getClass(), ValidationResult.INVALID, "property constraint may not be null "));
-                }
-            }
-        }
+        validateList(result, "constraints", constraints, Validated::validateNotNull);
 
         return result;
     }
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java
index 7918016..d4e5184 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2020 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -41,14 +41,11 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.lang3.ObjectUtils;
-import org.onap.policy.common.utils.validation.ParameterValidationUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaCapabilityType;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaDataType;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeType;
@@ -363,46 +360,28 @@
     }
 
     @Override
-    public PfValidationResult validate(final PfValidationResult resultIn) {
-        PfValidationResult result = super.validate(resultIn);
+    public BeanValidationResult validate(String fieldName) {
+        BeanValidationResult result = super.validate(fieldName);
 
-        if (!ParameterValidationUtils.validateStringParameter(toscaDefinitionsVersion)) {
-            result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                    "service template tosca definitions version may not be null"));
-        }
+        result.addResult(validateNotBlank("toscaDefinitionsVersion", toscaDefinitionsVersion, true));
 
-        if (dataTypes != null) {
-            result = dataTypes.validate(result);
-        }
-
-        if (capabilityTypes != null) {
-            result = capabilityTypes.validate(result);
-        }
-
-        if (relationshipTypes != null) {
-            result = relationshipTypes.validate(result);
-        }
-
-        if (nodeTypes != null) {
-            result = nodeTypes.validate(result);
-        }
-
-        if (policyTypes != null) {
-            result = policyTypes.validate(result);
-        }
-
-        if (topologyTemplate != null) {
-            result = topologyTemplate.validate(result);
-        }
+        validateOptional(result, "dataTypes", dataTypes);
+        validateOptional(result, "capabilityTypes", capabilityTypes);
+        validateOptional(result, "relationshipTypes", relationshipTypes);
+        validateOptional(result, "nodeTypes", nodeTypes);
+        validateOptional(result, "policyTypes", policyTypes);
+        validateOptional(result, "topologyTemplate", topologyTemplate);
 
         // No point in validating cross references if the structure of the individual parts are not valid
-        if (!result.isOk()) {
+        if (!result.isValid()) {
             return result;
         }
 
         validateReferencedDataTypes(result);
 
-        return validatePolicyTypesInPolicies(result);
+        validatePolicyTypesInPolicies(result);
+
+        return result;
     }
 
     @Override
@@ -471,39 +450,35 @@
      * Validate that all data types referenced in policy types exist.
      *
      * @param result the validation result object to use for the validation result
-     * @return the validation result object
+     * @param result where the results are added
      */
-    private PfValidationResult validateReferencedDataTypes(final PfValidationResult result) {
+    private void validateReferencedDataTypes(final BeanValidationResult result) {
         if (policyTypes == null) {
-            return result;
+            return;
         }
 
         if (dataTypes != null) {
             for (JpaToscaDataType dataType : dataTypes.getAll(null)) {
-                validateReferencedDataTypesExists(dataType.getKey(), dataType.getReferencedDataTypes(), result);
+                validateReferencedDataTypesExists(dataType.getReferencedDataTypes(), result);
             }
         }
 
         for (JpaToscaPolicyType policyType : policyTypes.getAll(null)) {
-            validateReferencedDataTypesExists(policyType.getKey(), policyType.getReferencedDataTypes(), result);
+            validateReferencedDataTypesExists(policyType.getReferencedDataTypes(), result);
         }
-
-        return result;
     }
 
     /**
      * Validate that the referenced data types exist for a collection of data type keys.
      *
-     * @param referencingEntityKey the key of the referencing entity
      * @param dataTypeKeyCollection the data type key collection
-     * @param result the result of the validation
+     * @param result where the results are added
      */
-    private void validateReferencedDataTypesExists(final PfConceptKey referencingEntityKey,
-            final Collection<PfConceptKey> dataTypeKeyCollection, final PfValidationResult result) {
+    private void validateReferencedDataTypesExists(
+            final Collection<PfConceptKey> dataTypeKeyCollection, final BeanValidationResult result) {
         for (PfConceptKey dataTypeKey : dataTypeKeyCollection) {
             if (dataTypes == null || dataTypes.get(dataTypeKey) == null) {
-                result.addValidationMessage(new PfValidationMessage(referencingEntityKey, this.getClass(),
-                        ValidationResult.INVALID, "referenced data type " + dataTypeKey.getId() + " not found"));
+                addResult(result, "data type", dataTypeKey.getId(), NOT_FOUND);
             }
         }
     }
@@ -511,30 +486,24 @@
     /**
      * Validate that all policy types referenced in policies exist.
      *
-     * @param result the validation result object to use for the validation result
-     * @return the validation result object
+     * @param result where the results are added
      */
-    private PfValidationResult validatePolicyTypesInPolicies(PfValidationResult result) {
+    private void validatePolicyTypesInPolicies(BeanValidationResult result) {
         if (topologyTemplate == null || topologyTemplate.getPolicies() == null
                 || topologyTemplate.getPolicies().getConceptMap().isEmpty()) {
-            return result;
+            return;
         }
 
         if (policyTypes == null || policyTypes.getConceptMap().isEmpty()) {
-            result.addValidationMessage(new PfValidationMessage(this.getKey(), this.getClass(),
-                    ValidationResult.INVALID,
-                    "no policy types are defined on the service template for the policies in the topology template"));
-            return result;
+            addResult(result, "policyTypes", policyTypes,
+                    "no policy types are defined on the service template for the policies in the topology template");
+            return;
         }
 
         for (JpaToscaPolicy policy : topologyTemplate.getPolicies().getAll(null)) {
             if (policyTypes.get(policy.getType()) == null) {
-                result.addValidationMessage(
-                        new PfValidationMessage(policy.getKey(), this.getClass(), ValidationResult.INVALID,
-                                "policy type " + policy.getType().getId() + " referenced in policy not found"));
+                addResult(result, "policy type", policy.getType().getId(), NOT_FOUND);
             }
         }
-
-        return result;
     }
 }
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeInterval.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeInterval.java
index 783e2b5..a8a21c3 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeInterval.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeInterval.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP Policy Model
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2019-2020 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -34,13 +34,11 @@
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfReferenceKey;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
 
 /**
  * Class to represent the TimeInterval in TOSCA definition.
@@ -117,30 +115,21 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        if (key.isNullKey()) {
-            result.addValidationMessage(
-                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
-        }
-
-        result = key.validate(result);
+        result.addResult(validateKeyNotNull("key", key));
 
         if (startTime == null || startTime.getTime() == 0) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "start time on time interval may not be null or zero"));
+            addResult(result, "startTime", startTime, "is null or zero");
         }
 
         if (endTime == null || endTime.getTime() == 0) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "end time on time interval may not be null or zero"));
+            addResult(result, "endTime", endTime, "is null or zero");
         }
 
         if (startTime != null && endTime != null && endTime.before(startTime)) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "end time \"" + endTime.toString() + "\" on time interval may not be before start time \""
-                            + startTime.toString() + "\""));
+            addResult(result, "endTime", endTime, "is before startTime");
         }
 
         return result;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java
index 32c459c..538680f 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2020 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -43,14 +43,13 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.lang3.ObjectUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfReferenceKey;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaParameter;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
@@ -241,54 +240,17 @@
     }
 
     @Override
-    public PfValidationResult validate(PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        if (key.isNullKey()) {
-            result.addValidationMessage(
-                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
-        }
+        result.addResult(validateKeyNotNull("key", key));
+        result.addResult(validateNotBlank("description", description, false));
 
-        result = key.validate(result);
+        validateMap(result, "inputs", inputs, Validated::validateEntryValueNotNull);
 
-        if (description != null && description.trim().length() == 0) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "property description may not be blank"));
-        }
+        validateOptional(result, "nodeTemplates", nodeTemplates);
+        validateOptional(result, "policies", policies);
 
-        if (inputs != null) {
-            result = validateInputs(result);
-        }
-
-
-        if (nodeTemplates != null) {
-            result = nodeTemplates.validate(result);
-        }
-
-        if (policies != null) {
-            result = policies.validate(result);
-        }
-
-        return result;
-    }
-
-    /**
-     * Validate the inputs.
-     *
-     * @param resultIn The result of validations up to now
-     * @return the validation result
-     */
-    private PfValidationResult validateInputs(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        for (JpaToscaParameter input : inputs.values()) {
-            if (input == null) {
-                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
-                        "topology template input may not be null "));
-            } else {
-                result = input.validate(result);
-            }
-        }
         return result;
     }
 
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java
index 10a9d2f..e307540 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP Policy Model
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2019-2020 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -36,13 +36,10 @@
 import lombok.EqualsAndHashCode;
 import lombok.NonNull;
 import org.apache.commons.lang3.ObjectUtils;
-import org.onap.policy.common.utils.validation.ParameterValidationUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
 
 /**
  * Class to represent the trigger of policy type in TOSCA definition.
@@ -177,57 +174,23 @@
     }
 
     @Override
-    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
+    public BeanValidationResult validate(@NonNull String fieldName) {
+        BeanValidationResult result = new BeanValidationResult(fieldName, this);
 
-        if (key.isNullKey()) {
-            result.addValidationMessage(
-                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
-        }
+        result.addResult(validateKeyNotNull("key", key));
 
-        result = key.validate(result);
+        result.addResult(validateNotBlank("description", description, false));
+        result.addResult(validateNotBlank("eventType", eventType, true));
 
-        if (description != null && description.trim().length() == 0) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "trigger description may not be blank"));
-        }
-
-        if (!ParameterValidationUtils.validateStringParameter(eventType)) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "event type on trigger must be defined"));
-        }
-
-        result = validateOptionalFields(result);
+        validateOptional(result, "schedule", schedule);
+        validateOptional(result, "targetFilter", targetFilter);
 
         if (evaluations < 0) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "evaluations on trigger must be zero or a positive integer"));
+            addResult(result, "evaluations", evaluations, "is negative");
         }
 
-        if (method != null && method.trim().length() == 0) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "method on trigger may not be blank"));
-        }
-
-        if (!ParameterValidationUtils.validateStringParameter(action)) {
-            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
-                    "action on trigger must be defined"));
-        }
-
-        return result;
-    }
-
-    /**
-     * Validate optional fields.
-     *
-     * @param resultIn the validation result so far
-     * @return the validation resutls including these fields
-     */
-    private PfValidationResult validateOptionalFields(final PfValidationResult resultIn) {
-        PfValidationResult result = resultIn;
-
-        result = (schedule != null ? schedule.validate(result) : result);
-        result = (targetFilter != null ? targetFilter.validate(result) : result);
+        result.addResult(validateNotBlank("method", method, false));
+        result.addResult(validateNotBlank("action", action, true));
 
         return result;
     }
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java
index 459a329..8fb4a77 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -26,13 +27,13 @@
 import javax.ws.rs.core.Response;
 import lombok.NonNull;
 import org.apache.commons.collections4.CollectionUtils;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptFilter;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfModelException;
 import org.onap.policy.models.base.PfModelRuntimeException;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.dao.PfDao;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
 import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType;
@@ -107,9 +108,9 @@
                 ToscaServiceTemplateUtils.addFragment(dbServiceTemplate, incomingServiceTemplateFragment);
         }
 
-        PfValidationResult result = serviceTemplateToWrite.validate(new PfValidationResult());
+        BeanValidationResult result = serviceTemplateToWrite.validate("service template");
         if (!result.isValid()) {
-            throw new PfModelRuntimeException(Response.Status.NOT_ACCEPTABLE, result.toString());
+            throw new PfModelRuntimeException(Response.Status.NOT_ACCEPTABLE, result.getResult());
         }
 
         new SimpleToscaServiceTemplateProvider().write(dao, serviceTemplateToWrite);
@@ -454,9 +455,11 @@
                 POLICY_TYPE + policyTypeKey.getId() + NOT_FOUND);
         }
 
+        BeanValidationResult result = new BeanValidationResult("policy types", serviceTemplate);
+
         for (JpaToscaPolicyType policyType : serviceTemplate.getPolicyTypes().getAll(null)) {
             Collection<JpaToscaEntityType<ToscaEntity>> ancestorList = ToscaUtils
-                .getEntityTypeAncestors(serviceTemplate.getPolicyTypes(), policyType, new PfValidationResult());
+                .getEntityTypeAncestors(serviceTemplate.getPolicyTypes(), policyType, result);
 
             if (ancestorList.contains(policyType4Deletion)) {
                 throw new PfModelRuntimeException(Response.Status.NOT_ACCEPTABLE, POLICY_TYPE + policyTypeKey.getId()
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtils.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtils.java
index 7bf4d29..fe52993 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtils.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtils.java
@@ -25,12 +25,11 @@
 import java.util.Map.Entry;
 import javax.ws.rs.core.Response;
 import lombok.NonNull;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConceptContainer;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfModelRuntimeException;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
 import org.onap.policy.models.tosca.simple.concepts.JpaToscaEntityType;
 import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
@@ -57,12 +56,13 @@
      */
     public static JpaToscaServiceTemplate addFragment(@NonNull final JpaToscaServiceTemplate originalTemplate,
             @NonNull final JpaToscaServiceTemplate fragmentTemplate) {
-        PfValidationResult result = new PfValidationResult();
+
+        BeanValidationResult result = new BeanValidationResult("incoming fragment", fragmentTemplate);
 
         if (originalTemplate.compareToWithoutEntities(fragmentTemplate) != 0) {
-            result.addValidationMessage(new PfValidationMessage(originalTemplate.getKey(),
-                    ToscaServiceTemplateUtils.class, ValidationResult.INVALID,
-                    "service template in incoming fragment does not equal existing service template"));
+            Validated.addResult(result, "service template",
+                            originalTemplate.getKey(),
+                            "does not equal existing service template");
         }
 
         JpaToscaServiceTemplate compositeTemplate = new JpaToscaServiceTemplate(originalTemplate);
@@ -79,20 +79,20 @@
                         .setPolicies(addFragmentEntitites(compositeTemplate.getTopologyTemplate().getPolicies(),
                                 fragmentTemplate.getTopologyTemplate().getPolicies(), result));
             } else {
-                result.addValidationMessage(new PfValidationMessage(originalTemplate.getTopologyTemplate().getKey(),
-                        ToscaServiceTemplateUtils.class, ValidationResult.INVALID,
-                        "topology template in incoming fragment does not equal existing topology template"));
+                Validated.addResult(result, "topology template",
+                                originalTemplate.getTopologyTemplate().getKey(),
+                                "does not equal existing topology template");
             }
         } else if (fragmentTemplate.getTopologyTemplate() != null) {
             compositeTemplate.setTopologyTemplate(new JpaToscaTopologyTemplate(fragmentTemplate.getTopologyTemplate()));
         }
 
         if (result.isValid()) {
-            result = compositeTemplate.validate(result);
+            result.addResult(compositeTemplate.validate("composite template"));
         }
 
         if (!result.isValid()) {
-            String message = result.toString();
+            String message = result.getResult();
             throw new PfModelRuntimeException(Response.Status.NOT_ACCEPTABLE, message);
         }
 
@@ -113,7 +113,7 @@
     private static
         <S extends PfConceptContainer<? extends JpaToscaEntityType<? extends ToscaEntity>, ? extends ToscaEntity>>
             S addFragmentEntitites(final S compositeContainer, final S fragmentContainer,
-                    final PfValidationResult result) {
+                    final BeanValidationResult result) {
 
         if (compositeContainer == null) {
             return fragmentContainer;
@@ -123,17 +123,22 @@
             return compositeContainer;
         }
 
+        BeanValidationResult result2 = new BeanValidationResult("incoming fragment", fragmentContainer);
+
         for (Entry<PfConceptKey, ? extends JpaToscaEntityType<? extends ToscaEntity>> fragmentEntry : fragmentContainer
                 .getConceptMap().entrySet()) {
             JpaToscaEntityType<? extends ToscaEntity> containerEntity =
                     compositeContainer.getConceptMap().get(fragmentEntry.getKey());
             if (containerEntity != null && containerEntity.compareTo(fragmentEntry.getValue()) != 0) {
-                result.addValidationMessage(new PfValidationMessage(fragmentEntry.getKey(),
-                        ToscaServiceTemplateUtils.class,
-                        ValidationResult.INVALID, "entity in incoming fragment does not equal existing entity"));
+                Validated.addResult(result, "entity", fragmentEntry.getKey(),
+                                "does not equal existing entity");
             }
         }
 
+        if (!result2.isClean()) {
+            result.addResult(result2);
+        }
+
         // This use of a generic map is required to get around typing errors in directly adding the fragment map to the
         // original map
         @SuppressWarnings("rawtypes")
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java
index 70c5027..b806e41 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -27,15 +28,16 @@
 import javax.ws.rs.core.Response;
 import lombok.NonNull;
 import org.apache.commons.collections4.CollectionUtils;
+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.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptContainer;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfModelRuntimeException;
 import org.onap.policy.models.base.PfNameVersion;
-import org.onap.policy.models.base.PfValidationMessage;
-import org.onap.policy.models.base.PfValidationResult;
-import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
 import org.onap.policy.models.tosca.simple.concepts.JpaToscaEntityType;
 import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
@@ -219,7 +221,7 @@
      */
     public static Collection<JpaToscaEntityType<ToscaEntity>> getEntityTypeAncestors(
         @NonNull PfConceptContainer<? extends PfConcept, ? extends PfNameVersion> entityTypes,
-        @NonNull JpaToscaEntityType<?> entityType, @NonNull final PfValidationResult result) {
+        @NonNull JpaToscaEntityType<?> entityType, @NonNull final BeanValidationResult result) {
 
         PfConceptKey parentEntityTypeKey = entityType.getDerivedFrom();
         if (parentEntityTypeKey == null || parentEntityTypeKey.getName().endsWith(ROOT_KEY_NAME_SUFFIX)) {
@@ -227,9 +229,9 @@
         }
 
         if (entityType.getKey().equals(parentEntityTypeKey)) {
-            result.addValidationMessage(new PfValidationMessage(entityType.getKey(), ToscaUtils.class,
-                ValidationResult.INVALID, "entity cannot be an ancestor of itself"));
-            throw new PfModelRuntimeException(Response.Status.CONFLICT, result.toString());
+            result.addResult(new ObjectValidationResult("entity type", entityType.getKey().getId(),
+                            ValidationStatus.INVALID, "ancestor of itself"));
+            throw new PfModelRuntimeException(Response.Status.CONFLICT, result.getResult());
         }
 
         @SuppressWarnings("unchecked")
@@ -237,8 +239,8 @@
             .getAll(parentEntityTypeKey.getName(), parentEntityTypeKey.getVersion());
         Set<JpaToscaEntityType<ToscaEntity>> ancestorEntitySetToReturn = new HashSet<>(ancestorEntitySet);
         if (ancestorEntitySet.isEmpty()) {
-            result.addValidationMessage(new PfValidationMessage(entityType.getKey(), ToscaUtils.class,
-                ValidationResult.INVALID, "parent " + parentEntityTypeKey.getId() + " of entity not found"));
+            result.addResult(new ObjectValidationResult("parent", parentEntityTypeKey.getId(),
+                            ValidationStatus.INVALID, Validated.NOT_FOUND));
         } else {
             for (JpaToscaEntityType<?> filteredEntityType : ancestorEntitySet) {
                 ancestorEntitySetToReturn.addAll(getEntityTypeAncestors(entityTypes, filteredEntityType, result));
@@ -258,7 +260,7 @@
         @NonNull final PfConceptContainer<? extends PfConcept, ? extends PfNameVersion> entityTypes,
         final String entityName, final String entityVersion) {
 
-        PfValidationResult result = new PfValidationResult();
+        BeanValidationResult result = new BeanValidationResult("entity", entityName);
 
         @SuppressWarnings("unchecked")
         Set<JpaToscaEntityType<?>> filteredEntitySet =
@@ -270,7 +272,7 @@
         }
 
         if (!result.isValid()) {
-            throw new PfModelRuntimeException(Response.Status.NOT_ACCEPTABLE, result.toString());
+            throw new PfModelRuntimeException(Response.Status.NOT_ACCEPTABLE, result.getResult());
         }
 
         entityTypes.getConceptMap().entrySet()
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/ToscaServiceTemplateMappingTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/ToscaServiceTemplateMappingTest.java
index 5258053..c4d9039 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/ToscaServiceTemplateMappingTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/ToscaServiceTemplateMappingTest.java
@@ -31,7 +31,6 @@
 import org.onap.policy.common.utils.coder.StandardCoder;
 import org.onap.policy.common.utils.coder.YamlJsonTranslator;
 import org.onap.policy.common.utils.resources.ResourceUtils;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
 import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
@@ -72,7 +71,7 @@
         JpaToscaServiceTemplate internalServiceTemplate =
                 ToscaServiceTemplateUtils.addFragment(policyTypeServiceTemplate, policyFragmentServiceTemplate);
 
-        assertTrue(internalServiceTemplate.validate(new PfValidationResult()).isValid());
+        assertTrue(internalServiceTemplate.validate("").isValid());
         ToscaServiceTemplate plainPolicies2 = internalServiceTemplate.toAuthorative();
 
         ToscaPolicy pp1 = plainPolicies.getToscaTopologyTemplate().getPolicies().get(0).values().iterator().next();
@@ -92,11 +91,11 @@
         ToscaServiceTemplate plainPolicyTypes = standardCoder.decode(yamlAsJsonString, ToscaServiceTemplate.class);
         JpaToscaServiceTemplate internalPolicyTypes = new JpaToscaServiceTemplate();
         internalPolicyTypes.fromAuthorative(plainPolicyTypes);
-        assertTrue(internalPolicyTypes.validate(new PfValidationResult()).isValid());
+        assertTrue(internalPolicyTypes.validate("").isValid());
         ToscaServiceTemplate plainPolicyTypes2 = internalPolicyTypes.toAuthorative();
         JpaToscaServiceTemplate internalPolicyTypes2 = new JpaToscaServiceTemplate();
         internalPolicyTypes2.fromAuthorative(plainPolicyTypes2);
-        assertTrue(internalPolicyTypes2.validate(new PfValidationResult()).isValid());
+        assertTrue(internalPolicyTypes2.validate("").isValid());
         assertEquals(0, internalPolicyTypes.compareTo(internalPolicyTypes2));
     }
 }
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignmentTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignmentTest.java
index ee2fee8..9637d42 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignmentTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaCapabilityAssignmentTest.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -31,7 +32,7 @@
 import java.util.Map;
 import org.junit.Test;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaCapabilityAssignment;
 
 /**
@@ -69,7 +70,7 @@
         assertEquals(caKey, ca.getKeys().get(0));
 
         ca.clean();
-        ca.validate(new PfValidationResult());
+        ca.validate("");
         assertThat(ca.getProperties()).isNullOrEmpty();
         assertThat(ca.getAttributes()).isNullOrEmpty();
 
@@ -77,7 +78,7 @@
         ca.setAttributes(null);
         ca.setOccurrences(null);
         ca.clean();
-        ca.validate(new PfValidationResult());
+        ca.validate("");
         assertEquals(null, ca.getProperties());
         assertEquals(null, ca.getAttributes());
 
@@ -94,7 +95,7 @@
         ca.setOccurrences(occurrences);
 
         ca.clean();
-        ca.validate(new PfValidationResult());
+        ca.validate("");
         assertEquals("Untrimmed Value", ca.getProperties().get("Key0"));
         assertEquals("Untrimmed Value", ca.getAttributes().get("Key0"));
 
@@ -102,10 +103,10 @@
         ca.getAttributes().put("Key1", null);
         ca.getOccurrences().add(null);
         ca.getOccurrences().add(-12345);
-        PfValidationResult result = ca.validate(new PfValidationResult());
-        assertThat(result.toString()).contains("capability assignment property Key1 value may not be null");
-        assertThat(result.toString()).contains("capability assignment attribute Key1 value may not be null");
-        assertThat(result.toString()).contains("capability assignment occurrence value may not be negative");
+        assertThat(ca.validate("").getResult())
+            .contains("properties").contains("Key1").contains(Validated.IS_NULL)
+            .contains("attributes").contains("Key1").contains(Validated.IS_NULL)
+            .contains("occurrence").contains("value").contains("is below the minimum value: 0");
     }
 
     @Test
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypeTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypeTest.java
index 7168f48..44bc534 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypeTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypeTest.java
@@ -36,7 +36,6 @@
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaConstraint;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaDataType;
 
@@ -109,22 +108,22 @@
         tdt.clean();
         assertEquals(tdtClone0, tdt);
 
-        assertFalse(new JpaToscaDataType().validate(new PfValidationResult()).isValid());
-        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+        assertFalse(new JpaToscaDataType().validate("").isValid());
+        assertTrue(tdt.validate("").isValid());
 
         tdt.getConstraints().add(null);
-        assertFalse(tdt.validate(new PfValidationResult()).isValid());
+        assertFalse(tdt.validate("").isValid());
         tdt.getConstraints().remove(null);
-        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+        assertTrue(tdt.validate("").isValid());
 
         tdt.getProperties().put(null, null);
-        assertFalse(tdt.validate(new PfValidationResult()).isValid());
+        assertFalse(tdt.validate("").isValid());
         tdt.getProperties().remove(null);
-        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+        assertTrue(tdt.validate("").isValid());
 
         assertThatThrownBy(() -> {
             tdt.validate(null);
-        }).hasMessageMatching("result is marked .*on.*ull but is null");
+        }).hasMessageMatching("fieldName is marked .*on.*ull but is null");
 
         ToscaDataType dat = new ToscaDataType();
         dat.setName("name");
@@ -153,21 +152,21 @@
 
         JpaToscaProperty prop0 = new JpaToscaProperty(new PfReferenceKey(dt0.getKey(), "prop0"));
         prop0.setType(new PfConceptKey("string", PfKey.NULL_KEY_VERSION));
-        assertTrue(prop0.validate(new PfValidationResult()).isValid());
+        assertTrue(prop0.validate("").isValid());
 
         dt0.getProperties().put(prop0.getKey().getLocalName(), prop0);
         assertTrue(dt0.getReferencedDataTypes().isEmpty());
 
         JpaToscaProperty prop1 = new JpaToscaProperty(new PfReferenceKey(dt0.getKey(), "prop1"));
         prop1.setType(new PfConceptKey("the.property.Type0", "0.0.1"));
-        assertTrue(prop1.validate(new PfValidationResult()).isValid());
+        assertTrue(prop1.validate("").isValid());
 
         dt0.getProperties().put(prop1.getKey().getLocalName(), prop1);
         assertEquals(1, dt0.getReferencedDataTypes().size());
 
         JpaToscaProperty prop2 = new JpaToscaProperty(new PfReferenceKey(dt0.getKey(), "prop2"));
         prop2.setType(new PfConceptKey("the.property.Type0", "0.0.1"));
-        assertTrue(prop2.validate(new PfValidationResult()).isValid());
+        assertTrue(prop2.validate("").isValid());
 
         dt0.getProperties().put(prop2.getKey().getLocalName(), prop2);
         assertEquals(1, dt0.getReferencedDataTypes().size());
@@ -176,7 +175,7 @@
         prop3.setType(new PfConceptKey("the.property.Type1", "0.0.1"));
         prop3.setEntrySchema(new JpaToscaSchemaDefinition());
         prop3.getEntrySchema().setType(new PfConceptKey("the.property.Type3", "0.0.1"));
-        assertTrue(prop3.validate(new PfValidationResult()).isValid());
+        assertTrue(prop3.validate("").isValid());
 
         dt0.getProperties().put(prop3.getKey().getLocalName(), prop3);
         assertEquals(3, dt0.getReferencedDataTypes().size());
@@ -185,7 +184,7 @@
         prop4.setType(new PfConceptKey("the.property.Type1", "0.0.1"));
         prop4.setEntrySchema(new JpaToscaSchemaDefinition());
         prop4.getEntrySchema().setType(new PfConceptKey("the.property.Type2", "0.0.1"));
-        assertTrue(prop4.validate(new PfValidationResult()).isValid());
+        assertTrue(prop4.validate("").isValid());
 
         dt0.getProperties().put(prop4.getKey().getLocalName(), prop4);
         assertEquals(3, dt0.getReferencedDataTypes().size());
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypesTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypesTest.java
index 910db36..83d0403 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypesTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypesTest.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2020 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -33,8 +33,9 @@
 import java.util.Map;
 import java.util.TreeMap;
 import org.junit.Test;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaDataType;
 
 public class JpaToscaDataTypesTest {
@@ -71,23 +72,24 @@
 
         dtMapList.get(0).put("dt0", dt0);
         assertNotNull(new JpaToscaDataTypes(dtMapList));
-        assertTrue(new JpaToscaDataTypes(dtMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaDataTypes(dtMapList).validate("").isValid());
         assertThatThrownBy(() -> new JpaToscaDataTypes(dtMapList).validate(null))
-                .hasMessageMatching("resultIn is marked .*on.*ull but is null");
+                .hasMessageMatching("fieldName is marked .*on.*ull but is null");
 
         dt0.setDerivedFrom(null);
-        assertTrue(new JpaToscaDataTypes(dtMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaDataTypes(dtMapList).validate("").isValid());
 
         dt0.setDerivedFrom("tosca.datatypes.Root");
-        assertTrue(new JpaToscaDataTypes(dtMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaDataTypes(dtMapList).validate("").isValid());
 
         dt0.setDerivedFrom("some.other.Thing");
-        PfValidationResult result = new JpaToscaDataTypes(dtMapList).validate(new PfValidationResult());
+        BeanValidationResult result = new JpaToscaDataTypes(dtMapList).validate("");
         assertFalse(result.isValid());
-        assertThat(result.toString()).contains("parent some.other.Thing:0.0.0 of entity not found");
+        assertThat(result.getResult()).contains("parent").contains("some.other.Thing:0.0.0")
+                        .contains(Validated.NOT_FOUND);
 
         dt0.setDerivedFrom(null);
-        assertTrue(new JpaToscaDataTypes(dtMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaDataTypes(dtMapList).validate("").isValid());
 
         ToscaDataType dt1 = new ToscaDataType();
         dt1.setName("dt1");
@@ -95,17 +97,17 @@
         dt1.setDescription("dt1 description");
 
         dtMapList.get(0).put("dt1", dt1);
-        assertTrue(new JpaToscaDataTypes(dtMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaDataTypes(dtMapList).validate("").isValid());
 
         dt1.setDerivedFrom("dt0");
-        assertTrue(new JpaToscaDataTypes(dtMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaDataTypes(dtMapList).validate("").isValid());
 
         dt1.setDerivedFrom("dt2");
-        result = new JpaToscaDataTypes(dtMapList).validate(new PfValidationResult());
+        result = new JpaToscaDataTypes(dtMapList).validate("");
         assertFalse(result.isValid());
-        assertThat(result.toString()).contains("parent dt2:0.0.0 of entity not found");
+        assertThat(result.getResult()).contains("parent").contains("dt2:0.0.0").contains(Validated.NOT_FOUND);
 
         dt1.setDerivedFrom("dt0");
-        assertTrue(new JpaToscaDataTypes(dtMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaDataTypes(dtMapList).validate("").isValid());
     }
 }
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilterTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilterTest.java
index f07a182..ecffec8 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilterTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilterTest.java
@@ -31,7 +31,6 @@
 import org.junit.Test;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationResult;
 
 /**
  * DAO test for ToscaEventFilter.
@@ -107,30 +106,30 @@
         tef.clean();
         assertEquals(tdtClone0, tef);
 
-        assertFalse(new JpaToscaEventFilter().validate(new PfValidationResult()).isValid());
-        assertTrue(tef.validate(new PfValidationResult()).isValid());
+        assertFalse(new JpaToscaEventFilter().validate("").isValid());
+        assertTrue(tef.validate("").isValid());
 
         tef.setRequirement(null);
-        assertTrue(tef.validate(new PfValidationResult()).isValid());
+        assertTrue(tef.validate("").isValid());
         tef.setRequirement("");
-        assertFalse(tef.validate(new PfValidationResult()).isValid());
+        assertFalse(tef.validate("").isValid());
         tef.setRequirement(A_REQUREMENT);
-        assertTrue(tef.validate(new PfValidationResult()).isValid());
+        assertTrue(tef.validate("").isValid());
 
         tef.setCapability(null);
-        assertTrue(tef.validate(new PfValidationResult()).isValid());
+        assertTrue(tef.validate("").isValid());
         tef.setCapability("");
-        assertFalse(tef.validate(new PfValidationResult()).isValid());
+        assertFalse(tef.validate("").isValid());
         tef.setCapability(A_CAPABILITY);
-        assertTrue(tef.validate(new PfValidationResult()).isValid());
+        assertTrue(tef.validate("").isValid());
 
         tef.setNode(null);
-        assertFalse(tef.validate(new PfValidationResult()).isValid());
+        assertFalse(tef.validate("").isValid());
         tef.setNode(PfConceptKey.getNullKey());
-        assertFalse(tef.validate(new PfValidationResult()).isValid());
+        assertFalse(tef.validate("").isValid());
         tef.setNode(nodeKey);
-        assertTrue(tef.validate(new PfValidationResult()).isValid());
+        assertTrue(tef.validate("").isValid());
 
-        assertThatThrownBy(() -> tef.validate(null)).hasMessageMatching("resultIn is marked .*on.*ull but is null");
+        assertThatThrownBy(() -> tef.validate(null)).hasMessageMatching("fieldName is marked .*on.*ull but is null");
     }
 }
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModelTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModelTest.java
index 61118c4..f0f42e6 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModelTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModelTest.java
@@ -33,7 +33,6 @@
 import org.junit.Test;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfModelService;
-import org.onap.policy.models.base.PfValidationResult;
 
 /**
  * DAO test for ToscaDatatype.
@@ -101,13 +100,13 @@
         tm.clean();
         assertEquals(tttClone0, tm);
 
-        assertFalse(new JpaToscaModel().validate(new PfValidationResult()).isValid());
-        assertTrue(tm.validate(new PfValidationResult()).isValid());
+        assertFalse(new JpaToscaModel().validate("").isValid());
+        assertTrue(tm.validate("").isValid());
 
         tm.register();
         assertTrue(PfModelService.existsModel(tm.getServiceTemplates().getId()));
         PfModelService.deregisterModel(tm.getServiceTemplates().getId());
 
-        assertThatThrownBy(() -> tm.validate(null)).hasMessageMatching("resultIn is marked .*on.*ull but is null");
+        assertThatThrownBy(() -> tm.validate(null)).hasMessageMatching("fieldName is marked .*on.*ull but is null");
     }
 }
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPoliciesTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPoliciesTest.java
index 47e3433..15bde0b 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPoliciesTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPoliciesTest.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2020 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -33,8 +33,9 @@
 import java.util.Map;
 import java.util.TreeMap;
 import org.junit.Test;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
 
 public class JpaToscaPoliciesTest {
@@ -73,23 +74,24 @@
 
         polMapList.get(0).put("pol0", pol0);
         assertNotNull(new JpaToscaPolicies(polMapList));
-        assertTrue(new JpaToscaPolicies(polMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaPolicies(polMapList).validate("").isValid());
         assertThatThrownBy(() -> new JpaToscaPolicies(polMapList).validate(null))
-                .hasMessageMatching("resultIn is marked .*on.*ull but is null");
+                .hasMessageMatching("fieldName is marked .*on.*ull but is null");
 
         pol0.setDerivedFrom(null);
-        assertTrue(new JpaToscaPolicies(polMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaPolicies(polMapList).validate("").isValid());
 
         pol0.setDerivedFrom("tosca.Policies.Root");
-        assertTrue(new JpaToscaPolicies(polMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaPolicies(polMapList).validate("").isValid());
 
         pol0.setDerivedFrom("some.other.Thing");
-        PfValidationResult result = new JpaToscaPolicies(polMapList).validate(new PfValidationResult());
+        BeanValidationResult result = new JpaToscaPolicies(polMapList).validate("");
         assertFalse(result.isValid());
-        assertThat(result.toString()).contains("parent some.other.Thing:0.0.0 of entity not found");
+        assertThat(result.getResult()).contains("parent").contains("some.other.Thing:0.0.0")
+                        .contains(Validated.NOT_FOUND);
 
         pol0.setDerivedFrom(null);
-        assertTrue(new JpaToscaPolicies(polMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaPolicies(polMapList).validate("").isValid());
 
         ToscaPolicy pol1 = new ToscaPolicy();
         pol1.setName("pol1");
@@ -99,17 +101,17 @@
         pol1.setTypeVersion("0.0.1");
 
         polMapList.get(0).put("pol1", pol1);
-        assertTrue(new JpaToscaPolicies(polMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaPolicies(polMapList).validate("").isValid());
 
         pol1.setDerivedFrom("pol0");
-        assertTrue(new JpaToscaPolicies(polMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaPolicies(polMapList).validate("").isValid());
 
         pol1.setDerivedFrom("pol2");
-        result = new JpaToscaPolicies(polMapList).validate(new PfValidationResult());
+        result = new JpaToscaPolicies(polMapList).validate("");
         assertFalse(result.isValid());
-        assertThat(result.toString()).contains("parent pol2:0.0.0 of entity not found");
+        assertThat(result.getResult()).contains("parent").contains("pol2:0.0.0").contains(Validated.NOT_FOUND);
 
         pol1.setDerivedFrom("pol0");
-        assertTrue(new JpaToscaPolicies(polMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaPolicies(polMapList).validate("").isValid());
     }
 }
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTest.java
index 7f35622..48bcb0b 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTest.java
@@ -37,7 +37,6 @@
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
 
 /**
@@ -130,41 +129,41 @@
         tp.clean();
         assertEquals(tdtClone0, tp);
 
-        assertFalse(new JpaToscaPolicy().validate(new PfValidationResult()).isValid());
-        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        assertFalse(new JpaToscaPolicy().validate("").isValid());
+        assertTrue(tp.validate("").isValid());
 
         tp.getProperties().put(null, null);
-        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        assertFalse(tp.validate("").isValid());
         tp.getProperties().remove(null);
-        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        assertTrue(tp.validate("").isValid());
 
         tp.getProperties().put("Key", null);
-        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        assertFalse(tp.validate("").isValid());
         tp.getProperties().remove("Key");
-        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        assertTrue(tp.validate("").isValid());
 
         tp.getProperties().put(null, "Value");
-        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        assertFalse(tp.validate("").isValid());
         tp.getProperties().remove(null);
-        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        assertTrue(tp.validate("").isValid());
 
         tp.getTargets().add(null);
-        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        assertFalse(tp.validate("").isValid());
         tp.getTargets().remove(null);
-        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        assertTrue(tp.validate("").isValid());
 
         PfConceptKey tpTypeKey = tp.getKey();
         assertNotNull(tpTypeKey);
         tp.setType(null);
-        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        assertFalse(tp.validate("").isValid());
         tp.setType(PfConceptKey.getNullKey());
-        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        assertFalse(tp.validate("").isValid());
         tp.setType(tpTypeKey);
-        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        assertTrue(tp.validate("").isValid());
 
         assertThatThrownBy(() -> {
             tp.validate(null);
-        }).hasMessageMatching("resultIn is marked .*on.*ull but is null");
+        }).hasMessageMatching("fieldName is marked .*on.*ull but is null");
 
         assertNotNull(tp.toAuthorative());
         tp.getType().setVersion(PfKey.NULL_KEY_VERSION);
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypeTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypeTest.java
index 43cacda..b2f59c4 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypeTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypeTest.java
@@ -37,7 +37,6 @@
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
 import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
 
@@ -132,46 +131,46 @@
         tpt.clean();
         assertEquals(tdtClone0, tpt);
 
-        assertFalse(new JpaToscaPolicyType().validate(new PfValidationResult()).isValid());
-        assertTrue(tpt.validate(new PfValidationResult()).isValid());
+        assertFalse(new JpaToscaPolicyType().validate("").isValid());
+        assertTrue(tpt.validate("").isValid());
 
         tpt.getProperties().put(null, null);
-        assertFalse(tpt.validate(new PfValidationResult()).isValid());
+        assertFalse(tpt.validate("").isValid());
         tpt.getProperties().remove(null);
-        assertTrue(tpt.validate(new PfValidationResult()).isValid());
+        assertTrue(tpt.validate("").isValid());
 
         tpt.getTargets().add(null);
-        assertFalse(tpt.validate(new PfValidationResult()).isValid());
+        assertFalse(tpt.validate("").isValid());
         tpt.getTargets().remove(null);
-        assertTrue(tpt.validate(new PfValidationResult()).isValid());
+        assertTrue(tpt.validate("").isValid());
 
         tpt.getTriggers().add(null);
-        assertFalse(tpt.validate(new PfValidationResult()).isValid());
+        assertFalse(tpt.validate("").isValid());
         tpt.getTriggers().remove(null);
-        assertTrue(tpt.validate(new PfValidationResult()).isValid());
+        assertTrue(tpt.validate("").isValid());
 
         tpt.getMetadata().put(null, null);
-        assertFalse(tpt.validate(new PfValidationResult()).isValid());
+        assertFalse(tpt.validate("").isValid());
         tpt.getMetadata().remove(null);
-        assertTrue(tpt.validate(new PfValidationResult()).isValid());
+        assertTrue(tpt.validate("").isValid());
 
         tpt.getMetadata().put("nullKey", null);
-        assertFalse(tpt.validate(new PfValidationResult()).isValid());
+        assertFalse(tpt.validate("").isValid());
         tpt.getMetadata().remove("nullKey");
-        assertTrue(tpt.validate(new PfValidationResult()).isValid());
+        assertTrue(tpt.validate("").isValid());
 
         tpt.setDescription("");
 
-        assertFalse(tpt.validate(new PfValidationResult()).isValid());
+        assertFalse(tpt.validate("").isValid());
         tpt.setDescription(A_DESCRIPTION);
-        assertTrue(tpt.validate(new PfValidationResult()).isValid());
+        assertTrue(tpt.validate("").isValid());
 
         tpt.setDerivedFrom(PfConceptKey.getNullKey());
-        assertFalse(tpt.validate(new PfValidationResult()).isValid());
+        assertFalse(tpt.validate("").isValid());
         tpt.setDerivedFrom(derivedFromKey);
-        assertTrue(tpt.validate(new PfValidationResult()).isValid());
+        assertTrue(tpt.validate("").isValid());
 
-        assertThatThrownBy(() -> tpt.validate(null)).hasMessageMatching("resultIn is marked .*on.*ull but is null");
+        assertThatThrownBy(() -> tpt.validate(null)).hasMessageMatching("fieldName is marked .*on.*ull but is null");
 
         assertThatThrownBy(() -> new JpaToscaEntityType<ToscaPolicy>((PfConceptKey) null))
                 .hasMessageMatching("key is marked .*on.*ull but is null");
@@ -200,21 +199,21 @@
 
         JpaToscaProperty prop0 = new JpaToscaProperty(new PfReferenceKey(pt0.getKey(), "prop0"));
         prop0.setType(new PfConceptKey("string", PfKey.NULL_KEY_VERSION));
-        assertTrue(prop0.validate(new PfValidationResult()).isValid());
+        assertTrue(prop0.validate("").isValid());
 
         pt0.getProperties().put(prop0.getKey().getLocalName(), prop0);
         assertTrue(pt0.getReferencedDataTypes().isEmpty());
 
         JpaToscaProperty prop1 = new JpaToscaProperty(new PfReferenceKey(pt0.getKey(), "prop1"));
         prop1.setType(new PfConceptKey("the.property.Type0", "0.0.1"));
-        assertTrue(prop1.validate(new PfValidationResult()).isValid());
+        assertTrue(prop1.validate("").isValid());
 
         pt0.getProperties().put(prop1.getKey().getLocalName(), prop1);
         assertEquals(1, pt0.getReferencedDataTypes().size());
 
         JpaToscaProperty prop2 = new JpaToscaProperty(new PfReferenceKey(pt0.getKey(), "prop2"));
         prop2.setType(new PfConceptKey("the.property.Type0", "0.0.1"));
-        assertTrue(prop2.validate(new PfValidationResult()).isValid());
+        assertTrue(prop2.validate("").isValid());
 
         pt0.getProperties().put(prop2.getKey().getLocalName(), prop2);
         assertEquals(1, pt0.getReferencedDataTypes().size());
@@ -223,7 +222,7 @@
         prop3.setType(new PfConceptKey("the.property.Type1", "0.0.1"));
         prop3.setEntrySchema(new JpaToscaSchemaDefinition());
         prop3.getEntrySchema().setType(new PfConceptKey("the.property.Type3", "0.0.1"));
-        assertTrue(prop3.validate(new PfValidationResult()).isValid());
+        assertTrue(prop3.validate("").isValid());
 
         pt0.getProperties().put(prop3.getKey().getLocalName(), prop3);
         assertEquals(3, pt0.getReferencedDataTypes().size());
@@ -232,7 +231,7 @@
         prop4.setType(new PfConceptKey("the.property.Type1", "0.0.1"));
         prop4.setEntrySchema(new JpaToscaSchemaDefinition());
         prop4.getEntrySchema().setType(new PfConceptKey("the.property.Type2", "0.0.1"));
-        assertTrue(prop4.validate(new PfValidationResult()).isValid());
+        assertTrue(prop4.validate("").isValid());
 
         pt0.getProperties().put(prop4.getKey().getLocalName(), prop4);
         assertEquals(3, pt0.getReferencedDataTypes().size());
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypesTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypesTest.java
index bbd407a..76f91c5 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypesTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypesTest.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2020 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -33,8 +33,9 @@
 import java.util.Map;
 import java.util.TreeMap;
 import org.junit.Test;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
 
 public class JpaToscaPolicyTypesTest {
@@ -71,23 +72,24 @@
 
         ptMapList.get(0).put("pt0", pt0);
         assertNotNull(new JpaToscaPolicyTypes(ptMapList));
-        assertTrue(new JpaToscaPolicyTypes(ptMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaPolicyTypes(ptMapList).validate("").isValid());
         assertThatThrownBy(() -> new JpaToscaPolicyTypes(ptMapList).validate(null))
-                .hasMessageMatching("resultIn is marked .*on.*ull but is null");
+                .hasMessageMatching("fieldName is marked .*on.*ull but is null");
 
         pt0.setDerivedFrom(null);
-        assertTrue(new JpaToscaPolicyTypes(ptMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaPolicyTypes(ptMapList).validate("").isValid());
 
         pt0.setDerivedFrom("tosca.PolicyTypes.Root");
-        assertTrue(new JpaToscaPolicyTypes(ptMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaPolicyTypes(ptMapList).validate("").isValid());
 
         pt0.setDerivedFrom("some.other.Thing");
-        PfValidationResult result = new JpaToscaPolicyTypes(ptMapList).validate(new PfValidationResult());
+        BeanValidationResult result = new JpaToscaPolicyTypes(ptMapList).validate("");
         assertFalse(result.isValid());
-        assertThat(result.toString()).contains("parent some.other.Thing:0.0.0 of entity not found");
+        assertThat(result.getResult()).contains("parent").contains("some.other.Thing:0.0.0")
+                        .contains(Validated.NOT_FOUND);
 
         pt0.setDerivedFrom(null);
-        assertTrue(new JpaToscaPolicyTypes(ptMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaPolicyTypes(ptMapList).validate("").isValid());
 
         ToscaPolicyType pt1 = new ToscaPolicyType();
         pt1.setName("pt1");
@@ -95,17 +97,17 @@
         pt1.setDescription("pt1 description");
 
         ptMapList.get(0).put("pt1", pt1);
-        assertTrue(new JpaToscaPolicyTypes(ptMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaPolicyTypes(ptMapList).validate("").isValid());
 
         pt1.setDerivedFrom("pt0");
-        assertTrue(new JpaToscaPolicyTypes(ptMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaPolicyTypes(ptMapList).validate("").isValid());
 
         pt1.setDerivedFrom("pt2");
-        result = new JpaToscaPolicyTypes(ptMapList).validate(new PfValidationResult());
+        result = new JpaToscaPolicyTypes(ptMapList).validate("");
         assertFalse(result.isValid());
-        assertThat(result.toString()).contains("parent pt2:0.0.0 of entity not found");
+        assertThat(result.getResult()).contains("parent").contains("pt2:0.0.0").contains(Validated.NOT_FOUND);
 
         pt1.setDerivedFrom("pt0");
-        assertTrue(new JpaToscaPolicyTypes(ptMapList).validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaPolicyTypes(ptMapList).validate("").isValid());
     }
 }
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPropertyTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPropertyTest.java
index 0fa0d3f..b828881 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPropertyTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPropertyTest.java
@@ -36,7 +36,6 @@
 import org.junit.Test;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
 
 /**
@@ -158,42 +157,42 @@
         tp.clean();
         assertEquals(tdtClone0, tp);
 
-        assertFalse(new JpaToscaProperty().validate(new PfValidationResult()).isValid());
-        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        assertFalse(new JpaToscaProperty().validate("").isValid());
+        assertTrue(tp.validate("").isValid());
 
         tp.setDescription(null);
-        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        assertTrue(tp.validate("").isValid());
         tp.setDescription("");
-        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        assertFalse(tp.validate("").isValid());
         tp.setDescription(A_DESCRIPTION);
-        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        assertTrue(tp.validate("").isValid());
 
         tp.setType(null);
-        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        assertFalse(tp.validate("").isValid());
         tp.setType(typeKey);
-        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        assertTrue(tp.validate("").isValid());
 
         tp.setType(PfConceptKey.getNullKey());
-        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        assertFalse(tp.validate("").isValid());
         tp.setType(typeKey);
-        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        assertTrue(tp.validate("").isValid());
 
         tp.setDefaultValue(null);
-        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        assertTrue(tp.validate("").isValid());
         tp.setDefaultValue("");
-        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        assertFalse(tp.validate("").isValid());
         tp.setDefaultValue(DEFAULT_KEY);
-        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        assertTrue(tp.validate("").isValid());
 
         tp.getConstraints().add(null);
-        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        assertFalse(tp.validate("").isValid());
         tp.getConstraints().remove(null);
-        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        assertTrue(tp.validate("").isValid());
 
         tp.setMetadata(null);
-        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        assertTrue(tp.validate("").isValid());
 
-        assertThatThrownBy(() -> tp.validate(null)).hasMessageMatching("resultIn is marked .*on.*ull but is null");
+        assertThatThrownBy(() -> tp.validate(null)).hasMessageMatching("fieldName is marked .*on.*ull but is null");
     }
 
     @Test
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinitionTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinitionTest.java
index e7163f7..7248b45 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinitionTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaSchemaDefinitionTest.java
@@ -32,7 +32,6 @@
 import java.util.List;
 import org.junit.Test;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfValidationResult;
 
 /**
  * DAO test for ToscaEntrySchema.
@@ -96,27 +95,27 @@
         tes.clean();
         assertEquals(tdtClone0, tes);
 
-        assertTrue(new JpaToscaSchemaDefinition(typeKey).validate(new PfValidationResult()).isValid());
-        assertTrue(tes.validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaSchemaDefinition(typeKey).validate("").isValid());
+        assertTrue(tes.validate("").isValid());
 
         tes.setType(PfConceptKey.getNullKey());
-        assertFalse(tes.validate(new PfValidationResult()).isValid());
+        assertFalse(tes.validate("").isValid());
         tes.setType(null);
-        assertFalse(tes.validate(new PfValidationResult()).isValid());
+        assertFalse(tes.validate("").isValid());
         tes.setType(typeKey);
-        assertTrue(tes.validate(new PfValidationResult()).isValid());
+        assertTrue(tes.validate("").isValid());
 
         tes.setDescription("");
 
-        assertFalse(tes.validate(new PfValidationResult()).isValid());
+        assertFalse(tes.validate("").isValid());
         tes.setDescription(A_DESCRIPTION);
-        assertTrue(tes.validate(new PfValidationResult()).isValid());
+        assertTrue(tes.validate("").isValid());
 
         tes.getConstraints().add(null);
-        assertFalse(tes.validate(new PfValidationResult()).isValid());
+        assertFalse(tes.validate("").isValid());
         tes.getConstraints().remove(null);
-        assertTrue(tes.validate(new PfValidationResult()).isValid());
+        assertTrue(tes.validate("").isValid());
 
-        assertThatThrownBy(() -> tes.validate(null)).hasMessageMatching("resultIn is marked .*on.*ull but is null");
+        assertThatThrownBy(() -> tes.validate(null)).hasMessageMatching("fieldName is marked .*on.*ull but is null");
     }
 }
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplateTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplateTest.java
index bb0d2dc..d6266b4 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplateTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplateTest.java
@@ -33,9 +33,10 @@
 import java.util.Map;
 import java.util.TreeMap;
 import org.junit.Test;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationResult;
+import org.onap.policy.models.base.Validated;
 
 /**
  * DAO test for ToscaDatatype.
@@ -126,31 +127,31 @@
         tst.clean();
         assertEquals(tttClone0, tst);
 
-        assertTrue(new JpaToscaServiceTemplate().validate(new PfValidationResult()).isValid());
-        assertTrue(tst.validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaServiceTemplate().validate("").isValid());
+        assertTrue(tst.validate("").isValid());
 
         tst.setDescription(null);
-        assertTrue(tst.validate(new PfValidationResult()).isValid());
+        assertTrue(tst.validate("").isValid());
         tst.setDescription("");
-        assertFalse(tst.validate(new PfValidationResult()).isValid());
+        assertFalse(tst.validate("").isValid());
         tst.setDescription("A Description");
-        assertTrue(tst.validate(new PfValidationResult()).isValid());
+        assertTrue(tst.validate("").isValid());
 
-        assertThatThrownBy(() -> tst.validate(null)).hasMessageMatching("resultIn is marked .*on.*ull but is null");
+        assertThatThrownBy(() -> tst.validate(null)).hasMessageMatching("fieldName is marked .*on.*ull but is null");
 
         tst.setToscaDefinitionsVersion(null);
-        PfValidationResult result = tst.validate(new PfValidationResult());
-        assertThat(result.toString()).contains("service template tosca definitions version may not be null");
+        BeanValidationResult result = tst.validate("");
+        assertThat(result.getResult()).contains("toscaDefinitionsVersion").contains(Validated.IS_BLANK);
 
         tst.setToscaDefinitionsVersion(JpaToscaServiceTemplate.DEFAULT_TOSCA_DEFINTIONS_VERISON);
         tst.setDataTypes(null);
-        result = tst.validate(new PfValidationResult());
-        assertTrue(result.isOk());
+        result = tst.validate("");
+        assertTrue(result.isValid());
 
         JpaToscaPolicyType pt0 = new JpaToscaPolicyType(new PfConceptKey("pt0:0.0.1"));
         tst.getPolicyTypes().getConceptMap().put(pt0.getKey(), pt0);
-        result = tst.validate(new PfValidationResult());
-        assertTrue(result.isOk());
+        result = tst.validate("");
+        assertTrue(result.isValid());
 
         JpaToscaDataType dt0 = new JpaToscaDataType(new PfConceptKey("dt0:0.0.1"));
         JpaToscaProperty prop0 = new JpaToscaProperty(new PfReferenceKey(pt0.getKey(), "prop0"));
@@ -158,81 +159,82 @@
 
         pt0.setProperties(new LinkedHashMap<>());
         pt0.getProperties().put(prop0.getKey().getLocalName(), prop0);
-        result = tst.validate(new PfValidationResult());
-        assertFalse(result.isOk());
-        assertThat(result.toString()).contains("referenced data type dt0:0.0.1 not found");
+        result = tst.validate("");
+        assertFalse(result.isValid());
+        assertThat(result.getResult()).contains("data type").contains("dt0:0.0.1").contains(Validated.NOT_FOUND);
 
         tst.setDataTypes(null);
-        result = tst.validate(new PfValidationResult());
-        assertFalse(result.isOk());
-        assertThat(result.toString()).contains("referenced data type dt0:0.0.1 not found");
+        result = tst.validate("");
+        assertFalse(result.isValid());
+        assertThat(result.getResult()).contains("data type").contains("dt0:0.0.1").contains(Validated.NOT_FOUND);
 
         tst.setDataTypes(new JpaToscaDataTypes());
-        result = tst.validate(new PfValidationResult());
-        assertFalse(result.isOk());
-        assertThat(result.toString()).contains("referenced data type dt0:0.0.1 not found");
+        result = tst.validate("");
+        assertFalse(result.isValid());
+        assertThat(result.getResult()).contains("data type").contains("dt0:0.0.1").contains(Validated.NOT_FOUND);
 
         tst.getDataTypes().getConceptMap().put(dt0.getKey(), dt0);
-        result = tst.validate(new PfValidationResult());
-        assertTrue(result.isOk());
+        result = tst.validate("");
+        assertTrue(result.isValid());
 
         tst.setTopologyTemplate(null);
-        result = tst.validate(new PfValidationResult());
-        assertTrue(result.isOk());
+        result = tst.validate("");
+        assertTrue(result.isValid());
 
         tst.setTopologyTemplate(new JpaToscaTopologyTemplate());
-        result = tst.validate(new PfValidationResult());
-        assertTrue(result.isOk());
+        result = tst.validate("");
+        assertTrue(result.isValid());
 
         tst.getTopologyTemplate().setPolicies(new JpaToscaPolicies());
-        result = tst.validate(new PfValidationResult());
-        assertTrue(result.isOk());
+        result = tst.validate("");
+        assertTrue(result.isValid());
 
         tst.setPolicyTypes(null);
-        result = tst.validate(new PfValidationResult());
-        assertTrue(result.isOk());
+        result = tst.validate("");
+        assertTrue(result.isValid());
 
         JpaToscaPolicy pol0 = new JpaToscaPolicy(new PfConceptKey("pol0:0.0.1"));
         tst.getTopologyTemplate().getPolicies().getConceptMap().put(pol0.getKey(), pol0);
-        result = tst.validate(new PfValidationResult());
-        assertFalse(result.isOk());
-        assertThat(result.toString()).contains("type is null or a null key");
+        result = tst.validate("");
+        assertFalse(result.isValid());
+        assertThat(result.getResult()).contains("type").contains(Validated.IS_A_NULL_KEY);
 
         pol0.setType(new PfConceptKey("i.dont.Exist:0.0.1"));
-        result = tst.validate(new PfValidationResult());
-        assertFalse(result.isOk());
-        assertThat(result.toString()).contains(
+        result = tst.validate("");
+        assertFalse(result.isValid());
+        assertThat(result.getResult()).contains(
                 "no policy types are defined on the service template for the policies in the topology template");
 
         tst.setPolicyTypes(policyTypes);
-        result = tst.validate(new PfValidationResult());
-        assertFalse(result.isOk());
-        assertThat(result.toString()).contains("policy type i.dont.Exist:0.0.1 referenced in policy not found");
+        result = tst.validate("");
+        assertFalse(result.isValid());
+        assertThat(result.getResult()).contains("policy type").contains("i.dont.Exist:0.0.1")
+                        .contains(Validated.NOT_FOUND);
 
         pol0.setType(dt0.getKey());
-        result = tst.validate(new PfValidationResult());
-        assertFalse(result.isOk());
-        assertThat(result.toString()).contains("policy type dt0:0.0.1 referenced in policy not found");
+        result = tst.validate("");
+        assertFalse(result.isValid());
+        assertThat(result.getResult()).contains("policy type").contains("dt0:0.0.1").contains(Validated.NOT_FOUND);
 
         pol0.setType(pt0.getKey());
-        result = tst.validate(new PfValidationResult());
-        assertTrue(result.isOk());
+        result = tst.validate("");
+        assertTrue(result.isValid());
 
         tst.setPolicyTypes(null);
-        result = tst.validate(new PfValidationResult());
-        assertFalse(result.isOk());
-        assertThat(result.toString()).contains(
+        result = tst.validate("");
+        assertFalse(result.isValid());
+        assertThat(result.getResult()).contains(
                 "no policy types are defined on the service template for the policies in the topology template");
 
         tst.setPolicyTypes(policyTypes);
         pol0.setType(pt0.getKey());
-        result = tst.validate(new PfValidationResult());
-        assertTrue(result.isOk());
+        result = tst.validate("");
+        assertTrue(result.isValid());
 
         tst.setPolicyTypes(new JpaToscaPolicyTypes());
-        result = tst.validate(new PfValidationResult());
-        assertFalse(result.isOk());
-        assertThat(result.toString()).contains(
+        result = tst.validate("");
+        assertFalse(result.isValid());
+        assertThat(result.getResult()).contains(
                 "no policy types are defined on the service template for the policies in the topology template");
 
     }
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeIntervalTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeIntervalTest.java
index ef9039a..2d52f50 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeIntervalTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeIntervalTest.java
@@ -32,7 +32,6 @@
 import org.junit.Test;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationResult;
 
 /**
  * DAO test for ToscaTimeInterval.
@@ -109,23 +108,23 @@
         tti.clean();
         assertEquals(tdtClone0, tti);
 
-        assertFalse(new JpaToscaTimeInterval().validate(new PfValidationResult()).isValid());
-        assertTrue(tti.validate(new PfValidationResult()).isValid());
+        assertFalse(new JpaToscaTimeInterval().validate("").isValid());
+        assertTrue(tti.validate("").isValid());
 
         tti.setStartTime(null);
-        assertFalse(tti.validate(new PfValidationResult()).isValid());
+        assertFalse(tti.validate("").isValid());
         tti.setStartTime(new Date(endTime.getTime() + 1));
-        assertFalse(tti.validate(new PfValidationResult()).isValid());
+        assertFalse(tti.validate("").isValid());
         tti.setStartTime(startTime);
-        assertTrue(tti.validate(new PfValidationResult()).isValid());
+        assertTrue(tti.validate("").isValid());
 
         tti.setEndTime(null);
-        assertFalse(tti.validate(new PfValidationResult()).isValid());
+        assertFalse(tti.validate("").isValid());
         tti.setEndTime(new Date(startTime.getTime() - 1));
-        assertFalse(tti.validate(new PfValidationResult()).isValid());
+        assertFalse(tti.validate("").isValid());
         tti.setEndTime(endTime);
-        assertTrue(tti.validate(new PfValidationResult()).isValid());
+        assertTrue(tti.validate("").isValid());
 
-        assertThatThrownBy(() -> tti.validate(null)).hasMessageMatching("resultIn is marked .*on.*ull but is null");
+        assertThatThrownBy(() -> tti.validate(null)).hasMessageMatching("fieldName is marked .*on.*ull but is null");
     }
 }
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplateTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplateTest.java
index d42dfb0..714b672 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplateTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplateTest.java
@@ -33,7 +33,6 @@
 import org.junit.Test;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
 
 /**
@@ -108,21 +107,21 @@
         ttt.clean();
         assertEquals(tttClone0, ttt);
 
-        assertTrue(new JpaToscaTopologyTemplate().validate(new PfValidationResult()).isValid());
-        assertTrue(ttt.validate(new PfValidationResult()).isValid());
+        assertTrue(new JpaToscaTopologyTemplate().validate("").isValid());
+        assertTrue(ttt.validate("").isValid());
 
         ttt.setKey(PfReferenceKey.getNullKey());
-        assertFalse(ttt.validate(new PfValidationResult()).isValid());
+        assertFalse(ttt.validate("").isValid());
         ttt.setKey(tttKey);
-        assertTrue(ttt.validate(new PfValidationResult()).isValid());
+        assertTrue(ttt.validate("").isValid());
 
         ttt.setDescription(null);
-        assertTrue(ttt.validate(new PfValidationResult()).isValid());
+        assertTrue(ttt.validate("").isValid());
         ttt.setDescription("");
-        assertFalse(ttt.validate(new PfValidationResult()).isValid());
+        assertFalse(ttt.validate("").isValid());
         ttt.setDescription(A_DESCRIPTION);
-        assertTrue(ttt.validate(new PfValidationResult()).isValid());
+        assertTrue(ttt.validate("").isValid());
 
-        assertThatThrownBy(() -> ttt.validate(null)).hasMessageMatching("resultIn is marked .*on.*ull but is null");
+        assertThatThrownBy(() -> ttt.validate(null)).hasMessageMatching("fieldName is marked .*on.*ull but is null");
     }
 }
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTriggerTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTriggerTest.java
index 3b196c4..2eb6b10 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTriggerTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTriggerTest.java
@@ -33,7 +33,6 @@
 import org.junit.Test;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationResult;
 
 /**
  * DAO test for ToscaTrigger.
@@ -153,28 +152,28 @@
         tdt.clean();
         assertEquals(tdtClone0, tdt);
 
-        assertFalse(new JpaToscaTrigger().validate(new PfValidationResult()).isValid());
-        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+        assertFalse(new JpaToscaTrigger().validate("").isValid());
+        assertTrue(tdt.validate("").isValid());
 
         tdt.setDescription(null);
-        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+        assertTrue(tdt.validate("").isValid());
         tdt.setDescription("");
-        assertFalse(tdt.validate(new PfValidationResult()).isValid());
+        assertFalse(tdt.validate("").isValid());
         tdt.setDescription(A_DESCRIPTION);
-        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+        assertTrue(tdt.validate("").isValid());
 
         tdt.setEvaluations(-1);
-        assertFalse(tdt.validate(new PfValidationResult()).isValid());
+        assertFalse(tdt.validate("").isValid());
         tdt.setEvaluations(100);
-        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+        assertTrue(tdt.validate("").isValid());
 
         tdt.setMethod(null);
-        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+        assertTrue(tdt.validate("").isValid());
         tdt.setMethod("");
-        assertFalse(tdt.validate(new PfValidationResult()).isValid());
+        assertFalse(tdt.validate("").isValid());
         tdt.setMethod(A_METHOD);
-        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+        assertTrue(tdt.validate("").isValid());
 
-        assertThatThrownBy(() -> tdt.validate(null)).hasMessageMatching("resultIn is marked .*on.*ull but is null");
+        assertThatThrownBy(() -> tdt.validate(null)).hasMessageMatching("fieldName is marked .*on.*ull but is null");
     }
 }
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java
index 3c363b3..a926ca1 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2020 Nordix Foundation.
- *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -38,6 +38,7 @@
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfModelException;
 import org.onap.policy.models.base.PfReferenceKey;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.dao.DaoParameters;
 import org.onap.policy.models.dao.PfDao;
 import org.onap.policy.models.dao.PfDaoFactory;
@@ -418,7 +419,8 @@
 
         assertThatThrownBy(() -> {
             new SimpleToscaProvider().createPolicies(pfDao, originalServiceTemplate);
-        }).hasMessageContaining("policy type IDontExist:99.100.101 referenced in policy not found");
+        }).hasMessageContaining("policy type").hasMessageContaining("IDontExist:99.100.101")
+                        .hasMessageContaining(Validated.NOT_FOUND);
 
         toscaPolicy.setType("IDontExist");
         originalServiceTemplate.fromAuthorative(toscaServiceTemplate);
@@ -523,8 +525,8 @@
         serviceTemplateFragment.getPolicyTypes().getConceptMap().put(badPt.getKey(), badPt);
 
         assertThatThrownBy(() -> new SimpleToscaProvider().appendToServiceTemplate(pfDao, serviceTemplateFragment))
-                .hasMessageContaining(
-                        "key on concept entry PfConceptKey(name=NULL, version=0.0.0) may not be the null key");
+                        .hasMessageContaining("key on concept entry").hasMessageContaining("NULL:0.0.0")
+                        .hasMessageContaining(Validated.IS_A_NULL_KEY);
     }
 
     @Test
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java
index 87a5224..98ced3b 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java
@@ -36,7 +36,6 @@
 import org.onap.policy.common.utils.coder.YamlJsonTranslator;
 import org.onap.policy.common.utils.resources.ResourceUtils;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
 import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy;
 import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
@@ -179,8 +178,8 @@
 
         // Sanity check the entire structure
         assertNotNull(serviceTemplate);
-        LOGGER.info(serviceTemplate.validate(new PfValidationResult()).toString());
-        assertTrue(serviceTemplate.validate(new PfValidationResult()).isValid());
+        LOGGER.info(serviceTemplate.validate("").toString());
+        assertTrue(serviceTemplate.validate("").isValid());
 
         // Check tosca_definitions_version
         assertEquals(YAML_VERSION, serviceTemplate.getToscaDefinitionsVersion());
@@ -211,8 +210,8 @@
 
         // Sanity check the entire structure
         assertNotNull(serviceTemplate);
-        LOGGER.info(serviceTemplate.validate(new PfValidationResult()).toString());
-        assertTrue(serviceTemplate.validate(new PfValidationResult()).isValid());
+        LOGGER.info(serviceTemplate.validate("").toString());
+        assertTrue(serviceTemplate.validate("").isValid());
 
         // Check tosca_definitions_version
         assertEquals(YAML_VERSION, serviceTemplate.getToscaDefinitionsVersion());
@@ -243,8 +242,8 @@
 
         // Sanity check the entire structure
         assertNotNull(serviceTemplate);
-        LOGGER.info(serviceTemplate.validate(new PfValidationResult()).toString());
-        assertTrue(serviceTemplate.validate(new PfValidationResult()).isValid());
+        LOGGER.info(serviceTemplate.validate("").toString());
+        assertTrue(serviceTemplate.validate("").isValid());
 
         // Check tosca_definitions_version
         assertEquals(YAML_VERSION, serviceTemplate.getToscaDefinitionsVersion());
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicyTypeSerializationTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicyTypeSerializationTest.java
index 4a8378f..7135da0 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicyTypeSerializationTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicyTypeSerializationTest.java
@@ -34,7 +34,6 @@
 import org.onap.policy.common.utils.coder.StandardCoder;
 import org.onap.policy.common.utils.resources.ResourceUtils;
 import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
 import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintLogical;
 import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintValidValues;
@@ -140,8 +139,8 @@
 
         // Sanity check the entire structure
         assertNotNull(serviceTemplate);
-        LOGGER.info(serviceTemplate.validate(new PfValidationResult()).toString());
-        assertTrue(serviceTemplate.validate(new PfValidationResult()).isValid());
+        LOGGER.info(serviceTemplate.validate("").toString());
+        assertTrue(serviceTemplate.validate("").isValid());
 
         // Check tosca_definitions_version
         assertEquals("tosca_simple_yaml_1_1_0", serviceTemplate.getToscaDefinitionsVersion());
@@ -361,8 +360,8 @@
 
         // Sanity check the entire structure
         assertNotNull(serviceTemplate);
-        LOGGER.info(serviceTemplate.validate(new PfValidationResult()).toString());
-        assertTrue(serviceTemplate.validate(new PfValidationResult()).isValid());
+        LOGGER.info(serviceTemplate.validate("").toString());
+        assertTrue(serviceTemplate.validate("").isValid());
 
         // Check tosca_definitions_version
         assertEquals("tosca_simple_yaml_1_1_0", serviceTemplate.getToscaDefinitionsVersion());
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtilsTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtilsTest.java
index c3fc8a3..ad29a71 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtilsTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/utils/ToscaServiceTemplateUtilsTest.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -26,6 +27,7 @@
 import java.util.Iterator;
 import org.junit.Test;
 import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType;
 import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataTypes;
 import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies;
@@ -132,13 +134,14 @@
         final JpaToscaServiceTemplate compositeTestTemplate = new JpaToscaServiceTemplate(compositeTemplate00);
         assertThatThrownBy(() -> {
             ToscaServiceTemplateUtils.addFragment(compositeTestTemplate, fragmentTemplate03);
-        }).hasMessageContaining("entity in incoming fragment does not equal existing entity");
+        }).hasMessageContaining("incoming fragment").hasMessageContaining("entity").hasMessageContaining("dt0:0.0.1")
+                        .hasMessageContaining("does not equal existing entity");
 
         JpaToscaServiceTemplate fragmentTemplate04 = new JpaToscaServiceTemplate();
         fragmentTemplate04.setDescription("Another service template");
         assertThatThrownBy(() -> {
             ToscaServiceTemplateUtils.addFragment(compositeTestTemplate, fragmentTemplate04);
-        }).hasMessageContaining("service template in incoming fragment does not equal existing service template");
+        }).hasMessageContaining("service template").hasMessageContaining("does not equal existing service template");
 
         JpaToscaServiceTemplate fragmentTemplate05 = new JpaToscaServiceTemplate();
         fragmentTemplate05.setTopologyTemplate(new JpaToscaTopologyTemplate());
@@ -159,7 +162,8 @@
         fragmentTemplate07.getTopologyTemplate().setDescription("topology template other description");
         assertThatThrownBy(() -> {
             ToscaServiceTemplateUtils.addFragment(compositeTemplate04, fragmentTemplate07);
-        }).hasMessageContaining("topology template in incoming fragment does not equal existing topology template");
+        }).hasMessageContaining("incoming fragment").hasMessageContaining("topology template")
+                        .hasMessageContaining("does not equal existing topology template");
 
         JpaToscaDataType dt1 = new JpaToscaDataType();
         dt1.setKey(new PfConceptKey("dt1", "0.0.1"));
@@ -189,7 +193,7 @@
 
         assertThatThrownBy(() -> {
             ToscaServiceTemplateUtils.addFragment(compositeTemplate04, fragmentTemplate08);
-        }).hasMessageContaining("JpaToscaPolicy:INVALID:type is null or a null key");
+        }).hasMessageContaining("type").hasMessageContaining(Validated.IS_A_NULL_KEY);
 
         p0.setType(pt0.getKey());
 
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/utils/ToscaUtilsTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/utils/ToscaUtilsTest.java
index d75e37b..0880fd9 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/utils/ToscaUtilsTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/utils/ToscaUtilsTest.java
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@
 
 package org.onap.policy.models.tosca.utils;
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
@@ -28,9 +30,10 @@
 import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
+import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
-import org.onap.policy.models.base.PfValidationResult;
+import org.onap.policy.models.base.Validated;
 import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType;
 import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataTypes;
 import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies;
@@ -149,7 +152,7 @@
         }).hasMessageMatching("entityTypes is marked .*on.*ull but is null");
 
         assertThatThrownBy(() -> {
-            ToscaUtils.getEntityTypeAncestors(null, null, new PfValidationResult());
+            ToscaUtils.getEntityTypeAncestors(null, null, new BeanValidationResult("", null));
         }).hasMessageMatching("entityTypes is marked .*on.*ull but is null");
 
         assertThatThrownBy(() -> {
@@ -157,7 +160,7 @@
         }).hasMessageMatching("entityTypes is marked .*on.*ull but is null");
 
         assertThatThrownBy(() -> {
-            ToscaUtils.getEntityTypeAncestors(null, new JpaToscaDataType(), new PfValidationResult());
+            ToscaUtils.getEntityTypeAncestors(null, new JpaToscaDataType(), new BeanValidationResult("", null));
         }).hasMessageMatching("entityTypes is marked .*on.*ull but is null");
 
         assertThatThrownBy(() -> {
@@ -165,7 +168,7 @@
         }).hasMessageMatching("entityType is marked .*on.*ull but is null");
 
         assertThatThrownBy(() -> {
-            ToscaUtils.getEntityTypeAncestors(new JpaToscaDataTypes(), null, new PfValidationResult());
+            ToscaUtils.getEntityTypeAncestors(new JpaToscaDataTypes(), null, new BeanValidationResult("", null));
         }).hasMessageMatching("entityType is marked .*on.*ull but is null");
 
         assertThatThrownBy(() -> {
@@ -176,7 +179,7 @@
         JpaToscaDataType dt0 = new JpaToscaDataType();
         dt0.setKey(new PfConceptKey("dt0", "0.0.1"));
         dt0.setDescription("dt0 description");
-        PfValidationResult result = new PfValidationResult();
+        BeanValidationResult result = new BeanValidationResult("", null);
 
         assertTrue(ToscaUtils.getEntityTypeAncestors(dataTypes, dt0, result).isEmpty());
 
@@ -195,9 +198,10 @@
         dt0.setDerivedFrom(new PfConceptKey("some.thing.Else", PfKey.NULL_KEY_VERSION));
         assertTrue(ToscaUtils.getEntityTypeAncestors(dataTypes, dt0, result).isEmpty());
         assertFalse(result.isValid());
-        assertTrue(result.toString().contains("parent some.thing.Else:0.0.0 of entity not found"));
+        assertThat(result.getResult()).contains("parent").contains("some.thing.Else:0.0.0")
+                        .contains(Validated.NOT_FOUND);
 
-        result = new PfValidationResult();
+        result = new BeanValidationResult("", null);
         dt0.setDerivedFrom(new PfConceptKey("tosca.datatyps.Root", PfKey.NULL_KEY_VERSION));
 
         JpaToscaDataType dt1 = new JpaToscaDataType();
@@ -233,8 +237,8 @@
 
         dt0.setDerivedFrom(dt0.getKey());
         assertThatThrownBy(() -> {
-            ToscaUtils.getEntityTypeAncestors(dataTypes, dt0, new PfValidationResult());
-        }).hasMessageContaining("entity cannot be an ancestor of itself");
+            ToscaUtils.getEntityTypeAncestors(dataTypes, dt0, new BeanValidationResult("", null));
+        }).hasMessageContaining("entity type").hasMessageContaining("ancestor of itself");
 
         dt0.setDerivedFrom(null);
         assertEquals(2, ToscaUtils.getEntityTypeAncestors(dataTypes, dt2, result).size());
@@ -250,7 +254,7 @@
         dataTypes.getConceptMap().remove(dt1.getKey());
         assertTrue(ToscaUtils.getEntityTypeAncestors(dataTypes, dt2, result).isEmpty());
         assertFalse(result.isValid());
-        assertTrue(result.toString().contains("parent dt1:0.0.1 of entity not found"));
+        assertThat(result.getResult()).contains("parent").contains("dt1:0.0.1").contains(Validated.NOT_FOUND);
     }
 
     @Test
@@ -369,6 +373,7 @@
         assertThatThrownBy(() -> {
             final JpaToscaDataTypes badDataTypes = new JpaToscaDataTypes(dataTypes);
             ToscaUtils.getEntityTree(badDataTypes, dt9.getKey().getName(), dt9.getKey().getVersion());
-        }).hasMessageContaining("parent i.dont.Exist:0.0.0 of entity not found");
+        }).hasMessageContaining("parent").hasMessageContaining("i.dont.Exist:0.0.0")
+                        .hasMessageContaining(Validated.NOT_FOUND);
     }
 }
