diff --git a/lombok.config b/lombok.config
new file mode 100644
index 0000000..df71bb6
--- /dev/null
+++ b/lombok.config
@@ -0,0 +1,2 @@
+config.stopBubbling = true
+lombok.addLombokGeneratedAnnotation = true
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 b74b037..c41b0de 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
@@ -23,7 +23,7 @@
 import java.io.Serializable;
 import java.util.List;
 
-import org.onap.policy.common.utils.validation.Assertions;
+import lombok.NonNull;
 
 /**
  * This class is the base class for all Policy Framework concept classes. It enforces implementation
@@ -43,8 +43,7 @@
      *
      * @param copyConcept the concept to copy from
      */
-    public PfConcept(final PfConcept copyConcept) {
-        Assertions.argumentNotNull(copyConcept, "copy concept may not be null");
+    public PfConcept(@NonNull final PfConcept copyConcept) {
         copyConcept.copyTo(this);
     }
 
@@ -70,7 +69,7 @@
      * @return the validation result that was passed in in the @{link result} field with the result
      *         of this validation added
      */
-    public abstract PfValidationResult validate(PfValidationResult result);
+    public abstract PfValidationResult validate(@NonNull final PfValidationResult result);
 
     /**
      * Clean this concept, tidy up any superfluous information such as leading and trailing white
@@ -78,27 +77,12 @@
      */
     public abstract void clean();
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see java.lang.Object#equals(java.lang.Object)
-     */
     @Override
     public abstract boolean equals(Object otherObject);
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see java.lang.Object#toString()
-     */
     @Override
     public abstract String toString();
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see java.lang.Object#hashCode()
-     */
     @Override
     public abstract int hashCode();
 
@@ -109,7 +93,7 @@
      * @param target the target object to which this object is copied
      * @return the copied object
      */
-    public abstract PfConcept copyTo(PfConcept target);
+    public abstract PfConcept copyTo(@NonNull PfConcept target);
 
     /**
      * Gets the ID string of this concept.
@@ -126,9 +110,7 @@
      * @param id the key ID to match against
      * @return true, if this key matches the ID
      */
-    public final boolean matchesId(final String id) {
-        Assertions.argumentNotNull(id, "id may not be null");
-
+    public final boolean matchesId(@NonNull final String id) {
         // Check the ID
         return getId().equals(id);
     }
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
new file mode 100644
index 0000000..4609461
--- /dev/null
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
@@ -0,0 +1,268 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.NavigableMap;
+import java.util.Set;
+import java.util.TreeMap;
+
+import javax.persistence.CascadeType;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.ManyToMany;
+import javax.persistence.Table;
+import javax.ws.rs.core.Response;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NonNull;
+
+import org.onap.policy.common.utils.validation.Assertions;
+import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+
+/**
+ * This class is a concept container and holds a map of concepts. The {@link PfConceptContainer}
+ * class implements the helper methods of the {@link PfConceptGetter} interface to allow
+ * {@link PfConceptContainer} instances to be retrieved by calling methods directly on this class
+ * without referencing the contained map.
+ *
+ * <p>Validation checks that the container key is not null. An error is issued if no concepts are
+ * defined in the container. Each concept entry is checked to ensure that its key and value are not
+ * null and that the key matches the key in the map value. Each concept entry is then validated
+ * individually.
+ *
+ * @param C the concept being contained
+ */
+@Entity
+@Table(name = "PfConceptContainer")
+@Data
+@EqualsAndHashCode(callSuper = false)
+
+public class PfConceptContainer<C extends PfConcept> extends PfConcept implements PfConceptGetter<C> {
+    private static final long serialVersionUID = -324211738823208318L;
+
+    @EmbeddedId
+    private PfConceptKey key;
+
+    @ManyToMany(cascade = CascadeType.ALL)
+    private Map<PfConceptKey, C> conceptMap;
+
+    /**
+     * The Default Constructor creates a {@link PfConceptContainer} object with a null artifact key
+     * and creates an empty concept map.
+     */
+    public PfConceptContainer() {
+        this(new PfConceptKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link PfConceptContainer} object with the given artifact key
+     * and creates an empty concept map.
+     *
+     * @param key the concept key
+     */
+    public PfConceptContainer(@NonNull final PfConceptKey key) {
+        this(key, new TreeMap<PfConceptKey, C>());
+    }
+
+    /**
+     * This Constructor creates an concept container with all of its fields defined.
+     *
+     * @param key the concept container key
+     * @param conceptMap the concepts to be stored in the concept container
+     */
+    public PfConceptContainer(@NonNull final PfConceptKey key, @NonNull final Map<PfConceptKey, C> conceptMap) {
+        super();
+
+        this.key = key;
+        this.conceptMap = new TreeMap<>(conceptMap);
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public PfConceptContainer(@NonNull final PfConceptContainer<C> copyConcept) {
+        super(copyConcept);
+    }
+
+    @Override
+    public List<PfKey> getKeys() {
+        final List<PfKey> keyList = key.getKeys();
+
+        for (final C concept : conceptMap.values()) {
+            keyList.addAll(concept.getKeys());
+        }
+
+        return keyList;
+    }
+
+    @Override
+    public void clean() {
+        key.clean();
+        for (final Entry<PfConceptKey, C> conceptEntry : conceptMap.entrySet()) {
+            conceptEntry.getKey().clean();
+            conceptEntry.getValue().clean();
+        }
+    }
+
+    @Override
+    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
+        PfValidationResult result = resultIn;
+
+        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.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+                    "conceptMap may not be empty"));
+        } else {
+            result = validateConceptMap(result);
+        }
+
+        return result;
+    }
+
+    /**
+     * 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
+     */
+    private PfValidationResult validateConceptMap(final PfValidationResult resultIn) {
+        PfValidationResult result = resultIn;
+
+        for (final Entry<PfConceptKey, C> conceptEntry : conceptMap.entrySet()) {
+            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"));
+            } else if (conceptEntry.getValue() == null) {
+                result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+                        "value on concept entry " + conceptEntry.getKey() + " may not be 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);
+            } else {
+                result = conceptEntry.getValue().validate(result);
+            }
+        }
+        return result;
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+        if (this == otherConcept) {
+            return 0;
+        }
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        @SuppressWarnings("unchecked")
+        final PfConceptContainer<C> other = (PfConceptContainer<C>) otherConcept;
+        int retVal = key.compareTo(other.key);
+        if (retVal != 0) {
+            return retVal;
+        }
+
+        if (!conceptMap.equals(other.conceptMap)) {
+            return (conceptMap.hashCode() - other.conceptMap.hashCode());
+        }
+
+        return 0;
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull final PfConcept target) {
+        Assertions.instanceOf(target, PfConceptContainer.class);
+
+        @SuppressWarnings("unchecked")
+        final PfConceptContainer<C> copy = (PfConceptContainer<C>) target;
+        copy.setKey(new PfConceptKey(key));
+        final Map<PfConceptKey, C> newConceptMap = new TreeMap<>();
+        for (final Entry<PfConceptKey, C> conceptMapEntry : conceptMap.entrySet()) {
+            newConceptMap.put(new PfConceptKey(conceptMapEntry.getKey()),
+                    new ConceptCloner().cloneConcept(conceptMapEntry.getValue()));
+        }
+        copy.setConceptMap(newConceptMap);
+
+        return copy;
+    }
+
+    @Override
+    public C get(final PfConceptKey conceptKey) {
+        return new PfConceptGetterImpl<>((NavigableMap<PfConceptKey, C>) conceptMap).get(conceptKey);
+    }
+
+    @Override
+    public C get(final String conceptKeyName) {
+        return new PfConceptGetterImpl<>((NavigableMap<PfConceptKey, C>) conceptMap).get(conceptKeyName);
+    }
+
+    @Override
+    public C get(final String conceptKeyName, final String conceptKeyVersion) {
+        return new PfConceptGetterImpl<>((NavigableMap<PfConceptKey, C>) conceptMap).get(conceptKeyName,
+                conceptKeyVersion);
+    }
+
+    @Override
+    public Set<C> getAll(final String conceptKeyName) {
+        return new PfConceptGetterImpl<>((NavigableMap<PfConceptKey, C>) conceptMap).getAll(conceptKeyName);
+    }
+
+    @Override
+    public Set<C> getAll(final String conceptKeyName, final String conceptKeyVersion) {
+        return new PfConceptGetterImpl<>((NavigableMap<PfConceptKey, C>) conceptMap).getAll(conceptKeyName,
+                conceptKeyVersion);
+    }
+
+    /**
+     * Private inner class that returns a clone of a concept by calling the copy constructor on the
+     * original class.
+     */
+    private class ConceptCloner {
+        @SuppressWarnings("unchecked")
+        public C cloneConcept(final C originalConcept) {
+            try {
+                C clonedConcept = (C) originalConcept.getClass().newInstance();
+                originalConcept.copyTo(clonedConcept);
+                return clonedConcept;
+            } catch (Exception ex) {
+                throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR,
+                        "Failed to create a clone of class \"" + originalConcept.getClass().getCanonicalName() + "\"",
+                        ex);
+            }
+        }
+    }
+}
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java
index efcbe39..695ca47 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java
@@ -28,6 +28,7 @@
 
 import lombok.Data;
 import lombok.EqualsAndHashCode;
+import lombok.NonNull;
 
 import org.onap.policy.common.utils.validation.Assertions;
 import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@@ -67,7 +68,7 @@
      *
      * @param copyConcept the concept to copy from
      */
-    public PfConceptKey(final PfConceptKey copyConcept) {
+    public PfConceptKey(@NonNull final PfConceptKey copyConcept) {
         super(copyConcept);
     }
 
@@ -77,7 +78,7 @@
      * @param name the key name
      * @param version the key version
      */
-    public PfConceptKey(final String name, final String version) {
+    public PfConceptKey(@NonNull final String name, @NonNull final String version) {
         super();
         this.name = Assertions.validateStringParameter(NAME_TOKEN, name, NAME_REGEXP);
         this.version = Assertions.validateStringParameter(VERSION_TOKEN, version, VERSION_REGEXP);
@@ -88,9 +89,7 @@
      *
      * @param id the key ID in a format that respects the KEY_ID_REGEXP
      */
-    public PfConceptKey(final String id) {
-        Assertions.argumentNotNull(id, "id may not be null");
-
+    public PfConceptKey(@NonNull final String id) {
         // Check the incoming ID is valid
         Assertions.validateStringParameter("id", id, KEY_ID_REGEXP);
 
@@ -131,7 +130,12 @@
     }
 
     @Override
-    public PfKey.Compatibility getCompatibility(final PfKey otherKey) {
+    public boolean isNullKey() {
+        return this.equals(PfConceptKey.getNullKey());
+    }
+
+    @Override
+    public PfKey.Compatibility getCompatibility(@NonNull final PfKey otherKey) {
         if (!(otherKey instanceof PfConceptKey)) {
             return Compatibility.DIFFERENT;
         }
@@ -161,7 +165,7 @@
     }
 
     @Override
-    public boolean isCompatible(final PfKey otherKey) {
+    public boolean isCompatible(@NonNull final PfKey otherKey) {
         if (!(otherKey instanceof PfConceptKey)) {
             return false;
         }
@@ -212,7 +216,7 @@
     }
 
     @Override
-    public int compareTo(final PfConcept otherObj) {
+    public int compareTo(@NonNull final PfConcept otherObj) {
         Assertions.argumentNotNull(otherObj, "comparison object may not be null");
 
         if (this == otherObj) {
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfKey.java
index dda4cdc..6e9035e 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfKey.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfKey.java
@@ -20,6 +20,8 @@
 
 package org.onap.policy.models.base;
 
+import lombok.NonNull;
+
 /**
  * The key uniquely identifies every entity in the system. This class is an abstract class to give a common parent for
  * all key types in the system.
@@ -89,7 +91,7 @@
      * @param otherKey the key to check compatibility against
      * @return the compatibility result of the check
      */
-    public abstract Compatibility getCompatibility(PfKey otherKey);
+    public abstract Compatibility getCompatibility(@NonNull PfKey otherKey);
 
     /**
      * Check if two keys are compatible, that is the keys are IDENTICAL or have only MINOR, PATCH differences.
@@ -97,5 +99,12 @@
      * @param otherKey the key to check compatibility against
      * @return true, if the keys are compatible
      */
-    public abstract boolean isCompatible(PfKey otherKey);
+    public abstract boolean isCompatible(@NonNull PfKey otherKey);
+
+    /**
+     * Check if a key equals its null key.
+     *
+     * @return true, if the key is a null key
+     */
+    public abstract boolean isNullKey();
 }
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 0eb55a7..57141c2 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
@@ -22,16 +22,20 @@
 
 import java.util.List;
 
+import javax.ws.rs.core.Response;
+
 import lombok.EqualsAndHashCode;
+import lombok.NonNull;
 import lombok.ToString;
 
 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 is built using the
- * getKeys() method of the {@link PfConcept} class, an instance of this class is created for every key occurrence. The
- * list of keys returned by the getKeys() method is a list of {@link PfKeyUse} objects.
+ * This class records a usage of a key in the system. When the list of keys being used by a concept
+ * is built using the getKeys() method of the {@link PfConcept} class, an instance of this class is
+ * created for every key occurrence. The list of keys returned by the getKeys() method is a list of
+ * {@link PfKeyUse} objects.
  *
  * <p>Validation checks that each key is valid.
  */
@@ -50,24 +54,23 @@
     }
 
     /**
-     * Copy constructor.
-     *
-     * @param copyConcept the concept to copy from
-     */
-    public PfKeyUse(final PfKeyUse copyConcept) {
-        super(copyConcept);
-    }
-
-    /**
      * This constructor creates an instance of this class, and holds a reference to a used key.
      *
      * @param usedKey a used key
      */
-    public PfKeyUse(final PfKey usedKey) {
-        Assertions.argumentNotNull(usedKey, "usedKey may not be null");
+    public PfKeyUse(@NonNull final PfKey usedKey) {
         this.usedKey = usedKey;
     }
 
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public PfKeyUse(@NonNull final PfKeyUse copyConcept) {
+        super(copyConcept);
+    }
+
     @Override
     public PfKey getKey() {
         return usedKey;
@@ -83,56 +86,42 @@
         return usedKey.getId();
     }
 
+    @Override
+    public boolean isNullKey() {
+        return usedKey.isNullKey();
+    }
+
     /**
      * Sets the key.
      *
      * @param key the key
      */
-    public void setKey(final PfKey key) {
-        Assertions.argumentNotNull(key, "usedKey may not be null");
+    public void setKey(@NonNull final PfKey key) {
         this.usedKey = key;
     }
 
     @Override
-    public PfKey.Compatibility getCompatibility(final PfKey otherKey) {
+    public PfKey.Compatibility getCompatibility(@NonNull final PfKey otherKey) {
         return usedKey.getCompatibility(otherKey);
     }
 
     @Override
-    public boolean isCompatible(final PfKey otherKey) {
+    public boolean isCompatible(@NonNull final PfKey otherKey) {
         return usedKey.isCompatible(otherKey);
     }
 
     @Override
-    public PfValidationResult validate(final PfValidationResult result) {
-        if (usedKey.equals(PfConceptKey.getNullKey())) {
-            result.addValidationMessage(new PfValidationMessage(usedKey, this.getClass(), ValidationResult.INVALID,
-                    "usedKey is a null key"));
-        }
-        return usedKey.validate(result);
-    }
-
-    @Override
     public void clean() {
         usedKey.clean();
     }
 
     @Override
-    public PfConcept copyTo(final PfConcept target) {
-        Assertions.argumentNotNull(target, "target may not be null");
-
-        final Object copyObject = target;
-        Assertions.instanceOf(copyObject, PfKeyUse.class);
-
-        final PfKeyUse copy = ((PfKeyUse) copyObject);
-        try {
-            copy.usedKey = usedKey.getClass().newInstance();
-        } catch (final Exception e) {
-            throw new PfModelRuntimeException("error copying concept key: " + e.getMessage(), e);
+    public PfValidationResult validate(@NonNull final PfValidationResult result) {
+        if (usedKey.isNullKey()) {
+            result.addValidationMessage(new PfValidationMessage(usedKey, this.getClass(), ValidationResult.INVALID,
+                    "usedKey is a null key"));
         }
-        usedKey.copyTo(copy.usedKey);
-
-        return copy;
+        return usedKey.validate(result);
     }
 
     @Override
@@ -150,4 +139,21 @@
 
         return usedKey.compareTo(other.usedKey);
     }
+
+    @Override
+    public PfConcept copyTo(@NonNull final PfConcept target) {
+        final Object copyObject = target;
+        Assertions.instanceOf(copyObject, PfKeyUse.class);
+
+        final PfKeyUse copy = ((PfKeyUse) copyObject);
+        try {
+            copy.usedKey = usedKey.getClass().newInstance();
+        } catch (final Exception e) {
+            throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR,
+                    "error copying concept key: " + e.getMessage(), e);
+        }
+        usedKey.copyTo(copy.usedKey);
+
+        return copy;
+    }
 }
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 c9174bd..3dc233b 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
@@ -63,8 +63,7 @@
     private static final long serialVersionUID = -771659065637205430L;
 
     @EmbeddedId
-    @NonNull
-    private PfConceptKey key = PfConceptKey.getNullKey();
+    private PfConceptKey key;
 
     /**
      * The Default Constructor creates this concept with a NULL artifact key.
@@ -74,20 +73,11 @@
     }
 
     /**
-     * Copy constructor.
-     *
-     * @param copyConcept the concept to copy from
-     */
-    public PfModel(final PfModel copyConcept) {
-        super(copyConcept);
-    }
-
-    /**
      * Constructor to create this concept with the specified key.
      *
      * @param key the key of this concept
      */
-    public PfModel(final PfConceptKey key) {
+    public PfModel(@NonNull final PfConceptKey key) {
         super();
         Assertions.argumentNotNull(key, "key may not be null");
 
@@ -95,6 +85,15 @@
     }
 
     /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public PfModel(@NonNull final PfModel copyConcept) {
+        super(copyConcept);
+    }
+
+    /**
      * Registers this model with the {@link PfModelService}. All models are registered with the
      * model service so that models can be references from anywhere in the Policy Framework system
      * without being passed as references through deep call chains.
@@ -107,10 +106,15 @@
     }
 
     @Override
-    public PfValidationResult validate(final PfValidationResult resultIn) {
+    public void clean() {
+        key.clean();
+    }
+
+    @Override
+    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
         PfValidationResult result = resultIn;
 
-        if (key.equals(PfConceptKey.getNullKey())) {
+        if (key.isNullKey()) {
             result.addValidationMessage(
                     new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
         }
@@ -129,7 +133,7 @@
             } else if (pfKey instanceof PfReferenceKey) {
                 result = validateReferenceKeyInModel((PfReferenceKey) pfKey, referenceKeySet, result);
             }
-            // It must be an PfKeyUse, nothing else is legal
+            // It must be a PfKeyUse, nothing else is legal
             else {
                 usedKeySet.add((PfKeyUse) pfKey);
             }
@@ -160,7 +164,7 @@
     private PfValidationResult validateArtifactKeyInModel(final PfConceptKey artifactKey,
             final Set<PfConceptKey> artifactKeySet, final PfValidationResult result) {
         // Null key check
-        if (artifactKey.equals(PfConceptKey.getNullKey())) {
+        if (artifactKey.isNullKey()) {
             result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
                     "key " + artifactKey + IS_A_NULL_KEY));
         }
@@ -194,13 +198,13 @@
     private PfValidationResult validateReferenceKeyInModel(final PfReferenceKey referenceKey,
             final Set<PfReferenceKey> referenceKeySet, final PfValidationResult result) {
         // Null key check
-        if (referenceKey.equals(PfReferenceKey.getNullKey())) {
+        if (referenceKey.isNullKey()) {
             result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
                     "key " + referenceKey + IS_A_NULL_KEY));
         }
 
         // Null parent key check
-        if (referenceKey.getParentConceptKey().equals(PfConceptKey.getNullKey())) {
+        if (referenceKey.getParentConceptKey().isNullKey()) {
             result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
                     "parent artifact key of key " + referenceKey + IS_A_NULL_KEY));
         }
@@ -262,29 +266,6 @@
     }
 
     @Override
-    public void clean() {
-        key.clean();
-    }
-
-    @Override
-    public PfConcept copyTo(final PfConcept target) {
-        Assertions.argumentNotNull(target, "target may not be null");
-
-        final Object copyObject = target;
-        Assertions.instanceOf(copyObject, PfModel.class);
-
-        final PfModel copy = ((PfModel) copyObject);
-        copy.setKey(new PfConceptKey(key));
-
-        return copy;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see java.lang.Comparable#compareTo(java.lang.Object)
-     */
-    @Override
     public int compareTo(final PfConcept otherObj) {
         if (otherObj == null) {
             return -1;
@@ -300,4 +281,14 @@
 
         return key.compareTo(other.key);
     }
+
+    @Override
+    public PfConcept copyTo(@NonNull final PfConcept target) {
+        Assertions.instanceOf(target, PfModel.class);
+
+        final PfModel copy = ((PfModel) target);
+        copy.setKey(new PfConceptKey(key));
+
+        return copy;
+    }
 }
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfModelException.java b/models-base/src/main/java/org/onap/policy/models/base/PfModelException.java
index 3d1bb17..97ea7de 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfModelException.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfModelException.java
@@ -20,54 +20,71 @@
 
 package org.onap.policy.models.base;
 
+import javax.ws.rs.core.Response;
+
+import lombok.Getter;
+import lombok.ToString;
+
 /**
  * This class is a base exception from which all model exceptions are sub classes.
  */
+@Getter
+@ToString
 public class PfModelException extends Exception {
     private static final long serialVersionUID = -8507246953751956974L;
 
+    // The status code on the exception
+    private final Response.Status statusCode;
+
     // The object on which the exception was thrown
     private final transient Object object;
 
     /**
      * Instantiates a new model exception.
      *
+     * @param statusCode the return code for the exception
      * @param message the message on the exception
      */
-    public PfModelException(final String message) {
-        this(message, null);
+    public PfModelException(final Response.Status statusCode, final String message) {
+        this(statusCode, message, null);
     }
 
     /**
      * Instantiates a new model exception.
      *
+     * @param statusCode the return code for the exception
      * @param message the message on the exception
      * @param object the object that the exception was thrown on
      */
-    public PfModelException(final String message, final Object object) {
+    public PfModelException(final Response.Status statusCode, final String message, final Object object) {
         super(message);
+        this.statusCode = statusCode;
         this.object = object;
     }
 
     /**
      * Instantiates a new model exception.
      *
+     * @param statusCode the return code for the exception
      * @param message the message on the exception
      * @param exception the exception that caused this exception
      */
-    public PfModelException(final String message, final Exception exception) {
-        this(message, exception, null);
+    public PfModelException(final Response.Status statusCode, final String message, final Exception exception) {
+        this(statusCode, message, exception, null);
     }
 
     /**
      * Instantiates a new exception.
      *
+     * @param statusCode the return code for the exception
      * @param message the message on the exception
      * @param exception the exception that caused this exception
      * @param object the object that the exception was thrown on
      */
-    public PfModelException(final String message, final Exception exception, final Object object) {
+    public PfModelException(final Response.Status statusCode, final String message, final Exception exception,
+            final Object object) {
         super(message, exception);
+        this.statusCode = statusCode;
         this.object = object;
     }
 
@@ -97,13 +114,4 @@
 
         return builder.toString();
     }
-
-    /**
-     * Get the object on which the exception was thrown.
-     *
-     * @return The object on which the exception was thrown
-     */
-    public Object getObject() {
-        return object;
-    }
 }
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfModelRuntimeException.java b/models-base/src/main/java/org/onap/policy/models/base/PfModelRuntimeException.java
index 0780a9e..c4684bc 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfModelRuntimeException.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfModelRuntimeException.java
@@ -20,56 +20,73 @@
 
 package org.onap.policy.models.base;
 
+import javax.ws.rs.core.Response;
+
+import lombok.Getter;
+import lombok.ToString;
+
 /**
  * This class is a base model run time exception from which all model run time exceptions are sub
  * classes.
  */
+@Getter
+@ToString
 public class PfModelRuntimeException extends RuntimeException {
     private static final long serialVersionUID = -8507246953751956974L;
 
+    // The return code on the exception
+    private final Response.Status statusCode;
+
     // The object on which the exception was thrown
     private final transient Object object;
 
     /**
      * Instantiates a new model runtime exception.
      *
+     * @param statusCode the return code for the exception
      * @param message the message on the exception
      */
-    public PfModelRuntimeException(final String message) {
-        this(message, null);
+    public PfModelRuntimeException(final Response.Status statusCode, final String message) {
+        this(statusCode, message, null);
     }
 
     /**
      * Instantiates a new model runtime exception.
      *
+     * @param statusCode the return code for the exception
      * @param message the message on the exception
      * @param object the object that the exception was thrown on
      */
-    public PfModelRuntimeException(final String message, final Object object) {
+    public PfModelRuntimeException(final Response.Status statusCode, final String message, final Object object) {
         super(message);
         this.object = object;
+        this.statusCode = statusCode;
     }
 
     /**
      * Instantiates a new model runtime exception.
      *
+     * @param statusCode the return code for the exception
      * @param message the message on the exception
      * @param exception the exception that caused this model exception
      */
-    public PfModelRuntimeException(final String message, final Exception exception) {
-        this(message, exception, null);
+    public PfModelRuntimeException(final Response.Status statusCode, final String message, final Exception exception) {
+        this(statusCode, message, exception, null);
     }
 
     /**
      * Instantiates a new model runtime exception.
      *
+     * @param statusCode the return code for the exception
      * @param message the message on the exception
      * @param exception the exception that caused this model exception
      * @param object the object that the exception was thrown on
      */
-    public PfModelRuntimeException(final String message, final Exception exception, final Object object) {
+    public PfModelRuntimeException(final Response.Status statusCode, final String message, final Exception exception,
+            final Object object) {
         super(message, exception);
         this.object = object;
+        this.statusCode = statusCode;
     }
 
     /**
@@ -80,13 +97,4 @@
     public String getCascadedMessage() {
         return PfModelException.buildCascadedMessage(this);
     }
-
-    /**
-     * Get the object on which the exception was thrown.
-     *
-     * @return The object
-     */
-    public Object getObject() {
-        return object;
-    }
 }
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java b/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java
index c02de6a..67ba59c 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfModelService.java
@@ -23,6 +23,10 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+import javax.ws.rs.core.Response;
+
+import lombok.NonNull;
+
 /**
  * The model service makes Policy Framework models available to all classes in a JVM.
  *
@@ -37,7 +41,7 @@
  */
 public abstract class PfModelService {
     // The map holding the models
-    private static Map<Class<?>, PfConcept> modelMap = new ConcurrentHashMap<>();
+    private static Map<String, PfConcept> modelMap = new ConcurrentHashMap<>();
 
     /**
      * This class is an abstract static class that cannot be extended.
@@ -48,37 +52,36 @@
      * Register a model with the model service.
      *
      * @param <M> the generic type
-     * @param modelClass the class of the model, used to index the model
+     * @param modelKey the key of the model, used to index the model
      * @param model The model
      */
-    public static <M extends PfConcept> void registerModel(final Class<M> modelClass, final M model) {
-        modelMap.put(modelClass, model);
+    public static <M extends PfConcept> void registerModel(@NonNull final String modelKey, @NonNull final M model) {
+        modelMap.put(modelKey, model);
     }
 
     /**
      * Remove a model from the model service.
      *
-     * @param <M> the generic type
-     * @param modelClass the class of the model, used to index the model
+     * @param modelKey the key of the model, used to index the model
      */
-    public static <M extends PfConcept> void deregisterModel(final Class<M> modelClass) {
-        modelMap.remove(modelClass);
+    public static void deregisterModel(@NonNull final String modelKey) {
+        modelMap.remove(modelKey);
     }
 
     /**
      * Get a model from the model service.
      *
      * @param <M> the generic type
-     * @param modelClass the class of the model, used to index the model
+     * @param modelKey the key of the model, used to index the model
      * @return The model
      */
     @SuppressWarnings("unchecked")
-    public static <M extends PfConcept> M getModel(final Class<M> modelClass) {
-        final M model = (M) modelMap.get(modelClass);
+    public static <M extends PfConcept> M getModel(@NonNull final String modelKey) {
+        final M model = (M) modelMap.get(modelKey);
 
         if (model == null) {
-            throw new PfModelRuntimeException(
-                    "Model for " + modelClass.getCanonicalName() + " not found in model service");
+            throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR,
+                    "Model for name " + modelKey + " not found in model service");
         }
 
         return model;
@@ -87,12 +90,11 @@
     /**
      * Check if a model is defined on the model service.
      *
-     * @param <M> the generic type
-     * @param modelClass the class of the model, used to index the model
+     * @param modelKey the key of the model, used to index the model
      * @return true if the model is defined
      */
-    public static <M extends PfConcept> boolean existsModel(final Class<M> modelClass) {
-        return modelMap.get(modelClass) != null;
+    public static boolean existsModel(final String modelKey) {
+        return modelMap.get(modelKey) != null;
     }
 
     /**
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 e3b92c0..2e9f48b 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
@@ -243,6 +243,11 @@
         return parentKeyName + ':' + parentKeyVersion + ':' + parentLocalName + ':' + localName;
     }
 
+    @Override
+    public boolean isNullKey() {
+        return this.equals(PfReferenceKey.getNullKey());
+    }
+
     /**
      * Gets the parent concept key of this reference key.
      *
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java b/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java
new file mode 100644
index 0000000..a18315c
--- /dev/null
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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;
+
+/**
+ * Utility class for Policy Framework concept utilities.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public final class PfUtils {
+    private PfUtils() {
+        // Cannot be subclassed
+    }
+
+    /**
+     * Compare two objects using their equals methods, nulls are allowed.
+     *
+     * @param leftObject the first object
+     * @param rightObject the second object
+     * @return a measure of the comparison
+     */
+    public static int compareObjects(final Object leftObject, final Object rightObject) {
+        if (leftObject == null && rightObject == null) {
+            return 0;
+        }
+
+        if (leftObject == null) {
+            return 1;
+        }
+
+        if (rightObject == null) {
+            return -1;
+        }
+
+        if (!leftObject.equals(rightObject)) {
+            return leftObject.hashCode() - rightObject.hashCode();
+        }
+
+        return 0;
+    }
+}
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
index 284c11a..4f8d06b 100644
--- 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
@@ -23,9 +23,12 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import lombok.Getter;
+
 /**
- * This class records the result of a validation and holds all validatino observation messages.
+ * 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.
@@ -77,24 +80,6 @@
     }
 
     /**
-     * Gets the validation result.
-     *
-     * @return the validation result on a concept
-     */
-    public ValidationResult getValidationResult() {
-        return validationResult;
-    }
-
-    /**
-     * Gets the list of validation results on the concept.
-     *
-     * @return the list of validaiton results
-     */
-    public List<PfValidationMessage> getMessageList() {
-        return messageList;
-    }
-
-    /**
      * Adds a validation message to the validation result, used by validate() implementations on
      * {@link PfConcept} subclasses to report validaiton observations.
      *
diff --git a/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java b/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java
index c0898c1..0a5b6a0 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java
@@ -25,32 +25,35 @@
 
 import java.io.IOException;
 
+import javax.ws.rs.core.Response;
+
 import org.junit.Test;
 
 public class ExceptionsTest {
 
     @Test
     public void test() {
-        assertNotNull(new PfModelException("Message"));
-        assertNotNull(new PfModelException("Message", "String"));
-        assertNotNull(new PfModelException("Message", new IOException()));
-        assertNotNull(new PfModelException("Message", new IOException(), "String"));
+        assertNotNull(new PfModelException(Response.Status.OK, "Message"));
+        assertNotNull(new PfModelException(Response.Status.OK, "Message", "String"));
+        assertNotNull(new PfModelException(Response.Status.OK, "Message", new IOException()));
+        assertNotNull(new PfModelException(Response.Status.OK, "Message", new IOException(), "String"));
 
         String key = "A String";
-        PfModelException ae = new PfModelException("Message", new IOException("IO exception message"), key);
+        PfModelException ae =
+                new PfModelException(Response.Status.OK, "Message", new IOException("IO exception message"), key);
         assertEquals("Message\ncaused by: Message\ncaused by: IO exception message", ae.getCascadedMessage());
         assertEquals(key, ae.getObject());
 
-        assertNotNull(new PfModelRuntimeException("Message"));
-        assertNotNull(new PfModelRuntimeException("Message", "String"));
-        assertNotNull(new PfModelRuntimeException("Message", new IOException()));
-        assertNotNull(new PfModelRuntimeException("Message", new IOException(), "String"));
+        assertNotNull(new PfModelRuntimeException(Response.Status.OK, "Message"));
+        assertNotNull(new PfModelRuntimeException(Response.Status.OK, "Message", "String"));
+        assertNotNull(new PfModelRuntimeException(Response.Status.OK, "Message", new IOException()));
+        assertNotNull(new PfModelRuntimeException(Response.Status.OK, "Message", new IOException(), "String"));
 
         String rkey = "A String";
-        PfModelRuntimeException re = new PfModelRuntimeException("Runtime Message",
-                        new IOException("IO runtime exception message"), rkey);
+        PfModelRuntimeException re = new PfModelRuntimeException(Response.Status.OK, "Runtime Message",
+                new IOException("IO runtime exception message"), rkey);
         assertEquals("Runtime Message\ncaused by: Runtime Message\ncaused by: IO runtime exception message",
-                        re.getCascadedMessage());
+                re.getCascadedMessage());
         assertEquals(key, re.getObject());
     }
 }
diff --git a/models-base/src/test/java/org/onap/policy/models/base/ModelServiceTest.java b/models-base/src/test/java/org/onap/policy/models/base/ModelServiceTest.java
new file mode 100644
index 0000000..0e790d3
--- /dev/null
+++ b/models-base/src/test/java/org/onap/policy/models/base/ModelServiceTest.java
@@ -0,0 +1,105 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+import org.onap.policy.models.base.testconcepts.DummyPfModel;
+
+public class ModelServiceTest {
+
+    @Test
+    public void testModelService() {
+        PfModelService.clear();
+
+        assertFalse(PfModelService.existsModel("NonExistantName"));
+        try {
+            PfModelService.getModel("NonExistantName");
+        } catch (final Exception e) {
+            assertEquals("Model for name NonExistantName not found in model service", e.getMessage());
+        }
+
+        PfModelService.registerModel("ModelName", new DummyPfModel());
+        assertTrue(PfModelService.existsModel("ModelName"));
+        assertNotNull(PfModelService.getModel("ModelName"));
+
+        PfModelService.deregisterModel("ModelName");
+
+        assertFalse(PfModelService.existsModel("ModelName"));
+        try {
+            PfModelService.getModel("ModelName");
+        } catch (final Exception e) {
+            assertEquals("Model for name ModelName not found in model service", e.getMessage());
+        }
+
+        PfModelService.registerModel("ModelName", new DummyPfModel());
+        assertTrue(PfModelService.existsModel("ModelName"));
+        assertNotNull(PfModelService.getModel("ModelName"));
+
+        PfModelService.clear();
+        assertFalse(PfModelService.existsModel("ModelName"));
+        try {
+            PfModelService.getModel("ModelName");
+        } catch (final Exception e) {
+            assertEquals("Model for name ModelName not found in model service", e.getMessage());
+        }
+
+        try {
+            PfModelService.registerModel(null, null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("modelKey is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            PfModelService.registerModel("nullModelName", null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("model is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            PfModelService.registerModel(null, new DummyPfModel());
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("modelKey is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            PfModelService.deregisterModel(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("modelKey is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            PfModelService.getModel(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("modelKey is marked @NonNull but is null", exc.getMessage());
+        }
+    }
+}
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
new file mode 100644
index 0000000..0ed04c4
--- /dev/null
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java
@@ -0,0 +1,199 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.junit.Test;
+import org.onap.policy.models.base.testconcepts.DummyPfConcept;
+import org.onap.policy.models.base.testconcepts.DummyPfConceptContainer;
+import org.onap.policy.models.base.testconcepts.DummyPfConceptSub;
+
+/**
+ * Test the PfCOnceptCOntainer class.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class PfConceptContainerTest {
+
+    @Test
+    public void test() {
+        DummyPfConceptContainer container = new DummyPfConceptContainer();
+        assertNotNull(container);
+
+        container = new DummyPfConceptContainer();
+        assertNotNull(container);
+
+        container = new DummyPfConceptContainer(new PfConceptKey());
+        assertNotNull(container);
+
+        container = new DummyPfConceptContainer(new PfConceptKey(), new TreeMap<PfConceptKey, DummyPfConcept>());
+        assertNotNull(container);
+
+        try {
+            container = new DummyPfConceptContainer((PfConceptKey) null, null);
+            fail("test should throw an exception here");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            container = new DummyPfConceptContainer(new PfConceptKey(), null);
+            fail("test should throw an exception here");
+        } catch (Exception exc) {
+            assertEquals("conceptMap is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            container = new DummyPfConceptContainer(null, new TreeMap<PfConceptKey, DummyPfConcept>());
+            fail("test should throw an exception here");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        container.getKey().setName("Dummy");
+        DummyPfConceptContainer clonedContainer = new DummyPfConceptContainer(container);
+        assertNotNull(clonedContainer);
+        assertEquals("Dummy", clonedContainer.getKey().getName());
+
+        try {
+            DummyPfConceptContainer conceptContainter = null;
+            container = new DummyPfConceptContainer(conceptContainter);
+            fail("test should throw an exception here");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        List<PfKey> keyList = container.getKeys();
+        assertEquals(1, keyList.size());
+
+        PfConceptKey conceptKey = new PfConceptKey("Key", "0.0.1");
+        Map<PfConceptKey, DummyPfConcept> conceptMap = new TreeMap<>();
+        conceptMap.put(conceptKey, new DummyPfConcept(conceptKey));
+
+        container.setConceptMap(conceptMap);
+        keyList = container.getKeys();
+        assertEquals(2, keyList.size());
+
+        clonedContainer = new DummyPfConceptContainer(container);
+        assertNotNull(clonedContainer);
+        assertEquals("Dummy", clonedContainer.getKey().getName());
+        assertEquals(2, clonedContainer.getKeys().size());
+
+        assertEquals(clonedContainer, container);
+        container.clean();
+        assertEquals(clonedContainer, container);
+
+        PfValidationResult result = new PfValidationResult();
+        result = container.validate(result);
+        assertTrue(result.isOk());
+
+        assertEquals(0, container.compareTo(clonedContainer));
+
+        try {
+            container.copyTo(null);
+            fail("test should throw an exception here");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertFalse(container.compareTo(null) == 0);
+        assertEquals(0, container.compareTo(container));
+        assertFalse(container.compareTo(conceptKey) == 0);
+
+        DummyPfConceptContainer testContainer = new DummyPfConceptContainer(container);
+        testContainer.getKey().setVersion("0.0.2");
+        assertFalse(container.compareTo(testContainer) == 0);
+        testContainer.getKey().setVersion(container.getKey().getVersion());
+        assertEquals(0, container.compareTo(testContainer));
+
+        PfConceptKey testConceptKey = new PfConceptKey("TestKey", "0.0.1");
+        testContainer.getConceptMap().put(testConceptKey, new DummyPfConcept(testConceptKey));
+        assertFalse(container.compareTo(testContainer) == 0);
+
+        try {
+            container.validate(null);
+            fail("test should throw an exception here");
+        } catch (Exception exc) {
+            assertEquals("resultIn is marked @NonNull but is null", exc.getMessage());
+        }
+
+        DummyPfConceptContainer validateContainer = new DummyPfConceptContainer();
+        assertFalse(validateContainer.validate(new PfValidationResult()).isOk());
+        validateContainer.setKey(new PfConceptKey("VCKey", "0.0.1"));
+        assertFalse(validateContainer.validate(new PfValidationResult()).isOk());
+
+        validateContainer.getConceptMap().put(testConceptKey, new DummyPfConcept(testConceptKey));
+        assertTrue(validateContainer.validate(new PfValidationResult()).isOk());
+
+        validateContainer.getConceptMap().put(PfConceptKey.getNullKey(), new DummyPfConcept(PfConceptKey.getNullKey()));
+        assertFalse(validateContainer.validate(new PfValidationResult()).isOk());
+        validateContainer.getConceptMap().remove(PfConceptKey.getNullKey());
+        assertTrue(validateContainer.validate(new PfValidationResult()).isOk());
+
+        validateContainer.getConceptMap().put(testConceptKey, null);
+        assertFalse(validateContainer.validate(new PfValidationResult()).isOk());
+        validateContainer.getConceptMap().put(testConceptKey, new DummyPfConcept(testConceptKey));
+        assertTrue(validateContainer.validate(new PfValidationResult()).isOk());
+
+        validateContainer.getConceptMap().put(testConceptKey, new DummyPfConcept(conceptKey));
+        assertFalse(validateContainer.validate(new PfValidationResult()).isOk());
+        validateContainer.getConceptMap().put(testConceptKey, new DummyPfConcept(testConceptKey));
+        assertTrue(validateContainer.validate(new PfValidationResult()).isOk());
+
+        assertEquals(conceptKey, container.get(conceptKey).getKey());
+        assertEquals(conceptKey, container.get(conceptKey.getName()).getKey());
+        assertEquals(conceptKey, container.get(conceptKey.getName(), conceptKey.getVersion()).getKey());
+
+        Set<DummyPfConcept> returnSet = container.getAll(conceptKey.getName());
+        assertEquals(conceptKey, returnSet.iterator().next().getKey());
+
+        returnSet = container.getAll(conceptKey.getName(), conceptKey.getVersion());
+        assertEquals(conceptKey, returnSet.iterator().next().getKey());
+
+        container.getConceptMap().put(conceptKey, new DummyPfConceptSub(conceptKey));
+
+        DummyPfConceptContainer exceptionOnCopyContainer = new DummyPfConceptContainer();
+        try {
+            container.copyTo(exceptionOnCopyContainer);
+            fail("test should throw an exception here");
+        } catch (Exception exc) {
+            assertEquals(
+                    "Failed to create a clone of class \"org.onap.policy.models.base.testconcepts.DummyPfConceptSub\"",
+                    exc.getMessage());
+        }
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void testnullKey() {
+        PfConceptKey nullKey = null;
+        new DummyPfConceptContainer(nullKey);
+    }
+}
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfConceptGetterImplTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfConceptGetterImplTest.java
index 0a5ccdc..ae5b2ff 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfConceptGetterImplTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfConceptGetterImplTest.java
@@ -32,12 +32,12 @@
 import org.junit.Test;
 
 /**
- * Test the AxConceptGetterImpl class.
+ * Test the given concept class.
  */
 public class PfConceptGetterImplTest {
 
     @Test
-    public void testAxConceptGetterImpl() {
+    public void testPfConceptGetterImpl() {
         NavigableMap<PfConceptKey, PfConceptKey> keyMap = new TreeMap<>();
 
         PfConceptGetterImpl<PfConceptKey> getter = new PfConceptGetterImpl<>(keyMap);
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfKeyTest.java
index 1ffc5d2..848889c 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfKeyTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfKeyTest.java
@@ -31,8 +31,8 @@
 import org.junit.Test;
 
 import org.onap.policy.models.base.PfKey.Compatibility;
-import org.onap.policy.models.base.testpojos.DummyPfConcept;
-import org.onap.policy.models.base.testpojos.DummyPfKey;
+import org.onap.policy.models.base.testconcepts.DummyPfConcept;
+import org.onap.policy.models.base.testconcepts.DummyPfKey;
 
 public class PfKeyTest {
 
@@ -67,6 +67,9 @@
         PfConceptKey someKey4 = new PfConceptKey(someKey1);
         someKey4.setVersion("0.1.2");
 
+        PfConceptKey someKey4a = new PfConceptKey(someKey1);
+        someKey4a.setVersion("0");
+
         PfConceptKey someKey5 = new PfConceptKey(someKey1);
         someKey5.setVersion("1.2.2");
 
@@ -77,13 +80,25 @@
 
         PfConcept pfc = new DummyPfConcept();
         assertEquals(PfConceptKey.getNullKey().getId(), pfc.getId());
+
         assertTrue(PfConceptKey.getNullKey().matchesId(pfc.getId()));
 
+        assertTrue(PfConceptKey.getNullKey().isNullKey());
+
+        try {
+            PfConceptKey.getNullKey().matchesId(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("id is marked @NonNull but is null", exc.getMessage());
+        }
+
         assertEquals(Compatibility.DIFFERENT, someKey0.getCompatibility(new DummyPfKey()));
         assertEquals(Compatibility.DIFFERENT, someKey0.getCompatibility(someKey1));
         assertEquals(Compatibility.IDENTICAL, someKey2.getCompatibility(someKey1));
         assertEquals(Compatibility.PATCH, someKey3.getCompatibility(someKey1));
         assertEquals(Compatibility.MINOR, someKey4.getCompatibility(someKey1));
+        assertEquals(Compatibility.PATCH, someKey4a.getCompatibility(someKey1));
+        assertEquals(Compatibility.PATCH, someKey1.getCompatibility(someKey4a));
         assertEquals(Compatibility.MAJOR, someKey5.getCompatibility(someKey1));
         assertEquals(Compatibility.MAJOR, someKey6.getCompatibility(someKey1));
 
@@ -119,8 +134,9 @@
 
         try {
             someKey0.compareTo(null);
-        } catch (IllegalArgumentException e) {
-            assertEquals("comparison object may not be null", e.getMessage());
+            fail("test should throw an exception here");
+        } catch (NullPointerException e) {
+            assertEquals("otherObj is marked @NonNull but is null", e.getMessage());
         }
 
         assertEquals(0, someKey0.compareTo(someKey0));
@@ -131,6 +147,51 @@
         assertFalse(((PfKey) someKey0).equals(new DummyPfKey()));
     }
 
+    @Test
+    public void testNullArguments() {
+        try {
+            new PfConceptKey((String)null);
+            fail("test should throw an exception here");
+        } catch (Exception exc) {
+            assertEquals("id is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new PfConceptKey((PfConceptKey)null);
+            fail("id is marked @NonNull but is null");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new PfConceptKey(null, null);
+            fail("id is marked @NonNull but is null");
+        } catch (Exception exc) {
+            assertEquals("name is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new PfConceptKey("name", null);
+            fail("id is marked @NonNull but is null");
+        } catch (Exception exc) {
+            assertEquals("version is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new PfConceptKey(null, "0.0.1");
+            fail("id is marked @NonNull but is null");
+        } catch (Exception exc) {
+            assertEquals("name is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            PfConceptKey key = new PfConceptKey("AKey", "0.0.1");
+            key.isCompatible(null);
+            fail("id is marked @NonNull but is null");
+        } catch (Exception exc) {
+            assertEquals("otherKey is marked @NonNull but is null", exc.getMessage());
+        }
+    }
 
     @Test
     public void testValidation() {
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 7dbde74..ccdc72d 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
@@ -25,24 +25,35 @@
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import org.junit.Test;
 import org.onap.policy.models.base.PfKey.Compatibility;
+import org.onap.policy.models.base.testconcepts.DummyPfConceptKeySub;
 
 public class PfKeyUseTest {
 
+    @SuppressWarnings("unlikely-arg-type")
     @Test
-    public void test() {
+    public void testKeyUse() {
         assertNotNull(new PfKeyUse());
         assertNotNull(new PfKeyUse(new PfConceptKey()));
         assertNotNull(new PfKeyUse(new PfReferenceKey()));
 
+        try {
+            new PfKeyUse((PfKeyUse)null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
         PfConceptKey key = new PfConceptKey("Key", "0.0.1");
         PfKeyUse keyUse = new PfKeyUse();
         keyUse.setKey(key);
         assertEquals(key, keyUse.getKey());
         assertEquals("Key:0.0.1", keyUse.getId());
         assertEquals(key, keyUse.getKeys().get(0));
+        assertFalse(keyUse.isNullKey());
 
         assertEquals(Compatibility.IDENTICAL, keyUse.getCompatibility(key));
         assertTrue(keyUse.isCompatible(key));
@@ -74,5 +85,51 @@
         PfKeyUse keyUseNull = new PfKeyUse(PfConceptKey.getNullKey());
         PfValidationResult resultNull = new PfValidationResult();
         assertEquals(false, keyUseNull.validate(resultNull).isValid());
+
+        try {
+            keyUse.setKey(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            keyUse.getCompatibility(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("otherKey is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            keyUse.isCompatible(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("otherKey is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            keyUse.validate(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("result is marked @NonNull but is null", exc.getMessage());
+        }
+
+        PfKeyUse testKeyUse = new PfKeyUse(new DummyPfConceptKeySub(new PfConceptKey()));
+        PfKeyUse targetKeyUse = new PfKeyUse(key);
+
+        try {
+            keyUse.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            testKeyUse.copyTo(targetKeyUse);
+            keyUse.isCompatible(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("error copying concept key: Some error message", exc.getMessage());
+        }
     }
 }
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
new file mode 100644
index 0000000..cf7c41f
--- /dev/null
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java
@@ -0,0 +1,145 @@
+package org.onap.policy.models.base;
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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=========================================================
+ */
+
+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 static org.junit.Assert.fail;
+
+import org.junit.Test;
+import org.onap.policy.models.base.testconcepts.DummyPfModel;
+
+/**
+ * Test of the PfModel clas.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class PfModelTest {
+
+    @Test
+    public void testPfModel() {
+        assertNotNull(new DummyPfModel());
+        assertNotNull(new DummyPfModel(new PfConceptKey()));
+        assertNotNull(new DummyPfModel(new DummyPfModel()));
+
+        try {
+            new DummyPfModel((PfConceptKey)null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            DummyPfModel nullModel = null;
+            new DummyPfModel(nullModel);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        DummyPfModel dpm = new DummyPfModel(new PfConceptKey("modelKey", "0.0.1"));
+        DummyPfModel dpmClone = new DummyPfModel(dpm);
+        assertEquals(dpm, dpmClone);
+
+        assertEquals(1, dpm.getKeys().size());
+
+        dpmClone.clean();
+        assertEquals(dpm, dpmClone);
+
+        try {
+            dpm.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertEquals(0, dpm.compareTo(dpmClone));
+        assertEquals(-1, dpm.compareTo(null));
+        assertEquals(0, dpm.compareTo(dpm));
+        assertFalse(dpm.compareTo(dpm.getKey()) == 0);
+    }
+
+    @Test
+    public void testPfModelValidation() {
+        PfConceptKey dpmKey = new PfConceptKey("modelKey", "0.0.1");
+        DummyPfModel dpm = new DummyPfModel(dpmKey);
+        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+
+        try {
+            dpm.validate(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("resultIn is marked @NonNull but is null", exc.getMessage());
+        }
+
+        dpm.setKey(PfConceptKey.getNullKey());
+        assertFalse(dpm.validate(new PfValidationResult()).isValid());
+        dpm.setKey(dpmKey);
+        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+
+        dpm.getKeyList().add(PfReferenceKey.getNullKey());
+        dpm.getKeyList().add(new PfKeyUse(PfReferenceKey.getNullKey()));
+        assertFalse(dpm.validate(new PfValidationResult()).isValid());
+        dpm.getKeyList().clear();
+        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+
+        PfConceptKey goodCKey = new PfConceptKey("goodCKey", "0.0.1");
+        PfReferenceKey goodRKey = new PfReferenceKey(goodCKey, "goodLocalName");
+
+        dpm.getKeyList().add(goodCKey);
+        dpm.getKeyList().add(goodRKey);
+        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+
+        PfConceptKey goodCKeyDup = new PfConceptKey(goodCKey);
+        dpm.getKeyList().add(goodCKeyDup);
+        assertFalse(dpm.validate(new PfValidationResult()).isValid());
+        dpm.getKeyList().remove(goodCKeyDup);
+        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+
+        PfReferenceKey goodRKeyDup = new PfReferenceKey(goodRKey);
+        dpm.getKeyList().add(goodRKeyDup);
+        assertFalse(dpm.validate(new PfValidationResult()).isValid());
+        dpm.getKeyList().remove(goodRKeyDup);
+        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+
+        PfKeyUse goodCKeyUse = new PfKeyUse(goodCKey);
+        dpm.getKeyList().add(goodCKeyUse);
+        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+
+        PfKeyUse goodRKeyUse = new PfKeyUse(goodRKey);
+        dpm.getKeyList().add(goodRKeyUse);
+        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+
+        PfConceptKey badCKey = new PfConceptKey("badCKey", "0.0.1");
+        PfKeyUse badCKeyUse = new PfKeyUse(badCKey);
+        dpm.getKeyList().add(badCKeyUse);
+        assertFalse(dpm.validate(new PfValidationResult()).isValid());
+        dpm.getKeyList().remove(badCKeyUse);
+        assertTrue(dpm.validate(new PfValidationResult()).isValid());
+
+        PfKeyUse badRKeyUse = new PfKeyUse(new PfReferenceKey(badCKey, "badLocalName"));
+        dpm.getKeyList().add(badRKeyUse);
+        assertFalse(dpm.validate(new PfValidationResult()).isValid());
+        dpm.getKeyList().remove(badRKeyUse);
+        assertTrue(dpm.validate(new PfValidationResult()).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 feedc2c..64d4bc6 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
@@ -47,10 +47,20 @@
         assertEquals(PfReferenceKey.getNullKey().getKey(), PfReferenceKey.getNullKey());
         assertEquals("NULL:0.0.0:NULL:NULL", PfReferenceKey.getNullKey().getId());
 
+        try {
+            new PfReferenceKey(new PfConceptKey(), null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("parameter \"localName\" is null", exc.getMessage());
+        }
+
         PfReferenceKey testReferenceKey = new PfReferenceKey();
         testReferenceKey.setParentConceptKey(new PfConceptKey("PN", "0.0.1"));
         assertEquals("PN:0.0.1", testReferenceKey.getParentConceptKey().getId());
 
+        assertEquals(1, testReferenceKey.getKeys().size());
+        assertFalse(testReferenceKey.isNullKey());
+
         testReferenceKey.setParentReferenceKey(new PfReferenceKey("PN", "0.0.1", "LN"));
         assertEquals("PN:0.0.1:NULL:LN", testReferenceKey.getParentReferenceKey().getId());
 
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java
new file mode 100644
index 0000000..2b495a1
--- /dev/null
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import org.junit.Test;
+
+/**
+ * Test the PfUtils class.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class PfUtilsTest {
+
+    @Test
+    public void testPfUtils() {
+        assertEquals(0, PfUtils.compareObjects(null, null));
+        assertEquals(-1, PfUtils.compareObjects("hello", null));
+        assertEquals(1, PfUtils.compareObjects(null, "hello"));
+        assertFalse(PfUtils.compareObjects("hello", "goodbye") == 0);
+        assertEquals(0, PfUtils.compareObjects("hello", "hello"));
+    }
+}
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
new file mode 100644
index 0000000..9fb6b57
--- /dev/null
+++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConcept.java
@@ -0,0 +1,137 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.testconcepts;
+
+import java.util.List;
+
+import javax.persistence.EmbeddedId;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NonNull;
+
+import org.apache.commons.lang3.ObjectUtils;
+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.PfValidationMessage;
+import org.onap.policy.models.base.PfValidationResult;
+import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class DummyPfConcept extends PfConcept {
+    private static final long serialVersionUID = 1L;
+    @EmbeddedId
+    private PfConceptKey key;
+
+    private String description;
+
+    /**
+     * The Default Constructor creates a {@link DummyPfConcept} object with a null key.
+     */
+    public DummyPfConcept() {
+        this(new PfConceptKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link DummyPfConcept} object with the given concept key.
+     *
+     * @param key the key
+     */
+    public DummyPfConcept(@NonNull final PfConceptKey key) {
+        this.key = key;
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public DummyPfConcept(final DummyPfConcept copyConcept) {
+        super(copyConcept);
+    }
+
+    @Override
+    public List<PfKey> getKeys() {
+        final List<PfKey> keyList = getKey().getKeys();
+        return keyList;
+    }
+
+    @Override
+    public void clean() {
+        key.clean();
+
+        description = (description != null ? description.trim() : null);
+    }
+
+    @Override
+    public PfValidationResult validate(PfValidationResult resultIn) {
+        PfValidationResult result = resultIn;
+
+        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"));
+        }
+
+        return result;
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+        if (this == otherConcept) {
+            return 0;
+        }
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final DummyPfConcept other = (DummyPfConcept) otherConcept;
+        if (!key.equals(other.key)) {
+            return key.compareTo(other.key);
+        }
+
+        return ObjectUtils.compare(description, other.description);
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull PfConcept target) {
+        final Object copyObject = target;
+        Assertions.instanceOf(copyObject, PfConcept.class);
+
+        final DummyPfConcept copy = ((DummyPfConcept) copyObject);
+        copy.setKey(new PfConceptKey(key));
+        copy.setDescription(description);
+
+        return copy;
+    }
+}
diff --git a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptContainer.java b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptContainer.java
new file mode 100644
index 0000000..ac72ef8
--- /dev/null
+++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptContainer.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.testconcepts;
+
+import java.util.Map;
+
+import lombok.NonNull;
+
+import org.onap.policy.models.base.PfConceptContainer;
+import org.onap.policy.models.base.PfConceptKey;
+
+/**
+ * Dummy container for PF concepts.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class DummyPfConceptContainer extends PfConceptContainer<DummyPfConcept> {
+    private static final long serialVersionUID = -3018432331484294280L;
+
+
+    /**
+     * The Default Constructor creates a {@link DummyPfConceptContainer} object with a null artifact key
+     * and creates an empty concept map.
+     */
+    public DummyPfConceptContainer() {
+        super();
+    }
+
+    /**
+     * The Key Constructor creates a {@link DummyPfConceptContainer} object with the given artifact key and
+     * creates an empty concept map.
+     *
+     * @param key the concept key
+     */
+    public DummyPfConceptContainer(@NonNull final PfConceptKey key) {
+        super(key);
+    }
+
+    /**
+     * This Constructor creates an concept container with all of its fields defined.
+     *
+     * @param key the concept container key
+     * @param conceptMap the concepts to be stored in the concept container
+     */
+    public DummyPfConceptContainer(@NonNull final PfConceptKey key,
+            @NonNull final Map<PfConceptKey, DummyPfConcept> conceptMap) {
+        super(key, conceptMap);
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public DummyPfConceptContainer(@NonNull final DummyPfConceptContainer copyConcept) {
+        super(copyConcept);
+    }
+
+}
diff --git a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptKeySub.java b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptKeySub.java
new file mode 100644
index 0000000..da18cba
--- /dev/null
+++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptKeySub.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.testconcepts;
+
+import javax.ws.rs.core.Response;
+
+import lombok.NonNull;
+
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfModelRuntimeException;
+
+/**
+ * KeyUse subclass that throws exception on default constructor for testing.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class DummyPfConceptKeySub extends PfConceptKey {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * The Default Constructor creates this concept with a null key.
+     */
+    public DummyPfConceptKeySub() {
+        throw new PfModelRuntimeException(Response.Status.BAD_GATEWAY, "Some error message");
+    }
+
+    /**
+     * This constructor creates an instance of this class, and holds a reference to a used key.
+     *
+     * @param usedKey a used key
+     */
+    public DummyPfConceptKeySub(@NonNull final PfConceptKey usedKey) {
+        super(usedKey);
+    }
+}
diff --git a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptSub.java b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptSub.java
new file mode 100644
index 0000000..12875ea
--- /dev/null
+++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConceptSub.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.testconcepts;
+
+import javax.ws.rs.core.Response;
+
+import lombok.NonNull;
+
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfModelRuntimeException;
+
+public class DummyPfConceptSub extends DummyPfConcept {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * The Default Constructor creates a {@link DummyPfConceptSub} object with a null key.
+     */
+    public DummyPfConceptSub() {
+        throw new PfModelRuntimeException(Response.Status.BAD_GATEWAY, "Some error message");
+    }
+
+    /**
+     * The Key Constructor creates a {@link DummyPfConceptSub} object with the given concept key.
+     *
+     * @param key the key
+     */
+    public DummyPfConceptSub(@NonNull final PfConceptKey key) {
+        super(key);
+    }
+}
diff --git a/models-base/src/test/java/org/onap/policy/models/base/testpojos/DummyPfKey.java b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java
similarity index 94%
rename from models-base/src/test/java/org/onap/policy/models/base/testpojos/DummyPfKey.java
rename to models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java
index 247ea88..6cf41e6 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/testpojos/DummyPfKey.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java
@@ -18,7 +18,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.policy.models.base.testpojos;
+package org.onap.policy.models.base.testconcepts;
 
 import java.util.Arrays;
 import java.util.List;
@@ -41,6 +41,11 @@
     }
 
     @Override
+    public boolean isNullKey() {
+        return false;
+    }
+
+    @Override
     public Compatibility getCompatibility(PfKey otherKey) {
         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
new file mode 100644
index 0000000..199a37f
--- /dev/null
+++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfModel.java
@@ -0,0 +1,174 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.testconcepts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+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.PfModel;
+import org.onap.policy.models.base.PfModelRuntimeException;
+import org.onap.policy.models.base.PfValidationResult;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class DummyPfModel extends PfModel {
+    private static final long serialVersionUID = 8800599637708309945L;
+
+    private List<PfKey> keyList;
+
+    /**
+     * The Default Constructor creates a {@link DummyPfModel} object with a null concept key and
+     * creates an empty TOSCA model.
+     */
+    public DummyPfModel() {
+        super();
+        super.setKey(new PfConceptKey());
+        this.keyList = new ArrayList<PfKey>();
+    }
+
+    /**
+     * The Key Constructor creates a {@link DummyPfModel} object with the given concept key and
+     * creates an empty TOSCA model.
+     *
+     * @param key the TOSCA model key
+     */
+    public DummyPfModel(final PfConceptKey key) {
+        super(key);
+        this.keyList = new ArrayList<PfKey>();
+    }
+
+    /**
+     * Constructor that initiates a {@link ToscaModel} with all its fields.
+     *
+     * @param key the TOSCA model key
+     * @param keyList the service templates in the event model
+     */
+    public DummyPfModel(final PfConceptKey key, final List<PfKey> keyList) {
+        super(key);
+        this.keyList = keyList;
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public DummyPfModel(final DummyPfModel copyConcept) {
+        super(copyConcept);
+    }
+
+    @Override
+    public void register() {
+    }
+
+    @Override
+    public List<PfKey> getKeys() {
+        final List<PfKey> listOfKeys = super.getKeys();
+
+        listOfKeys.addAll(keyList);
+
+        return listOfKeys;
+    }
+
+    @Override
+    public void clean() {
+        super.clean();
+        for (PfKey pfKey : keyList) {
+            pfKey.clean();
+        }
+    }
+
+    @Override
+    public PfValidationResult validate(final PfValidationResult resultIn) {
+        PfValidationResult result = super.validate(resultIn);
+
+        for (PfKey pfKey : keyList) {
+            result = pfKey.validate(result);
+        }
+
+        return result;
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (super.compareTo(otherConcept) != 0) {
+            return super.compareTo(otherConcept);
+        }
+
+        if (otherConcept == null) {
+            return -1;
+        }
+
+        if (this == otherConcept) {
+            return 0;
+        }
+
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final DummyPfModel other = (DummyPfModel) otherConcept;
+        if (!super.equals(other)) {
+            return super.compareTo(other);
+        }
+
+        if (!keyList.equals(other.keyList)) {
+            return (keyList.hashCode() - other.keyList.hashCode());
+        }
+
+        return 0;
+    }
+
+    @Override
+    public PfConcept copyTo(final PfConcept targetObject) {
+        super.copyTo(targetObject);
+
+        Assertions.instanceOf(targetObject, DummyPfModel.class);
+
+        final DummyPfModel copy = ((DummyPfModel) targetObject);
+
+        final List<PfKey> newKeyList = new ArrayList<>();
+        for (final PfKey pfKey : keyList) {
+            PfKey newPfKey;
+            try {
+                newPfKey = pfKey.getClass().newInstance();
+            } catch (final Exception e) {
+                throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR,
+                        "error copying concept key: " + e.getMessage(), e);
+            }
+            newPfKey.copyTo(pfKey);
+            newKeyList.add(newPfKey);
+        }
+        copy.setKeyList(newKeyList);
+
+
+        return copy;
+    }
+}
diff --git a/models-base/src/test/java/org/onap/policy/models/base/testpojos/DummyPfConcept.java b/models-base/src/test/java/org/onap/policy/models/base/testpojos/DummyPfConcept.java
deleted file mode 100644
index f28477f..0000000
--- a/models-base/src/test/java/org/onap/policy/models/base/testpojos/DummyPfConcept.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2019 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.testpojos;
-
-import java.util.Arrays;
-import java.util.List;
-
-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;
-
-public class DummyPfConcept extends PfConcept {
-    private static final long serialVersionUID = 1L;
-
-    @Override
-    public int compareTo(PfConcept concept) {
-        return 0;
-    }
-
-    @Override
-    public PfKey getKey() {
-        return new PfConceptKey();
-    }
-
-    @Override
-    public List<PfKey> getKeys() {
-        return Arrays.asList(getKey());
-    }
-
-    @Override
-    public PfValidationResult validate(PfValidationResult result) {
-        return null;
-    }
-
-    @Override
-    public void clean() {
-    }
-
-    @Override
-    public boolean equals(Object otherObject) {
-        return false;
-    }
-
-    @Override
-    public String toString() {
-        return null;
-    }
-
-    @Override
-    public int hashCode() {
-        return 0;
-    }
-
-    @Override
-    public PfConcept copyTo(PfConcept target) {
-        return null;
-    }
-}
diff --git a/models-dao/src/main/java/org/onap/policy/models/dao/DaoParameters.java b/models-dao/src/main/java/org/onap/policy/models/dao/DaoParameters.java
index 18ae74a..a6b6f2f 100644
--- a/models-dao/src/main/java/org/onap/policy/models/dao/DaoParameters.java
+++ b/models-dao/src/main/java/org/onap/policy/models/dao/DaoParameters.java
@@ -24,6 +24,8 @@
 
 /**
  * This class is a POJO that holds properties for PF DAOs.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
  */
 public class DaoParameters {
     /** The default PF DAO plugin class. */
diff --git a/models-dao/src/main/java/org/onap/policy/models/dao/PfDaoFactory.java b/models-dao/src/main/java/org/onap/policy/models/dao/PfDaoFactory.java
index 3b7e31e..6b7c7b3 100644
--- a/models-dao/src/main/java/org/onap/policy/models/dao/PfDaoFactory.java
+++ b/models-dao/src/main/java/org/onap/policy/models/dao/PfDaoFactory.java
@@ -20,6 +20,8 @@
 
 package org.onap.policy.models.dao;
 
+import javax.ws.rs.core.Response;
+
 import org.onap.policy.common.utils.validation.Assertions;
 import org.onap.policy.models.base.PfModelException;
 import org.slf4j.Logger;
@@ -28,6 +30,8 @@
 /**
  * This factory class returns a Policy Framework DAO for the configured persistence mechanism. The
  * factory uses the plugin class specified in {@link DaoParameters} to instantiate a DAO instance.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
  */
 public class PfDaoFactory {
     // Get a reference to the logger
@@ -52,7 +56,7 @@
             String errorMessage =
                     "Policy Framework DAO class not found for DAO plugin \"" + daoParameters.getPluginClass() + "\"";
             LOGGER.error(errorMessage, e);
-            throw new PfModelException(errorMessage, e);
+            throw new PfModelException(Response.Status.INTERNAL_SERVER_ERROR, errorMessage, e);
         }
 
         // Check the class is a Policy Framework DAO
@@ -60,7 +64,7 @@
             String errorMessage = "Specified DAO plugin class \"" + daoParameters.getPluginClass()
                     + "\" does not implement the PfDao interface";
             LOGGER.error(errorMessage);
-            throw new PfModelException(errorMessage);
+            throw new PfModelException(Response.Status.INTERNAL_SERVER_ERROR, errorMessage);
         }
 
         return (PfDao) pfDaoObject;
diff --git a/models-dao/src/main/java/org/onap/policy/models/dao/converters/CDataConditioner.java b/models-dao/src/main/java/org/onap/policy/models/dao/converters/CDataConditioner.java
index 327f65e..e4cfd74 100644
--- a/models-dao/src/main/java/org/onap/policy/models/dao/converters/CDataConditioner.java
+++ b/models-dao/src/main/java/org/onap/policy/models/dao/converters/CDataConditioner.java
@@ -25,7 +25,7 @@
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 
 /**
- * The Class CDATAConditioner converts a CDATA String to and from database format by removing spaces
+ * The Class CDataConditioner converts a CDATA String to and from database format by removing spaces
  * at the ends of lines and platform-specific new line endings.
  */
 @Converter
diff --git a/models-dao/src/main/java/org/onap/policy/models/dao/converters/Uuid2String.java b/models-dao/src/main/java/org/onap/policy/models/dao/converters/Uuid2String.java
index a2b1c08..369b5a1 100644
--- a/models-dao/src/main/java/org/onap/policy/models/dao/converters/Uuid2String.java
+++ b/models-dao/src/main/java/org/onap/policy/models/dao/converters/Uuid2String.java
@@ -27,7 +27,9 @@
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 
 /**
- * The Class UUIDConverter converts a UUID to and from database format.
+ * The Class UuidConverter converts a UUID to and from database format.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
  */
 @Converter
 public class Uuid2String extends XmlAdapter<String, UUID> implements AttributeConverter<UUID, String> {
diff --git a/models-dao/src/main/java/org/onap/policy/models/dao/converters/package-info.java b/models-dao/src/main/java/org/onap/policy/models/dao/converters/package-info.java
index 416eff2..184f59b 100644
--- a/models-dao/src/main/java/org/onap/policy/models/dao/converters/package-info.java
+++ b/models-dao/src/main/java/org/onap/policy/models/dao/converters/package-info.java
@@ -21,6 +21,8 @@
 /**
  * Contains converters used by PF EclipseLink marshaling and unmarshaling of
  * {@link org.onap.policy.models.base.PfConcept} instances to and from files and databases.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
  */
 
 package org.onap.policy.models.dao.converters;
diff --git a/models-dao/src/main/java/org/onap/policy/models/dao/impl/DefaultPfDao.java b/models-dao/src/main/java/org/onap/policy/models/dao/impl/DefaultPfDao.java
index 429632d..947b866 100644
--- a/models-dao/src/main/java/org/onap/policy/models/dao/impl/DefaultPfDao.java
+++ b/models-dao/src/main/java/org/onap/policy/models/dao/impl/DefaultPfDao.java
@@ -27,6 +27,7 @@
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.Persistence;
+import javax.ws.rs.core.Response;
 
 import org.onap.policy.models.base.PfConcept;
 import org.onap.policy.models.base.PfConceptKey;
@@ -61,7 +62,8 @@
     public void init(final DaoParameters daoParameters) throws PfModelException {
         if (daoParameters == null || daoParameters.getPersistenceUnit() == null) {
             LOGGER.error("Policy Framework persistence unit parameter not set");
-            throw new PfModelException("Policy Framework persistence unit parameter not set");
+            throw new PfModelException(Response.Status.INTERNAL_SERVER_ERROR,
+                    "Policy Framework persistence unit parameter not set");
         }
 
         LOGGER.debug("Creating Policy Framework persistence unit \"{}\" . . .", daoParameters.getPersistenceUnit());
@@ -72,7 +74,7 @@
             String errorMessage = "Creation of Policy Framework persistence unit \""
                     + daoParameters.getPersistenceUnit() + "\" failed";
             LOGGER.warn(errorMessage, ex);
-            throw new PfModelException(errorMessage, ex);
+            throw new PfModelException(Response.Status.INTERNAL_SERVER_ERROR, errorMessage, ex);
         }
         LOGGER.debug("Created Policy Framework persistence unit \"{}\"", daoParameters.getPersistenceUnit());
     }
@@ -85,7 +87,8 @@
     protected final synchronized EntityManager getEntityManager() {
         if (emf == null) {
             LOGGER.warn("Policy Framework DAO has not been initialized");
-            throw new PfModelRuntimeException("Policy Framework DAO has not been initialized");
+            throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR,
+                    "Policy Framework DAO has not been initialized");
         }
 
         return emf.createEntityManager();
@@ -196,8 +199,7 @@
     }
 
     @Override
-    public <T extends PfConcept> int deleteByConceptKey(final Class<T> someClass,
-            final Collection<PfConceptKey> keys) {
+    public <T extends PfConcept> int deleteByConceptKey(final Class<T> someClass, final Collection<PfConceptKey> keys) {
         if (keys == null || keys.isEmpty()) {
             return 0;
         }
diff --git a/models-dao/src/main/java/org/onap/policy/models/dao/impl/package-info.java b/models-dao/src/main/java/org/onap/policy/models/dao/impl/package-info.java
index 0d27628..f621166 100644
--- a/models-dao/src/main/java/org/onap/policy/models/dao/impl/package-info.java
+++ b/models-dao/src/main/java/org/onap/policy/models/dao/impl/package-info.java
@@ -21,5 +21,7 @@
 /**
  * Contains a default DAO implementation for the PF {@link org.onap.policy.models.base.PfConcept}
  * classes that uses javax persistence.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
  */
 package org.onap.policy.models.dao.impl;
diff --git a/models-dao/src/main/java/org/onap/policy/models/dao/package-info.java b/models-dao/src/main/java/org/onap/policy/models/dao/package-info.java
index e8cfbe4..c4cb6a2 100644
--- a/models-dao/src/main/java/org/onap/policy/models/dao/package-info.java
+++ b/models-dao/src/main/java/org/onap/policy/models/dao/package-info.java
@@ -19,9 +19,11 @@
  */
 
 /**
- * Defines and implements the Data Access Object (DAO) that allows Apex
- * {@link org.onap.policy.apex.model.basicmodel.concepts.AxConcept} concepts to be read from and written to databases
+ * Defines and implements the Data Access Object (DAO) that allows Policy Framework
+ * {@link org.onap.policy.models.base.pfConcept} concepts to be read from and written to databases
  * over JDBC.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
  */
 
 package org.onap.policy.models.dao;
diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/converters/CDataConditionerTest.java b/models-dao/src/test/java/org/onap/policy/models/dao/converters/CDataConditionerTest.java
new file mode 100644
index 0000000..60a42c2
--- /dev/null
+++ b/models-dao/src/test/java/org/onap/policy/models/dao/converters/CDataConditionerTest.java
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.dao.converters;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+/**
+ * Test the CDataConditioner Class.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class CDataConditionerTest {
+
+    @Test
+    public void testCDataConditioner() throws Exception {
+        assertEquals("Raw", new CDataConditioner().convertToDatabaseColumn("Raw"));
+        assertEquals("entityAttribute", new CDataConditioner().convertToEntityAttribute("entityAttribute"));
+        assertEquals("marshal", new CDataConditioner().marshal("marshal"));
+        assertEquals("unmarshal", new CDataConditioner().unmarshal("unmarshal"));
+    }
+}
diff --git a/models-dao/src/test/java/org/onap/policy/models/dao/converters/Uuid2StringConditionerTest.java b/models-dao/src/test/java/org/onap/policy/models/dao/converters/Uuid2StringConditionerTest.java
new file mode 100644
index 0000000..771f0fb
--- /dev/null
+++ b/models-dao/src/test/java/org/onap/policy/models/dao/converters/Uuid2StringConditionerTest.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.dao.converters;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.UUID;
+
+import org.junit.Test;
+
+/**
+ * Test the UUID conditioner class.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class Uuid2StringConditionerTest {
+
+    @Test
+    public void testUuidConditioner() throws Exception {
+        UUID randomUuid = UUID.randomUUID();
+        assertEquals(randomUuid.toString(), new Uuid2String().convertToDatabaseColumn(randomUuid));
+        assertEquals(randomUuid, new Uuid2String().convertToEntityAttribute(randomUuid.toString()));
+        assertEquals(randomUuid.toString(), new Uuid2String().marshal(randomUuid));
+        assertEquals(randomUuid, new Uuid2String().unmarshal(randomUuid.toString()));
+    }
+}
diff --git a/models-provider/pom.xml b/models-provider/pom.xml
new file mode 100644
index 0000000..755aea7
--- /dev/null
+++ b/models-provider/pom.xml
@@ -0,0 +1,54 @@
+<!--
+  ============LICENSE_START=======================================================
+   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=========================================================
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.onap.policy.models</groupId>
+        <artifactId>policy-models</artifactId>
+        <version>2.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>policy-models-provider</artifactId>
+
+    <name>${project.artifactId}</name>
+    <description>The provider interface that allows components to manipualte models in the database</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onap.policy.models</groupId>
+            <artifactId>policy-models-base</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onap.policy.models</groupId>
+            <artifactId>policy-models-dao</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onap.policy.models</groupId>
+            <artifactId>policy-models-tosca</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java
new file mode 100644
index 0000000..0144f8c
--- /dev/null
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java
@@ -0,0 +1,156 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.provider;
+
+import lombok.NonNull;
+
+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.tosca.concepts.ToscaServiceTemplate;
+
+/**
+ * This interface describes the operations that are provided to users and components for reading
+ * objects from and writing objects to the database.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public interface PolicyModelsProvider {
+
+    /**
+     * Get policy types.
+     *
+     * @param policyTypeKey the policy type key for the policy types to be retrieved. A null key
+     *        name returns all policy types. A null key version returns all versions of the policy
+     *        type name specified in the key.
+     * @return the policy types found
+     * @throws PfModelException on errors getting policy types
+     */
+    public ToscaServiceTemplate getPolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException;
+
+    /**
+     * Create policy types.
+     *
+     * @param serviceTemplate the service template containing the definition of the policy types to
+     *        be created
+     * @return the TOSCA service template containing the created policy types
+     * @throws PfModelException on errors creating policy types
+     */
+    public ToscaServiceTemplate createPolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
+            throws PfModelException;
+
+    /**
+     * Create policy types.
+     *
+     * @param serviceTemplate the service template containing the definition of the policy types to
+     *        be modified
+     * @return the TOSCA service template containing the modified policy types
+     * @throws PfModelException on errors updating policy types
+     */
+    public ToscaServiceTemplate updatePolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
+            throws PfModelException;
+
+    /**
+     * Delete policy types.
+     *
+     * @param policyTypeKey the policy type key for the policy types to be deleted, if the version
+     *        of the key is null, all versions of the policy type are deleted.
+     * @return the TOSCA service template containing the policy types that were deleted
+     * @throws PfModelException on errors deleting policy types
+     */
+    public ToscaServiceTemplate deletePolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException;
+
+    /**
+     * Get policies.
+     *
+     * @param policyKey the policy key for the policies to be retrieved. The parent name and version
+     *        must be specified. A null local name returns all policies for a parent policy type.
+     * @return the policies found
+     * @throws PfModelException on errors getting policies
+     */
+    public ToscaServiceTemplate getPolicies(@NonNull final PfReferenceKey policyKey) throws PfModelException;
+
+    /**
+     * Create policies.
+     *
+     * @param serviceTemplate the service template containing the definitions of the new policies to
+     *        be created.
+     * @return the TOSCA service template containing the policy types that were created
+     * @throws PfModelException on errors creating policies
+     */
+    public ToscaServiceTemplate createPolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
+            throws PfModelException;
+
+
+    /**
+     * Update policies.
+     *
+     * @param serviceTemplate the service template containing the definitions of the policies to be
+     *        updated.
+     * @return the TOSCA service template containing the policies that were updated
+     * @throws PfModelException on errors updating policies
+     */
+    public ToscaServiceTemplate updatePolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
+            throws PfModelException;
+
+    /**
+     * Delete policies.
+     *
+     * @param policyKey the policy key
+     * @return the TOSCA service template containing the policy types that were deleted
+     * @throws PfModelException on errors deleting policies
+     */
+    public ToscaServiceTemplate deletePolicies(@NonNull final PfReferenceKey policyKey) throws PfModelException;
+
+    /**
+     * Get PDP groups.
+     *
+     * @param somePdpGroupFilter a filter for the get
+     * @return the PDP groups found
+     * @throws PfModelException on errors getting PDP groups
+     */
+    public Object getPdpGroups(@NonNull final Object somePdpGroupFilter) throws PfModelException;
+
+    /**
+     * Creates PDP groups.
+     *
+     * @param somePdpGroupSpecification a specification for the PDP group
+     * @throws PfModelException on errors creating PDP groups
+     */
+    public Object createPdpGroups(@NonNull final Object somePdpGroupSpecification) throws PfModelException;
+
+
+    /**
+     * Updates PDP groups.
+     *
+     * @param somePdpGroupSpecification a specification for the PDP group
+     * @throws PfModelException on errors updating PDP groups
+     */
+    public Object updatePdpGroups(@NonNull final Object somePdpGroupSpecification) throws PfModelException;
+
+    /**
+     * Delete PDP groups.
+     *
+     * @param somePdpGroupFilter a filter for the get
+     * @throws PfModelException on errors deleting PDP groups
+     */
+    public void deletePdpGroups(@NonNull final Object somePdpGroupFilter) throws PfModelException;
+}
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderFactory.java b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderFactory.java
new file mode 100644
index 0000000..5c43428
--- /dev/null
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderFactory.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.provider;
+
+import org.onap.policy.models.provider.impl.PolicyModelsProviderImpl;
+
+/**
+ * A factory for creating PolicyModelsProvider objects using the default Policy Framework implementation.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class PolicyModelsProviderFactory {
+
+    /**
+     * Creates a new PolicyModelsProvider object from its implementation.
+     */
+    public  PolicyModelsProvider createPolicyModelsProvider() {
+        return new PolicyModelsProviderImpl();
+    }
+}
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/PolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/PolicyModelsProviderImpl.java
new file mode 100644
index 0000000..12d7686
--- /dev/null
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/PolicyModelsProviderImpl.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.provider.impl;
+
+import lombok.NonNull;
+
+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.provider.PolicyModelsProvider;
+import org.onap.policy.models.tosca.concepts.ToscaServiceTemplate;
+
+/**
+ * This class provides the implementaiton of the defalut Policy Models Provider for the ONAP Policy Framework.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class PolicyModelsProviderImpl implements PolicyModelsProvider {
+
+    @Override
+    public ToscaServiceTemplate getPolicyTypes(@NonNull PfConceptKey policyTypeKey) throws PfModelException {
+        return null;
+    }
+
+    @Override
+    public ToscaServiceTemplate createPolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
+            throws PfModelException {
+        return null;
+    }
+
+    @Override
+    public ToscaServiceTemplate deletePolicyTypes(@NonNull PfConceptKey policyTypeKey) throws PfModelException {
+        return null;
+    }
+
+    @Override
+    public ToscaServiceTemplate getPolicies(@NonNull PfReferenceKey policyKey) throws PfModelException {
+        return null;
+    }
+
+    @Override
+    public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
+        return null;
+    }
+
+    @Override
+    public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
+        return null;
+    }
+
+    @Override
+    public ToscaServiceTemplate deletePolicies(@NonNull PfReferenceKey policyKey) throws PfModelException {
+        return null;
+    }
+
+    @Override
+    public ToscaServiceTemplate updatePolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
+            throws PfModelException {
+        return null;
+    }
+
+    @Override
+    public Object getPdpGroups(@NonNull Object somePdpGroupFilter) throws PfModelException {
+        return null;
+    }
+
+    @Override
+    public Object createPdpGroups(@NonNull Object somePdpGroupSpecification) throws PfModelException {
+        return null;
+    }
+
+    @Override
+    public Object updatePdpGroups(@NonNull Object somePdpGroupSpecification) throws PfModelException {
+        return null;
+    }
+
+    @Override
+    public void deletePdpGroups(@NonNull Object somePdpGroupFilter) throws PfModelException {
+    }
+}
diff --git a/models-tosca/pom.xml b/models-tosca/pom.xml
index 839cc72..56c8d7c 100644
--- a/models-tosca/pom.xml
+++ b/models-tosca/pom.xml
@@ -30,7 +30,7 @@
     <artifactId>policy-models-tosca</artifactId>
 
     <name>${project.artifactId}</name>
-    <description>The platform models that are shared across different policy components</description>
+    <description>The TOSCA models that are shared across different policy components</description>
 
     <dependencies>
         <dependency>
@@ -38,5 +38,11 @@
             <artifactId>policy-models-base</artifactId>
             <version>${project.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>org.onap.policy.common</groupId>
+            <artifactId>gson</artifactId>
+            <version>${policy.common.version}</version>
+        </dependency>
     </dependencies>
 </project>
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaConstraint.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaConstraint.java
deleted file mode 100644
index 47a4d35..0000000
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaConstraint.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Model
- * ================================================================================
- * 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.tosca;
-
-import com.google.gson.annotations.SerializedName;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Class to represent the Constraint of property in TOSCA definition.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- *
- */
-@ToString
-public class ToscaConstraint {
-
-    @Getter
-    @Setter
-    @SerializedName("equal")
-    private String equal;
-
-    @Getter
-    @Setter
-    @SerializedName("greater_than")
-    private String greaterThan;
-
-    @Getter
-    @Setter
-    @SerializedName("greater_or_equal")
-    private String greaterOrEqual;
-
-    @Getter
-    @Setter
-    @SerializedName("less_than")
-    private String lessThan;
-
-    @Getter
-    @Setter
-    @SerializedName("less_or_equal")
-    private String lessOrEqual;
-
-    @Getter
-    @Setter
-    @SerializedName("in_range")
-    private String inRange;
-
-    @Getter
-    @Setter
-    @SerializedName("valid_values")
-    private String validValues;
-
-    @Getter
-    @Setter
-    @SerializedName("length")
-    private String length;
-
-    @Getter
-    @Setter
-    @SerializedName("min_length")
-    private String minLength;
-
-    @Getter
-    @Setter
-    @SerializedName("max_length")
-    private String maxLength;
-
-    @Getter
-    @Setter
-    @SerializedName("pattern")
-    private String pattern;
-}
\ No newline at end of file
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaDataType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaDataType.java
deleted file mode 100644
index 0366ee4..0000000
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaDataType.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Model
- * ================================================================================
- * 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.tosca;
-
-import com.google.gson.annotations.SerializedName;
-import java.util.List;
-import java.util.Map;
-
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Class to represent custom data type in TOSCA definition.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- *
- */
-@ToString
-public class ToscaDataType {
-    @Getter
-    @Setter
-    @SerializedName("derived_from")
-    private String derivedFrom;
-
-    @Getter
-    @Setter
-    @SerializedName("version")
-    private String version;
-
-    @Getter
-    @Setter
-    @SerializedName("metadata")
-    private Map<String, String> metadata;
-
-    @Getter
-    @Setter
-    @SerializedName("description")
-    private String description;
-
-    @Getter
-    @Setter
-    @SerializedName("constraints")
-    private List<ToscaConstraint> constraints;
-
-    @Getter
-    @Setter
-    @SerializedName("properties")
-    private List<Map<String, ToscaProperty>> properties;
-}
\ No newline at end of file
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEntityType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEntityType.java
deleted file mode 100644
index 52a82cc..0000000
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEntityType.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2019 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.tosca;
-
-import com.google.gson.annotations.SerializedName;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
-
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.NonNull;
-
-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;
-
-/**
- * Class to represent the EntrySchema of list/map property in TOSCA definition.
- */
-@Entity
-@Table(name = "ToscaEntityType")
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class ToscaEntityType extends PfConcept {
-    private static final long serialVersionUID = -1330661834220739393L;
-
-    @EmbeddedId
-    @NonNull
-    private PfConceptKey key = PfConceptKey.getNullKey();
-
-    @SerializedName("derived_from")
-    @Column(name = "derivedFrom")
-    private PfConceptKey derivedFrom;
-
-    @OneToMany(cascade = CascadeType.ALL)
-    private Map<String, String> metadata;
-
-    @Column(name = "description")
-    private String description;
-
-    /**
-     * The Default Constructor creates a {@link ToscaEntityType} object with a null key.
-     */
-    public ToscaEntityType() {
-        this(new PfConceptKey());
-    }
-
-    /**
-     * The Key Constructor creates a {@link ToscaEntityType} object with the given concept key.
-     *
-     * @param key the key
-     */
-    public ToscaEntityType(@NonNull final PfConceptKey key) {
-        this.key = key;
-    }
-
-    /**
-     * Copy constructor.
-     *
-     * @param copyConcept the concept to copy from
-     */
-    public ToscaEntityType(final ToscaEntityType copyConcept) {
-        super(copyConcept);
-    }
-
-    @Override
-    public List<PfKey> getKeys() {
-        final List<PfKey> keyList = new ArrayList<>();
-        keyList.add(getKey());
-        return keyList;
-    }
-
-    @Override
-    public void clean() {
-        description = description.trim();
-
-        for (Entry<String, String> metadataEntry : metadata.entrySet()) {
-            metadataEntry.setValue(metadataEntry.getValue().trim());
-        }
-    }
-
-    @Override
-    public PfValidationResult validate(PfValidationResult result) {
-        return null;
-    }
-
-    @Override
-    public int compareTo(final PfConcept otherConcept) {
-        if (otherConcept == null) {
-            return -1;
-        }
-        if (this == otherConcept) {
-            return 0;
-        }
-        if (getClass() != otherConcept.getClass()) {
-            return this.hashCode() - otherConcept.hashCode();
-        }
-
-        final ToscaEntityType other = (ToscaEntityType) otherConcept;
-        if (!key.equals(other.key)) {
-            return key.compareTo(other.key);
-        }
-
-        if (!derivedFrom.equals(other.derivedFrom)) {
-            return derivedFrom.compareTo(other.derivedFrom);
-        }
-
-        if (!metadata.equals(other.metadata)) {
-            return (metadata.hashCode() - other.metadata.hashCode());
-        }
-
-        return description.compareTo(other.description);
-    }
-
-    @Override
-    public PfConcept copyTo(@NonNull PfConcept target) {
-        final Object copyObject = target;
-        Assertions.instanceOf(copyObject, PfConcept.class);
-
-        final ToscaEntityType copy = ((ToscaEntityType) copyObject);
-        copy.key = new PfConceptKey(key);
-        copy.derivedFrom = new PfConceptKey(derivedFrom);
-
-        final Map<String, String> newMatadata = new TreeMap<>();
-        for (final Entry<String, String> metadataEntry : metadata.entrySet()) {
-            newMatadata.put(metadataEntry.getKey(), metadataEntry.getValue());
-        }
-        copy.metadata = newMatadata;
-
-        copy.description = description;
-
-        return copy;
-    }
-}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEntrySchema.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEntrySchema.java
deleted file mode 100644
index b3079af..0000000
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEntrySchema.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Model
- * ================================================================================
- * 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.tosca;
-
-import com.google.gson.annotations.SerializedName;
-import java.util.List;
-
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Class to represent the EntrySchema of list/map property in TOSCA definition.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- *
- */
-@ToString
-public class ToscaEntrySchema {
-
-    @Getter
-    @Setter
-    @SerializedName("description")
-    private String description;
-
-    @Getter
-    @Setter
-    @SerializedName("type")
-    private String type;
-
-    @Getter
-    @Setter
-    @SerializedName("constraints")
-    private List<ToscaConstraint> constraints;
-}
\ No newline at end of file
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEventFilter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEventFilter.java
deleted file mode 100644
index 34d7912..0000000
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaEventFilter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Model
- * ================================================================================
- * 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.tosca;
-
-import com.google.gson.annotations.SerializedName;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Class to represent the EventFilter in TOSCA definition.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- *
- */
-@ToString
-public class ToscaEventFilter {
-
-    @Getter
-    @Setter
-    @SerializedName("node")
-    private String node;
-
-    @Getter
-    @Setter
-    @SerializedName("requirement")
-    private String requirement;
-
-    @Getter
-    @Setter
-    @SerializedName("capability")
-    private String capability;
-}
\ No newline at end of file
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicy.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicy.java
deleted file mode 100644
index 4f9210c..0000000
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicy.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Model
- * ================================================================================
- * 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.tosca;
-
-import com.google.gson.annotations.SerializedName;
-import java.util.List;
-import java.util.Map;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Class to represent the policy in TOSCA definition.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- *
- */
-@ToString
-public class ToscaPolicy {
-
-    @Getter
-    @Setter
-    @SerializedName("type")
-    private String type;
-
-    @Getter
-    @Setter
-    @SerializedName("description")
-    private String description;
-
-    @Getter
-    @Setter
-    @SerializedName("metadata")
-    private Map<String, String> metadata;
-
-    @Getter
-    @Setter
-    @SerializedName("properties")
-    private List<Map<String, String>> properties;
-
-    @Getter
-    @Setter
-    @SerializedName("targets")
-    private List<String> targets;
-
-    @Getter
-    @Setter
-    @SerializedName("triggers")
-    private List<Map<String, ToscaTrigger>> triggers;
-}
\ No newline at end of file
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyList.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyList.java
deleted file mode 100644
index ad8f1a4..0000000
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyList.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Model
- * ================================================================================
- * 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.tosca;
-
-import com.google.gson.annotations.SerializedName;
-import java.util.List;
-import java.util.Map;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Class to represent the policy list in TOSCA definition.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- *
- */
-@ToString
-public class ToscaPolicyList {
-
-    @Getter
-    @Setter
-    @SerializedName("policies")
-    private List<Map<String, ToscaPolicy>> policies;
-
-    @Getter
-    @Setter
-    @SerializedName("data_types")
-    private List<Map<String, ToscaDataType>> dataTypes;
-}
\ No newline at end of file
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyType.java
deleted file mode 100644
index 241e178..0000000
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyType.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Model
- * ================================================================================
- * 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.tosca;
-
-import com.google.gson.annotations.SerializedName;
-import java.util.List;
-import java.util.Map;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Class to represent the policy type in TOSCA definition.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- *
- */
-@ToString
-public class ToscaPolicyType {
-
-    @Getter
-    @Setter
-    @SerializedName("derived_from")
-    private String derivedFrom;
-
-    @Getter
-    @Setter
-    @SerializedName("version")
-    private String version;
-
-    @Getter
-    @Setter
-    @SerializedName("metadata")
-    private Map<String, String> metadata;
-
-    @Getter
-    @Setter
-    @SerializedName("description")
-    private String description;
-
-    @Getter
-    @Setter
-    @SerializedName("properties")
-    private List<Map<String, ToscaProperty>> properties;
-
-    @Getter
-    @Setter
-    @SerializedName("targets")
-    private List<String> targets;
-
-    @Getter
-    @Setter
-    @SerializedName("triggers")
-    private List<Map<String, ToscaTrigger>> triggers;
-}
\ No newline at end of file
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyTypeList.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyTypeList.java
deleted file mode 100644
index 4a6a42d..0000000
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaPolicyTypeList.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Model
- * ================================================================================
- * 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.tosca;
-
-import com.google.gson.annotations.SerializedName;
-import java.util.List;
-import java.util.Map;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Class to represent the policy type list in TOSCA definition.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- *
- */
-@ToString
-public class ToscaPolicyTypeList {
-
-    @Getter
-    @Setter
-    @SerializedName("policy_types")
-    private List<Map<String, ToscaPolicyType>> policyTypes;
-
-    @Getter
-    @Setter
-    @SerializedName("data_types")
-    private List<Map<String, ToscaDataType>> dataTypes;
-}
\ No newline at end of file
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaProperty.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaProperty.java
deleted file mode 100644
index 4ee5c45..0000000
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaProperty.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Model
- * ================================================================================
- * 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.tosca;
-
-import com.google.gson.annotations.SerializedName;
-import java.util.List;
-
-import javax.persistence.Column;
-
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-import org.onap.policy.models.base.PfConceptKey;
-
-/**
- * Class to represent the property in TOSCA definition.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- *
- */
-@ToString
-public class ToscaProperty {
-
-    @Getter
-    @Setter
-    @SerializedName("type")
-    @Column(name = "derivedFrom")
-    private PfConceptKey type;
-
-    @Getter
-    @Setter
-    @SerializedName("description")
-    private String description;
-
-    @Getter
-    @Setter
-    @SerializedName("required")
-    private boolean required;
-
-    @Getter
-    @Setter
-    @SerializedName("default_value")
-    private Object defaultValue;
-
-    @Getter
-    @Setter
-    @SerializedName("status")
-    private String status;
-
-    @Getter
-    @Setter
-    @SerializedName("constraints")
-    private List<ToscaConstraint> constraints;
-
-    @Getter
-    @Setter
-    @SerializedName("entry_schema")
-    private ToscaEntrySchema entrySchema;
-}
\ No newline at end of file
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaTimeInterval.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaTimeInterval.java
deleted file mode 100644
index 86334ab..0000000
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaTimeInterval.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Model
- * ================================================================================
- * 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.tosca;
-
-import com.google.gson.annotations.SerializedName;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Class to represent the TimeInterval in TOSCA definition.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- *
- */
-@ToString
-public class ToscaTimeInterval {
-    @Getter
-    @Setter
-    @SerializedName("start_time")
-    private String startTime;
-
-    @Getter
-    @Setter
-    @SerializedName("end_time")
-    private String endTime;
-
-}
\ No newline at end of file
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaTrigger.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaTrigger.java
deleted file mode 100644
index 2464c2e..0000000
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/ToscaTrigger.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Model
- * ================================================================================
- * 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.tosca;
-
-import com.google.gson.annotations.SerializedName;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Class to represent the trigger of policy type in TOSCA definition.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- *
- */
-@ToString
-public class ToscaTrigger {
-
-    @Getter
-    @Setter
-    @SerializedName("description")
-    private String description;
-
-    @Getter
-    @Setter
-    @SerializedName("event_type")
-    private String eventType;
-
-    @Getter
-    @Setter
-    @SerializedName("schedule")
-    private ToscaTimeInterval schedule;
-
-    @Getter
-    @Setter
-    @SerializedName("target_filter")
-    private ToscaEventFilter targetFilter;
-
-    @Getter
-    @Setter
-    @SerializedName("condition")
-    private ToscaConstraint condition;
-
-    @Getter
-    @Setter
-    @SerializedName("constraint")
-    private ToscaConstraint constraint;
-
-    @Getter
-    @Setter
-    @SerializedName("period")
-    private String period;
-
-    @Getter
-    @Setter
-    @SerializedName("evaluations")
-    private int evaluations;
-
-    @Getter
-    @Setter
-    @SerializedName("method")
-    private String method;
-
-    @Getter
-    @Setter
-    @SerializedName("action")
-    private String action;
-}
\ No newline at end of file
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaConstraint.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaConstraint.java
new file mode 100644
index 0000000..dadad6f
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaConstraint.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Model
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.tosca.concepts;
+
+import java.util.List;
+
+import javax.persistence.EmbeddedId;
+import javax.ws.rs.core.Response;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NonNull;
+
+import org.onap.policy.models.base.PfConcept;
+import org.onap.policy.models.base.PfKey;
+import org.onap.policy.models.base.PfModelRuntimeException;
+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;
+
+/**
+ * Immutable class to represent the Constraint of property in TOSCA definition.
+ *
+ * @author Chenfei Gao (cgao@research.att.com)
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public abstract class ToscaConstraint extends PfConcept {
+    private static final long serialVersionUID = 6426438089914347734L;
+
+    @EmbeddedId
+    private final PfReferenceKey key;
+
+    /**
+     * The Default Constructor creates a {@link ToscaConstraint} object with a null key.
+     */
+    public ToscaConstraint() {
+        this(new PfReferenceKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaConstraint} object with the given concept key.
+     *
+     * @param key the key
+     */
+    public ToscaConstraint(@NonNull final PfReferenceKey key) {
+        this.key = key;
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaConstraint(@NonNull final ToscaConstraint copyConcept) {
+        throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "cannot copy an immutable constraint");
+    }
+
+    @Override
+    public List<PfKey> getKeys() {
+        return getKey().getKeys();
+    }
+
+    @Override
+    public void clean() {
+        key.clean();
+    }
+
+    @Override
+    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
+        PfValidationResult result = resultIn;
+
+        if (key.isNullKey()) {
+            result.addValidationMessage(
+                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+        }
+
+        return key.validate(result);
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+        if (this == otherConcept) {
+            return 0;
+        }
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final ToscaConstraint other = (ToscaConstraint) otherConcept;
+
+        return key.compareTo(other.key);
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull final PfConcept target) {
+        throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "cannot copy an immutable constraint");
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogical.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogical.java
new file mode 100644
index 0000000..f186d85
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogical.java
@@ -0,0 +1,119 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+import javax.persistence.Column;
+import javax.ws.rs.core.Response;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.ToString;
+
+import org.onap.policy.models.base.PfConcept;
+import org.onap.policy.models.base.PfModelRuntimeException;
+import org.onap.policy.models.base.PfReferenceKey;
+
+/**
+ * This class represents a logical TOSCA constraint: =,>,>=,<,<=.
+ */
+@EqualsAndHashCode(callSuper = false)
+@ToString
+public class ToscaConstraintLogical extends ToscaConstraint {
+    private static final long serialVersionUID = 2562306457768745444L;
+
+    public enum Operation {
+        EQ,
+        GT,
+        GE,
+        LT,
+        LE
+    }
+
+    @Column
+    @NonNull
+    @Getter
+    private final Operation operation;
+
+    /**
+     * The Default Constructor creates a {@link ToscaConstraintLogical} object with a null key.
+     */
+    public ToscaConstraintLogical() {
+        this(new PfReferenceKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaConstraintLogical} object with the given concept key.
+     *
+     * @param key the key of the constraint
+     */
+    public ToscaConstraintLogical(final PfReferenceKey key) {
+        this(key, Operation.EQ);
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaConstraintLogical} object with the given concept key and operation.
+     *
+     * @param key the key of the constraint
+     * @param operation the logical operation of the constraint
+     *
+     */
+    public ToscaConstraintLogical(final PfReferenceKey key, @NonNull final Operation operation) {
+        super(key);
+        this.operation = operation;
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaConstraintLogical(@NonNull final ToscaConstraintLogical copyConcept) {
+        throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "cannot copy an immutable constraint");
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+        if (this == otherConcept) {
+            return 0;
+        }
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final ToscaConstraintLogical other = (ToscaConstraintLogical) otherConcept;
+
+        int result = super.compareTo(other);
+        if (result != 0) {
+            return result;
+        }
+
+        return operation.compareTo(other.operation);
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull final PfConcept target) {
+        throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "cannot copy an immutable constraint");
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogicalKey.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogicalKey.java
new file mode 100644
index 0000000..1a63f30
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogicalKey.java
@@ -0,0 +1,155 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+import javax.ws.rs.core.Response;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NonNull;
+import lombok.ToString;
+
+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.PfReferenceKey;
+import org.onap.policy.models.base.PfValidationMessage;
+import org.onap.policy.models.base.PfValidationResult;
+import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+
+/**
+ * This immutable class represents a logical TOSCA constraint: =,>,>=,<,<= that compares the owner
+ * of an instance of the class to the referenced key.
+ */
+@Entity
+@Table(name = "ToscaConstraintLogicalKey")
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+@EqualsAndHashCode(callSuper = false)
+@ToString
+public final class ToscaConstraintLogicalKey extends ToscaConstraintLogical {
+    private static final long serialVersionUID = -2420828090326264341L;
+
+    @Column
+    @NonNull
+    @Getter
+    private final PfKey compareToKey;
+
+    /**
+     * The Default Constructor creates a {@link ToscaConstraintLogicalKey} object with a null key.
+     */
+    public ToscaConstraintLogicalKey() {
+        this(new PfReferenceKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaConstraintLogicalKey} object with the given concept
+     * key.
+     *
+     * @param key the key of the constraint
+     */
+    public ToscaConstraintLogicalKey(final PfReferenceKey key) {
+        this(key, Operation.EQ, PfConceptKey.getNullKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaConstraintLogicalKey} object with the given concept
+     * key, operation, and compare key.
+     *
+     * @param key the key of the constraint
+     * @param operation the logical operation of the constraint
+     * @param compareToKey the key of the object to which the object that owns this constraint will
+     *        be compared
+     */
+    public ToscaConstraintLogicalKey(final PfReferenceKey key, @NonNull final Operation operation,
+            @NonNull final PfKey compareToKey) {
+        super(key, operation);
+        this.compareToKey = compareToKey;
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaConstraintLogicalKey(@NonNull final ToscaConstraintLogical copyConcept) {
+        throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "cannot copy an immutable constraint");
+    }
+
+    @Override
+    public List<PfKey> getKeys() {
+        final List<PfKey> keyList = super.getKeys();
+        keyList.addAll(compareToKey.getKeys());
+        return keyList;
+    }
+
+    @Override
+    public void clean() {
+        super.clean();
+        compareToKey.clean();
+    }
+
+    @Override
+    public PfValidationResult validate(final PfValidationResult resultIn) {
+        PfValidationResult result = super.validate(resultIn);
+
+        if (compareToKey.isNullKey()) {
+            result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
+                    "comparison key is a null key"));
+        }
+
+        return result;
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+        if (this == otherConcept) {
+            return 0;
+        }
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final ToscaConstraintLogicalKey other = (ToscaConstraintLogicalKey) otherConcept;
+
+        int result = super.compareTo(other);
+        if (result != 0) {
+            return result;
+        }
+
+        return compareToKey.compareTo(other.compareToKey);
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull final PfConcept target) {
+        throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "cannot copy an immutable constraint");
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogicalString.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogicalString.java
new file mode 100644
index 0000000..c786d62
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogicalString.java
@@ -0,0 +1,137 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+import javax.ws.rs.core.Response;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NonNull;
+
+import org.onap.policy.common.utils.validation.ParameterValidationUtils;
+import org.onap.policy.models.base.PfConcept;
+import org.onap.policy.models.base.PfModelRuntimeException;
+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;
+
+/**
+ * This class represents a logical TOSCA constraint: =,>,>=,<,<= that compares the owner of an
+ * instance of the class to the given string.
+ */
+@Entity
+@Table(name = "ToscaConstraintLogicalString")
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+@EqualsAndHashCode(callSuper = false)
+public class ToscaConstraintLogicalString extends ToscaConstraintLogical {
+    private static final long serialVersionUID = 8167550632122339195L;
+
+    @Column
+    @NonNull
+    @Getter
+    private final String compareToString;
+
+    /**
+     * The Default Constructor creates a {@link ToscaConstraintLogicalString} object with a null key.
+     */
+    public ToscaConstraintLogicalString() {
+        this(new PfReferenceKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaConstraintLogicalString} object with the given concept
+     * key.
+     *
+     * @param key the key of the constraint
+     */
+    public ToscaConstraintLogicalString(final PfReferenceKey key) {
+        this(key, Operation.EQ, "");
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaConstraintLogicalString} object with the given concept
+     * key, operation, and compare string.
+     *
+     * @param key the key of the constraint
+     * @param operation the logical operation of the constraint
+     * @param compareToString the key of the object to which the object that owns this constraint will
+     *        be compared
+     */
+    public ToscaConstraintLogicalString(final PfReferenceKey key, @NonNull final Operation operation,
+            @NonNull final String compareToString) {
+        super(key, operation);
+        this.compareToString = compareToString.trim();
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaConstraintLogicalString(@NonNull final ToscaConstraintLogical copyConcept) {
+        throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "cannot copy an immutable constraint");
+    }
+
+    @Override
+    public PfValidationResult validate(final PfValidationResult resultIn) {
+        PfValidationResult result = super.validate(resultIn);
+
+        if (!ParameterValidationUtils.validateStringParameter(compareToString)) {
+            result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
+                    "comparison string is null or blank"));
+        }
+
+        return result;
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+        if (this == otherConcept) {
+            return 0;
+        }
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final ToscaConstraintLogicalString other = (ToscaConstraintLogicalString) otherConcept;
+
+        int result = super.compareTo(other);
+        if (result != 0) {
+            return result;
+        }
+
+        return compareToString.compareTo(other.compareToString);
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull final PfConcept target) {
+        throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "cannot copy an immutable constraint");
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaDataType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaDataType.java
new file mode 100644
index 0000000..5af24d6
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaDataType.java
@@ -0,0 +1,246 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Model
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.tosca.concepts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.ElementCollection;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NonNull;
+
+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.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 custom data type in TOSCA definition.
+ *
+ * @author Chenfei Gao (cgao@research.att.com)
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+@Entity
+@Table(name = "ToscaDataType")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ToscaDataType extends ToscaEntityType {
+    private static final long serialVersionUID = -3922690413436539164L;
+
+    @ElementCollection
+    private List<ToscaConstraint> constraints;
+
+    @ElementCollection
+    private List<ToscaProperty> properties;
+
+    /**
+     * The Default Constructor creates a {@link ToscaDataType} object with a null key.
+     */
+    public ToscaDataType() {
+        this(new PfConceptKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaDataType} object with the given concept key.
+     *
+     * @param key the key
+     */
+    public ToscaDataType(@NonNull final PfConceptKey key) {
+        super(key);
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaDataType(final ToscaDataType copyConcept) {
+        super(copyConcept);
+    }
+
+    @Override
+    public List<PfKey> getKeys() {
+        final List<PfKey> keyList = super.getKeys();
+
+        if (constraints != null) {
+            for (ToscaConstraint constraint : constraints) {
+                keyList.addAll(constraint.getKeys());
+            }
+        }
+
+        if (properties != null) {
+            for (ToscaProperty property : properties) {
+                keyList.addAll(property.getKeys());
+            }
+        }
+
+        return keyList;
+    }
+
+    @Override
+    public void clean() {
+        super.clean();
+
+        if (constraints != null) {
+            for (ToscaConstraint constraint : constraints) {
+                constraint.clean();
+            }
+        }
+
+        if (properties != null) {
+            for (ToscaProperty property : properties) {
+                property.clean();
+            }
+        }
+    }
+
+    @Override
+    public PfValidationResult validate(final PfValidationResult resultIn) {
+        PfValidationResult result = super.validate(resultIn);
+
+        if (constraints != null) {
+            result = validateConstraints(result);
+        }
+
+        if (properties != null) {
+            result = validateProperties(result);
+        }
+
+        return result;
+    }
+
+    /**
+     * Validate the constraints.
+     *
+     * @param result The result of validations up to now
+     * @return the validation result
+     */
+    private PfValidationResult validateConstraints(@NonNull final PfValidationResult resultIn) {
+        PfValidationResult result = resultIn;
+
+        for (ToscaConstraint constraint : constraints) {
+            if (constraint == null) {
+                result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
+                        "data type constraint may not be null "));
+            } else {
+                result = constraint.validate(result);
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Validate the properties.
+     *
+     * @param result The result of validations up to now
+     * @return the validation result
+     */
+    private PfValidationResult validateProperties(final PfValidationResult resultIn) {
+        PfValidationResult result = resultIn;
+
+        for (ToscaProperty property : properties) {
+            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;
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+        if (this == otherConcept) {
+            return 0;
+        }
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final ToscaDataType other = (ToscaDataType) otherConcept;
+        if (!super.equals(other)) {
+            return super.compareTo(other);
+        }
+
+        int result = PfUtils.compareObjects(constraints, other.constraints);
+        if (result != 0) {
+            return result;
+        }
+
+        result = PfUtils.compareObjects(properties, other.properties);
+        if (result != 0) {
+            return result;
+        }
+
+        return 0;
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull PfConcept target) {
+        final Object copyObject = target;
+        Assertions.instanceOf(copyObject, PfConcept.class);
+
+        final ToscaDataType copy = ((ToscaDataType) copyObject);
+        super.copyTo(target);
+
+        if (constraints == null) {
+            copy.setConstraints(null);
+        }
+        else {
+            final List<ToscaConstraint> newConstraints = new ArrayList<>();
+            for (final ToscaConstraint constraint : constraints) {
+                newConstraints.add(constraint); // Constraints are immutable
+            }
+            copy.setConstraints(newConstraints);
+        }
+
+        if (properties == null) {
+            copy.setProperties(null);
+        }
+        else {
+            final List<ToscaProperty> newProperties = new ArrayList<>();
+            for (final ToscaProperty property : properties) {
+                newProperties.add(new ToscaProperty(property));
+            }
+            copy.setProperties(newProperties);
+        }
+
+        return copy;
+    }
+}
\ No newline at end of file
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaDataTypes.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaDataTypes.java
new file mode 100644
index 0000000..61c3500
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaDataTypes.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import org.onap.policy.models.base.PfConceptContainer;
+import org.onap.policy.models.base.PfConceptKey;
+
+/**
+ * This class is a container for TOSCA data types.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+@Entity
+@Table(name = "ToscaDataTypes")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ToscaDataTypes extends PfConceptContainer<ToscaDataType> {
+    private static final long serialVersionUID = 2941102271022190348L;
+
+    /**
+     * The Default Constructor creates a {@link ToscaDataTypes} object with a null artifact key
+     * and creates an empty concept map.
+     */
+    public ToscaDataTypes() {
+        super(new PfConceptKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaDataTypes} object with the given artifact key
+     * and creates an empty concept map.
+     *
+     * @param key the concept key
+     */
+    public ToscaDataTypes(final PfConceptKey key) {
+        super(key, new TreeMap<PfConceptKey, ToscaDataType>());
+    }
+
+    /**
+     * This Constructor creates an concept container with all of its fields defined.
+     *
+     * @param key the concept container key
+     * @param conceptMap the concepts to be stored in the concept container
+     */
+    public ToscaDataTypes(final PfConceptKey key, final Map<PfConceptKey, ToscaDataType> conceptMap) {
+        super(key, conceptMap);
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaDataTypes(final ToscaDataTypes copyConcept) {
+        super(copyConcept);
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaEntityType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaEntityType.java
new file mode 100644
index 0000000..b0dc58d
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaEntityType.java
@@ -0,0 +1,217 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NonNull;
+
+import org.apache.commons.lang3.ObjectUtils;
+import org.onap.policy.common.utils.validation.Assertions;
+import org.onap.policy.common.utils.validation.ParameterValidationUtils;
+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;
+
+/**
+ * Class to represent the EntrySchema of list/map property in TOSCA definition.
+ */
+@Entity
+@Table(name = "ToscaEntityType")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class ToscaEntityType extends PfConcept {
+    private static final long serialVersionUID = -1330661834220739393L;
+
+    @EmbeddedId
+    private PfConceptKey key;
+
+    @SerializedName("derived_from")
+    @Column(name = "derivedFrom")
+    private PfConceptKey derivedFrom;
+
+    @OneToMany(cascade = CascadeType.ALL)
+    private Map<String, String> metadata;
+
+    @Column(name = "description")
+    private String description;
+
+    /**
+     * The Default Constructor creates a {@link ToscaEntityType} object with a null key.
+     */
+    public ToscaEntityType() {
+        this(new PfConceptKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaEntityType} object with the given concept key.
+     *
+     * @param key the key
+     */
+    public ToscaEntityType(@NonNull final PfConceptKey key) {
+        this.key = key;
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaEntityType(final ToscaEntityType copyConcept) {
+        super(copyConcept);
+    }
+
+    @Override
+    public List<PfKey> getKeys() {
+        final List<PfKey> keyList = getKey().getKeys();
+        if (derivedFrom != null) {
+            keyList.addAll(derivedFrom.getKeys());
+        }
+        return keyList;
+    }
+
+    @Override
+    public void clean() {
+        key.clean();
+
+        if (derivedFrom != null) {
+            derivedFrom.clean();
+        }
+
+        if (metadata != null) {
+            for (Entry<String, String> metadataEntry : metadata.entrySet()) {
+                metadataEntry.setValue(metadataEntry.getValue().trim());
+            }
+        }
+
+        description = (description != null ? description.trim() : null);
+    }
+
+    @Override
+    public PfValidationResult validate(PfValidationResult resultIn) {
+        PfValidationResult result = resultIn;
+
+        if (key.isNullKey()) {
+            result.addValidationMessage(
+                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+        }
+
+        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"));
+        }
+
+        return result;
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+        if (this == otherConcept) {
+            return 0;
+        }
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final ToscaEntityType other = (ToscaEntityType) otherConcept;
+        if (!key.equals(other.key)) {
+            return key.compareTo(other.key);
+        }
+
+        int result = ObjectUtils.compare(derivedFrom, other.derivedFrom);
+        if (result != 0) {
+            return result;
+        }
+
+        result = PfUtils.compareObjects(metadata, other.metadata);
+        if (result != 0) {
+            return result;
+        }
+
+        return ObjectUtils.compare(description, other.description);
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull PfConcept target) {
+        final Object copyObject = target;
+        Assertions.instanceOf(copyObject, PfConcept.class);
+
+        final ToscaEntityType copy = ((ToscaEntityType) copyObject);
+        copy.setKey(new PfConceptKey(key));
+        copy.setDerivedFrom(derivedFrom != null ? new PfConceptKey(derivedFrom) : null);
+
+        if (metadata != null) {
+            final Map<String, String> newMatadata = new TreeMap<>();
+            for (final Entry<String, String> metadataEntry : metadata.entrySet()) {
+                newMatadata.put(metadataEntry.getKey(), metadataEntry.getValue());
+            }
+            copy.setMetadata(newMatadata);
+        }
+
+        copy.setDescription(description);
+
+        return copy;
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaEntrySchema.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaEntrySchema.java
new file mode 100644
index 0000000..72bedbd
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaEntrySchema.java
@@ -0,0 +1,228 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Model
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.tosca.concepts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.ElementCollection;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NonNull;
+
+import org.apache.commons.lang3.ObjectUtils;
+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.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 EntrySchema of list/map property in TOSCA definition.
+ *
+ * @author Chenfei Gao (cgao@research.att.com)
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+@Entity
+@Table(name = "ToscaEntrySchema")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class ToscaEntrySchema extends PfConcept {
+    private static final long serialVersionUID = 3645882081163287058L;
+
+    @EmbeddedId
+    private PfReferenceKey key;
+
+    @Column
+    private PfConceptKey type;
+
+    @Column
+    private String description;
+
+    @ElementCollection
+    private List<ToscaConstraint> constraints;
+
+    /**
+     * The Default Constructor creates a {@link ToscaEntrySchema} object with a null key.
+     */
+    public ToscaEntrySchema() {
+        this(new PfReferenceKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaEntrySchema} object with the given concept key.
+     *
+     * @param key the key
+     */
+    public ToscaEntrySchema(@NonNull final PfReferenceKey key) {
+        this(key, new PfConceptKey());
+    }
+
+    /**
+     * The full constructor creates a {@link ToscaEntrySchema} object with mandatory fields.
+     *
+     * @param key the key
+     * @param type the type of the entry schema
+     */
+    public ToscaEntrySchema(@NonNull final PfReferenceKey key, @NonNull final PfConceptKey type) {
+        this.key = key;
+        this.type = type;
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaEntrySchema(final ToscaEntrySchema copyConcept) {
+        super(copyConcept);
+    }
+
+    @Override
+    public List<PfKey> getKeys() {
+        final List<PfKey> keyList = getKey().getKeys();
+
+        keyList.addAll(type.getKeys());
+
+        if (constraints != null) {
+            for (ToscaConstraint constraint : constraints) {
+                keyList.addAll(constraint.getKeys());
+            }
+        }
+
+        return keyList;
+    }
+
+    @Override
+    public void clean() {
+        key.clean();
+
+        type.clean();
+        description = (description != null ? description.trim() : null);
+
+        if (constraints != null) {
+            for (ToscaConstraint constraint : constraints) {
+                constraint.clean();
+            }
+        }
+    }
+
+    @Override
+    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
+        PfValidationResult result = resultIn;
+
+        if (key.isNullKey()) {
+            result.addValidationMessage(
+                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+        }
+
+        result = key.validate(result);
+
+        if (type == null || type.isNullKey()) {
+            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+                    "entry schema type may not be null"));
+        }
+
+        if (description != null && description.trim().length() == 0) {
+            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+                    "entry schema description may not be blank"));
+        }
+
+
+        if (constraints != null) {
+            for (ToscaConstraint constraint : constraints) {
+                if (constraint == null) {
+                    result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+                            "property constraint may not be null "));
+                } else {
+                    result = constraint.validate(result);
+                }
+            }
+        }
+
+        return result;
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+        if (this == otherConcept) {
+            return 0;
+        }
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final ToscaEntrySchema other = (ToscaEntrySchema) otherConcept;
+        if (!key.equals(other.key)) {
+            return key.compareTo(other.key);
+        }
+
+        if (!type.equals(other.type)) {
+            return type.compareTo(other.type);
+        }
+
+        int result = ObjectUtils.compare(description, other.description);
+        if (result != 0) {
+            return result;
+        }
+
+        return PfUtils.compareObjects(constraints, other.constraints);
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull final PfConcept target) {
+        Assertions.instanceOf(target, ToscaEntrySchema.class);
+
+        final ToscaEntrySchema copy = ((ToscaEntrySchema) target);
+        copy.setKey(new PfReferenceKey(key));
+        copy.setType(new PfConceptKey(type));
+        copy.setDescription(description);
+
+        if (constraints != null) {
+            final List<ToscaConstraint> newConstraints = new ArrayList<>();
+            for (final ToscaConstraint constraint : constraints) {
+                newConstraints.add(constraint); // Constraints are immutable
+            }
+            copy.setConstraints(newConstraints);
+        }
+
+        return copy;
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaEventFilter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaEventFilter.java
new file mode 100644
index 0000000..4e2d737
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaEventFilter.java
@@ -0,0 +1,197 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Model
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.tosca.concepts;
+
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NonNull;
+
+import org.apache.commons.lang3.ObjectUtils;
+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.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.
+ *
+ * @author Chenfei Gao (cgao@research.att.com)
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+@Entity
+@Table(name = "ToscaEventFilter")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class ToscaEventFilter extends PfConcept {
+    private static final long serialVersionUID = 8769020537228210247L;
+
+    @EmbeddedId
+    private PfReferenceKey key;
+
+    @Column
+    private PfConceptKey node;
+
+    @Column
+    private String requirement;
+
+    @Column
+    private String capability;
+
+    /**
+     * The Default Constructor creates a {@link ToscaEventFilter} object with a null key.
+     */
+    public ToscaEventFilter() {
+        this(new PfReferenceKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaEventFilter} object with the given concept key.
+     *
+     * @param key the key
+     */
+    public ToscaEventFilter(@NonNull final PfReferenceKey key) {
+        this(key, new PfConceptKey());
+    }
+
+    /**
+     * The full Constructor creates a {@link ToscaEventFilter} object with the given concept key and node.
+     *
+     * @param key the key
+     */
+    public ToscaEventFilter(@NonNull final PfReferenceKey key, @NonNull final PfConceptKey node) {
+        this.key = key;
+        this.node = node;
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaEventFilter(final ToscaEventFilter copyConcept) {
+        super(copyConcept);
+    }
+
+    @Override
+    public List<PfKey> getKeys() {
+        final List<PfKey> keyList = getKey().getKeys();
+        keyList.addAll(node.getKeys());
+        return keyList;
+    }
+
+    @Override
+    public void clean() {
+        key.clean();
+        node.clean();
+
+        requirement = (requirement != null ? requirement.trim() : requirement);
+        capability = (capability != null ? capability.trim() : capability);
+    }
+
+    @Override
+    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
+        PfValidationResult result = resultIn;
+
+        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"));
+        }
+
+        return result;
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+        if (this == otherConcept) {
+            return 0;
+        }
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final ToscaEventFilter other = (ToscaEventFilter) otherConcept;
+        if (!key.equals(other.key)) {
+            return key.compareTo(other.key);
+        }
+
+        if (!node.equals(other.node)) {
+            return node.compareTo(other.node);
+        }
+
+        int result = ObjectUtils.compare(requirement, other.requirement);
+        if (result != 0) {
+            return result;
+        }
+
+        return ObjectUtils.compare(capability, other.capability);
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull final PfConcept target) {
+        final Object copyObject = target;
+        Assertions.instanceOf(copyObject, ToscaEventFilter.class);
+
+        final ToscaEventFilter copy = ((ToscaEventFilter) copyObject);
+        copy.setKey(new PfReferenceKey(key));
+        copy.setNode(new PfConceptKey(node));
+        copy.setRequirement(requirement);
+        copy.setCapability(capability);
+
+        return copy;
+    }
+}
\ No newline at end of file
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaModel.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaModel.java
new file mode 100644
index 0000000..9169e67
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaModel.java
@@ -0,0 +1,160 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NonNull;
+
+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.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 model with many service templates to be constructed that contains a well
+ * formed overall TOSCA model.
+ *
+ * <p>Validation runs {@link ToscaModel} validation on the model and all its sub concepts.
+ */
+
+@Entity
+@Table(name = "ToscaModel")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ToscaModel extends PfModel {
+    private static final long serialVersionUID = 8800599637708309945L;
+
+    @OneToOne(cascade = CascadeType.ALL)
+    private ToscaServiceTemplates serviceTemplates;
+
+    /**
+     * The Default Constructor creates a {@link ToscaModel} object with a null concept key and
+     * creates an empty TOSCA model.
+     */
+    public ToscaModel() {
+        this(new PfConceptKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaModel} object with the given concept key and
+     * creates an empty TOSCA model.
+     *
+     * @param key the TOSCA model key
+     */
+    public ToscaModel(final PfConceptKey key) {
+        this(key, new ToscaServiceTemplates(new PfConceptKey()));
+    }
+
+    /**
+     * Constructor that initiates a {@link ToscaModel} with all its fields.
+     *
+     * @param key the TOSCA model key
+     * @param serviceTemplates the service templates in the event model
+     */
+    public ToscaModel(@NonNull final PfConceptKey key, @NonNull final ToscaServiceTemplates serviceTemplates) {
+        super(key);
+        this.serviceTemplates = serviceTemplates;
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaModel(@NonNull final ToscaModel copyConcept) {
+        super(copyConcept);
+    }
+
+    @Override
+    public void register() {
+        PfModelService.registerModel(serviceTemplates.getId(), getServiceTemplates());
+    }
+
+    @Override
+    public List<PfKey> getKeys() {
+        final List<PfKey> keyList = super.getKeys();
+
+        keyList.addAll(serviceTemplates.getKeys());
+
+        return keyList;
+    }
+
+    @Override
+    public void clean() {
+        super.clean();
+        serviceTemplates.clean();
+    }
+
+    @Override
+    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
+        PfValidationResult result = super.validate(resultIn);
+
+        return serviceTemplates.validate(result);
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+
+        if (this == otherConcept) {
+            return 0;
+        }
+
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final ToscaModel other = (ToscaModel) otherConcept;
+        if (!super.equals(other)) {
+            return super.compareTo(other);
+        }
+
+        return serviceTemplates.compareTo(other.serviceTemplates);
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull final PfConcept targetObject) {
+        Assertions.instanceOf(targetObject, ToscaModel.class);
+
+        final ToscaModel copy = ((ToscaModel) targetObject);
+        super.copyTo(targetObject);
+        copy.setServiceTemplates(new ToscaServiceTemplates(serviceTemplates));
+
+        return copy;
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaPolicies.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaPolicies.java
new file mode 100644
index 0000000..7209fd0
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaPolicies.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import org.onap.policy.models.base.PfConceptContainer;
+import org.onap.policy.models.base.PfConceptKey;
+
+/**
+ * This class is a container for TOSCA data types.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+@Entity
+@Table(name = "ToscaPolicies")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ToscaPolicies extends PfConceptContainer<ToscaPolicy> {
+    private static final long serialVersionUID = -7526648702327776101L;
+
+    /**
+     * The Default Constructor creates a {@link ToscaPolicies} object with a null artifact key and
+     * creates an empty concept map.
+     */
+    public ToscaPolicies() {
+        super(new PfConceptKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaPolicies} object with the given artifact key and
+     * creates an empty concept map.
+     *
+     * @param key the concept key
+     */
+    public ToscaPolicies(final PfConceptKey key) {
+        super(key, new TreeMap<PfConceptKey, ToscaPolicy>());
+    }
+
+    /**
+     * This Constructor creates an concept container with all of its fields defined.
+     *
+     * @param key the concept container key
+     * @param conceptMap the concepts to be stored in the concept container
+     */
+    public ToscaPolicies(final PfConceptKey key, final Map<PfConceptKey, ToscaPolicy> conceptMap) {
+        super(key, conceptMap);
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaPolicies(final ToscaPolicies copyConcept) {
+        super(copyConcept);
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaPolicy.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaPolicy.java
new file mode 100644
index 0000000..3e1fddd
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaPolicy.java
@@ -0,0 +1,273 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Model
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.tosca.concepts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.ElementCollection;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NonNull;
+
+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.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 policy in TOSCA definition.
+ *
+ * @author Chenfei Gao (cgao@research.att.com)
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+@Entity
+@Table(name = "ToscaPolicy")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ToscaPolicy extends ToscaEntityType {
+    private static final long serialVersionUID = 3265174757061982805L;
+
+    @Column
+    private PfConceptKey type;
+
+    @ElementCollection
+    private List<ToscaProperty> properties;
+
+    @ElementCollection
+    private List<PfConceptKey> targets;
+
+    /**
+     * The Default Constructor creates a {@link ToscaPolicy} object with a null key.
+     */
+    public ToscaPolicy() {
+        this(new PfConceptKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaPolicy} object with the given concept key.
+     *
+     * @param key the key
+     */
+    public ToscaPolicy(@NonNull final PfConceptKey key) {
+        this(key, new PfConceptKey());
+    }
+
+    /**
+     * The full Constructor creates a {@link ToscaPolicy} object with all mandatory fields.
+     *
+     * @param key the key
+     * @param type the type of the policy
+     */
+    public ToscaPolicy(@NonNull final PfConceptKey key, @NonNull final PfConceptKey type) {
+        super(key);
+        this.type = type;
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaPolicy(@NonNull final ToscaPolicy copyConcept) {
+        super(copyConcept);
+    }
+
+
+    @Override
+    public List<PfKey> getKeys() {
+        final List<PfKey> keyList = super.getKeys();
+
+        keyList.addAll(type.getKeys());
+
+        if (properties != null) {
+            for (ToscaProperty property : properties) {
+                keyList.addAll(property.getKeys());
+            }
+        }
+
+        if (targets != null) {
+            keyList.addAll(targets);
+        }
+
+        return keyList;
+    }
+
+    @Override
+    public void clean() {
+        super.clean();
+
+        type.clean();
+
+        if (properties != null) {
+            for (ToscaProperty property : properties) {
+                property.clean();
+            }
+        }
+
+        if (targets != null) {
+            for (PfConceptKey target : targets) {
+                target.clean();
+            }
+        }
+    }
+
+    @Override
+    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
+        PfValidationResult result = super.validate(resultIn);
+
+        if (type == null || type.isNullKey()) {
+            result.addValidationMessage(new PfValidationMessage(type, this.getClass(), ValidationResult.INVALID,
+                    "type is null or a null key"));
+        }
+        else {
+            result = type.validate(result);
+        }
+
+        if (properties != null) {
+            result = validateProperties(result);
+        }
+
+        if (targets != null) {
+            result = validateTargets(result);
+        }
+
+        return result;
+    }
+
+    /**
+     * Validate the policy properties.
+     *
+     * @param result The result of validations up to now
+     * @return the validation result
+     */
+    private PfValidationResult validateProperties(@NonNull final PfValidationResult resultIn) {
+        PfValidationResult result = resultIn;
+
+        for (ToscaProperty property : properties) {
+            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;
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+
+        if (this == otherConcept) {
+            return 0;
+        }
+
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final ToscaPolicy other = (ToscaPolicy) otherConcept;
+        if (!super.equals(other)) {
+            return super.compareTo(other);
+        }
+
+        if (!type.equals(other.type)) {
+            return type.compareTo(other.type);
+        }
+
+        int retVal = PfUtils.compareObjects(properties, other.properties);
+        if (retVal != 0) {
+            return retVal;
+        }
+
+        return PfUtils.compareObjects(targets, other.targets);
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull PfConcept target) {
+        final Object copyObject = target;
+        Assertions.instanceOf(copyObject, PfConcept.class);
+
+        final ToscaPolicy copy = ((ToscaPolicy) copyObject);
+        super.copyTo(target);
+
+        copy.setType(new PfConceptKey(type));
+
+        if (properties == null) {
+            copy.setProperties(null);
+        } else {
+            final List<ToscaProperty> newProperties = new ArrayList<>();
+            for (final ToscaProperty property : properties) {
+                newProperties.add(new ToscaProperty(property));
+            }
+            copy.setProperties(newProperties);
+        }
+
+        if (targets == null) {
+            copy.setTargets(null);
+        } else {
+            final List<PfConceptKey> newTargets = new ArrayList<>();
+            for (final PfConceptKey oldTarget : targets) {
+                newTargets.add(new PfConceptKey(oldTarget));
+            }
+            copy.setTargets(newTargets);
+        }
+
+        return copy;
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaPolicyType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaPolicyType.java
new file mode 100644
index 0000000..dbd0114
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaPolicyType.java
@@ -0,0 +1,294 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Model
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.tosca.concepts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.ElementCollection;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NonNull;
+
+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.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 policy type in TOSCA definition.
+ *
+ * @author Chenfei Gao (cgao@research.att.com)
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+
+@Entity
+@Table(name = "ToscaPolicyType")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ToscaPolicyType extends ToscaEntityType {
+    private static final long serialVersionUID = -563659852901842616L;
+
+    @ElementCollection
+    private List<ToscaProperty> properties;
+
+    @ElementCollection
+    private List<PfConceptKey> targets;
+
+    @ElementCollection
+    private List<ToscaTrigger> triggers;
+
+    /**
+     * The Default Constructor creates a {@link ToscaPolicyType} object with a null key.
+     */
+    public ToscaPolicyType() {
+        this(new PfConceptKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaPolicyType} object with the given concept key.
+     *
+     * @param key the key
+     */
+    public ToscaPolicyType(@NonNull final PfConceptKey key) {
+        super(key);
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaPolicyType(final ToscaPolicyType copyConcept) {
+        super(copyConcept);
+    }
+
+
+    @Override
+    public List<PfKey> getKeys() {
+        final List<PfKey> keyList = super.getKeys();
+
+        if (properties != null) {
+            for (ToscaProperty property : properties) {
+                keyList.addAll(property.getKeys());
+            }
+        }
+
+        if (targets != null) {
+            keyList.addAll(targets);
+        }
+
+        if (triggers != null) {
+            for (ToscaTrigger trigger : triggers) {
+                keyList.addAll(trigger.getKeys());
+            }
+        }
+
+        return keyList;
+    }
+
+    @Override
+    public void clean() {
+        super.clean();
+
+        if (properties != null) {
+            for (ToscaProperty property : properties) {
+                property.clean();
+            }
+        }
+
+        if (targets != null) {
+            for (PfConceptKey target : targets) {
+                target.clean();
+            }
+        }
+
+        if (triggers != null) {
+            for (ToscaTrigger trigger : triggers) {
+                trigger.clean();
+            }
+        }
+    }
+
+    @Override
+    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
+        PfValidationResult result = super.validate(resultIn);
+
+        if (properties != null) {
+            result = validateProperties(result);
+        }
+
+        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 (ToscaProperty property : properties) {
+            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 (ToscaTrigger 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;
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+        if (this == otherConcept) {
+            return 0;
+        }
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final ToscaPolicyType other = (ToscaPolicyType) otherConcept;
+        if (!super.equals(other)) {
+            return super.compareTo(other);
+        }
+
+        int retVal = PfUtils.compareObjects(properties, other.properties);
+        if (retVal != 0) {
+            return retVal;
+        }
+
+        retVal = PfUtils.compareObjects(targets, other.targets);
+        if (retVal != 0) {
+            return retVal;
+        }
+
+        return PfUtils.compareObjects(triggers, other.triggers);
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull PfConcept target) {
+        final Object copyObject = target;
+        Assertions.instanceOf(copyObject, PfConcept.class);
+
+        final ToscaPolicyType copy = ((ToscaPolicyType) copyObject);
+        super.copyTo(target);
+
+        final List<ToscaProperty> newProperties = new ArrayList<>();
+
+        if (properties == null) {
+            copy.setProperties(null);
+        } else {
+            for (final ToscaProperty property : properties) {
+                newProperties.add(new ToscaProperty(property));
+            }
+            copy.setProperties(newProperties);
+        }
+
+        if (targets == null) {
+            copy.setTargets(null);
+        } else {
+            final List<PfConceptKey> newTargets = new ArrayList<>();
+            for (final PfConceptKey oldTarget : targets) {
+                newTargets.add(new PfConceptKey(oldTarget));
+            }
+            copy.setTargets(newTargets);
+        }
+
+        if (triggers == null) {
+            copy.setTargets(null);
+        } else {
+            final List<ToscaTrigger> newTriggers = new ArrayList<>();
+            for (final ToscaTrigger trigger : triggers) {
+                newTriggers.add(new ToscaTrigger(trigger));
+            }
+            copy.setTriggers(newTriggers);
+        }
+
+        return copy;
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaPolicyTypes.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaPolicyTypes.java
new file mode 100644
index 0000000..e33e6c0
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaPolicyTypes.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import org.onap.policy.models.base.PfConceptContainer;
+import org.onap.policy.models.base.PfConceptKey;
+
+/**
+ * This class is a container for TOSCA policy types.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+@Entity
+@Table(name = "ToscaPolicyTypes")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ToscaPolicyTypes extends PfConceptContainer<ToscaPolicyType> {
+    private static final long serialVersionUID = -4157979965271220098L;
+
+    /**
+     * The Default Constructor creates a {@link ToscaPolicyTypes} object with a null artifact key
+     * and creates an empty concept map.
+     */
+    public ToscaPolicyTypes() {
+        super(new PfConceptKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaPolicyTypes} object with the given artifact key and
+     * creates an empty concept map.
+     *
+     * @param key the concept key
+     */
+    public ToscaPolicyTypes(final PfConceptKey key) {
+        super(key, new TreeMap<PfConceptKey, ToscaPolicyType>());
+    }
+
+    /**
+     * This Constructor creates an concept container with all of its fields defined.
+     *
+     * @param key the concept container key
+     * @param conceptMap the concepts to be stored in the concept container
+     */
+    public ToscaPolicyTypes(final PfConceptKey key, final Map<PfConceptKey, ToscaPolicyType> conceptMap) {
+        super(key, conceptMap);
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaPolicyTypes(final ToscaPolicyTypes copyConcept) {
+        super(copyConcept);
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaProperty.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaProperty.java
new file mode 100644
index 0000000..ab72ff6
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaProperty.java
@@ -0,0 +1,308 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Model
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.tosca.concepts;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.ElementCollection;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NonNull;
+
+import org.apache.commons.lang3.ObjectUtils;
+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.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 property in TOSCA definition.
+ *
+ * @author Chenfei Gao (cgao@research.att.com)
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+@Entity
+@Table(name = "ToscaProperty")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class ToscaProperty extends PfConcept {
+    private static final long serialVersionUID = 1675770231921107988L;
+
+    public enum Status {
+        SUPPORTED, UNSUPPORTED, EXPERIMENTAL, DEPRECATED
+    }
+
+    @EmbeddedId
+    private PfReferenceKey key;
+
+    @Column
+    private PfConceptKey type;
+
+    @Column
+    private String description;
+
+    @Column
+    private boolean required = false;
+
+    @Column(name = "default")
+    @SerializedName("default")
+    private PfKey defaultValue;
+
+    @Column
+    @NonNull
+    private Status status = Status.SUPPORTED;
+
+    @ElementCollection
+    private List<ToscaConstraint> constraints;
+
+    @Column
+    @SerializedName("entry_schema")
+    private ToscaEntrySchema entrySchema;
+
+    /**
+     * The Default Constructor creates a {@link ToscaProperty} object with a null key.
+     */
+    public ToscaProperty() {
+        this(new PfReferenceKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaProperty} object with the given concept key.
+     *
+     * @param key the key
+     */
+    public ToscaProperty(@NonNull final PfReferenceKey key) {
+        this(key, new PfConceptKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaProperty} object with the given concept key.
+     *
+     * @param key the key
+     * @param type the key of the property type
+     */
+    public ToscaProperty(@NonNull final PfReferenceKey key, @NonNull final PfConceptKey type) {
+        this.key = key;
+        this.type = type;
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaProperty(final ToscaProperty copyConcept) {
+        super(copyConcept);
+    }
+
+    @Override
+    public List<PfKey> getKeys() {
+        final List<PfKey> keyList = getKey().getKeys();
+
+        keyList.addAll(type.getKeys());
+
+        if (defaultValue != null) {
+            keyList.addAll(defaultValue.getKeys());
+        }
+
+        if (constraints != null) {
+            for (ToscaConstraint constraint : constraints) {
+                keyList.addAll(constraint.getKeys());
+            }
+        }
+
+        if (entrySchema != null) {
+            keyList.addAll(entrySchema.getKeys());
+        }
+
+        return keyList;
+    }
+
+    @Override
+    public void clean() {
+        key.clean();
+
+        type.clean();
+
+        if (description != null) {
+            description = description.trim();
+        }
+
+        if (defaultValue != null) {
+            defaultValue.clean();
+        }
+
+        if (constraints != null) {
+            for (ToscaConstraint constraint : constraints) {
+                constraint.clean();
+            }
+        }
+
+        if (entrySchema != null) {
+            entrySchema.clean();
+        }
+    }
+
+    @Override
+    public PfValidationResult validate(final PfValidationResult resultIn) {
+        PfValidationResult result = resultIn;
+
+        if (key.isNullKey()) {
+            result.addValidationMessage(
+                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+        }
+
+        result = key.validate(result);
+
+        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.isNullKey()) {
+            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+                    "property default value may not be null"));
+        }
+
+        if (constraints != null) {
+            for (ToscaConstraint constraint : constraints) {
+                if (constraint == null) {
+                    result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+                            "property constraint may not be null "));
+                } else {
+                    result = constraint.validate(result);
+                }
+            }
+        }
+        return (entrySchema != null ? entrySchema.validate(result) : result);
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+        if (this == otherConcept) {
+            return 0;
+        }
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final ToscaProperty other = (ToscaProperty) otherConcept;
+        if (!key.equals(other.key)) {
+            return key.compareTo(other.key);
+        }
+
+        return compareFields(other);
+    }
+
+    /**
+     * Compare the fields of this ToscaProperty object with the fields of the other ToscaProperty
+     * object.
+     *
+     * @param other the other ToscaProperty object
+     */
+    private int compareFields(final ToscaProperty other) {
+        if (!type.equals(other.type)) {
+            return type.compareTo(other.type);
+        }
+
+        int result = ObjectUtils.compare(description, other.description);
+        if (result != 0) {
+            return result;
+        }
+
+        result = ObjectUtils.compare(required, other.required);
+        if (result != 0) {
+            return result;
+        }
+
+        result = ObjectUtils.compare(defaultValue, other.defaultValue);
+        if (result != 0) {
+            return result;
+        }
+
+        result = ObjectUtils.compare(status, other.status);
+        if (result != 0) {
+            return result;
+        }
+
+        result = PfUtils.compareObjects(constraints, other.constraints);
+        if (result != 0) {
+            return result;
+        }
+
+        return entrySchema.compareTo(other.entrySchema);
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull final PfConcept target) {
+        Assertions.instanceOf(target, ToscaProperty.class);
+
+        final ToscaProperty copy = ((ToscaProperty) target);
+        copy.setKey(new PfReferenceKey(key));
+        copy.setType(new PfConceptKey(type));
+        copy.setDescription(description);
+        copy.setRequired(required);
+        copy.setDefaultValue(defaultValue);
+        copy.setStatus(status);
+        copy.constraints = constraints; // Constraints are immutable
+        copy.setEntrySchema(entrySchema != null ? new ToscaEntrySchema(entrySchema) : null);
+
+        return copy;
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplate.java
new file mode 100644
index 0000000..acf231a
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplate.java
@@ -0,0 +1,222 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NonNull;
+
+import org.apache.commons.lang3.ObjectUtils;
+import org.onap.policy.common.utils.validation.Assertions;
+import org.onap.policy.common.utils.validation.ParameterValidationUtils;
+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;
+
+/**
+ * This class holds a full TOSCA service template. Note: Only the policy specific parts of the TOSCA
+ * service template are implemented.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+@Entity
+@Table(name = "ToscaServiceTemplate")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ToscaServiceTemplate extends ToscaEntityType {
+    private static final long serialVersionUID = 8084846046148349401L;
+
+    @Column
+    @SerializedName("tosca_definitions_version")
+    private String toscaDefinitionsVersion;
+
+    @OneToOne(cascade = CascadeType.ALL)
+    @SerializedName("data_types")
+    private ToscaDataTypes dataTypes;
+
+    @OneToOne(cascade = CascadeType.ALL)
+    @SerializedName("policy_types")
+    private ToscaPolicyTypes policyTypes;
+
+    @SerializedName("topology_template")
+    private ToscaTopologyTemplate topologyTemplate;
+
+
+    /**
+     * The Default Constructor creates a {@link ToscaServiceTemplate} object with a null key.
+     */
+    public ToscaServiceTemplate() {
+        this(new PfConceptKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaServiceTemplate} object with the given concept key.
+     *
+     * @param key the key
+     */
+    public ToscaServiceTemplate(@NonNull final PfConceptKey key) {
+        this(key, "");
+    }
+
+    /**
+     * The full constructor creates a {@link ToscaServiceTemplate} object with all mandatory
+     * parameters.
+     *
+     * @param key the key
+     * @param toscaDefinitionsVersion the TOSCA version string
+     */
+    public ToscaServiceTemplate(@NonNull final PfConceptKey key, @NonNull final String toscaDefinitionsVersion) {
+        super(key);
+        this.toscaDefinitionsVersion = toscaDefinitionsVersion;
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaServiceTemplate(final ToscaServiceTemplate copyConcept) {
+        super(copyConcept);
+    }
+
+    @Override
+    public List<PfKey> getKeys() {
+        final List<PfKey> keyList = super.getKeys();
+
+        if (dataTypes != null) {
+            keyList.addAll(dataTypes.getKeys());
+        }
+
+        if (policyTypes != null) {
+            keyList.addAll(policyTypes.getKeys());
+        }
+
+        if (topologyTemplate != null) {
+            keyList.addAll(topologyTemplate.getKeys());
+        }
+
+        return keyList;
+    }
+
+    @Override
+    public void clean() {
+        toscaDefinitionsVersion = toscaDefinitionsVersion.trim();
+
+        if (dataTypes != null) {
+            dataTypes.clean();
+        }
+
+        if (policyTypes != null) {
+            policyTypes.clean();
+        }
+
+        if (topologyTemplate != null) {
+            topologyTemplate.clean();
+        }
+    }
+
+    @Override
+    public PfValidationResult validate(final PfValidationResult resultIn) {
+        PfValidationResult result = super.validate(resultIn);
+
+        if (!ParameterValidationUtils.validateStringParameter(toscaDefinitionsVersion)) {
+            result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
+                    "service template tosca definitions version may not be null"));
+        }
+
+        if (dataTypes != null) {
+            result = dataTypes.validate(result);
+        }
+
+        if (policyTypes != null) {
+            result = policyTypes.validate(result);
+        }
+
+        return (topologyTemplate != null ? topologyTemplate.validate(result) : result);
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+        if (this == otherConcept) {
+            return 0;
+        }
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final ToscaServiceTemplate other = (ToscaServiceTemplate) otherConcept;
+        if (!super.equals(other)) {
+            return super.compareTo(other);
+        }
+
+        int result = ObjectUtils.compare(toscaDefinitionsVersion, other.toscaDefinitionsVersion);
+        if (result != 0) {
+            return result;
+        }
+
+        result = ObjectUtils.compare(dataTypes, other.dataTypes);
+        if (result != 0) {
+            return result;
+        }
+
+        result = ObjectUtils.compare(policyTypes, other.policyTypes);
+        if (result != 0) {
+            return result;
+        }
+
+        return ObjectUtils.compare(topologyTemplate, other.topologyTemplate);
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull PfConcept target) {
+        final Object copyObject = target;
+        Assertions.instanceOf(copyObject, PfConcept.class);
+
+        final ToscaServiceTemplate copy = ((ToscaServiceTemplate) copyObject);
+        super.copyTo(target);
+        copy.setToscaDefinitionsVersion(toscaDefinitionsVersion);
+
+        copy.setDataTypes(dataTypes != null ? new ToscaDataTypes(dataTypes) : null);
+        copy.setPolicyTypes(policyTypes != null ? new ToscaPolicyTypes(policyTypes) : null);
+        copy.setTopologyTemplate(topologyTemplate != null ? new ToscaTopologyTemplate(topologyTemplate) : null);
+
+        return copy;
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplates.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplates.java
new file mode 100644
index 0000000..bd16207
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplates.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import org.onap.policy.models.base.PfConceptContainer;
+import org.onap.policy.models.base.PfConceptKey;
+
+/**
+ * This class is a container for TOSCA service templates.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+@Entity
+@Table(name = "ToscaServiceTemplates")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ToscaServiceTemplates extends PfConceptContainer<ToscaServiceTemplate> {
+    private static final long serialVersionUID = -3053257884307604114L;
+
+    /**
+     * The Default Constructor creates a {@link ToscaServiceTemplates} object with a null artifact
+     * key and creates an empty concept map.
+     */
+    public ToscaServiceTemplates() {
+        super(new PfConceptKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaServiceTemplates} object with the given artifact
+     * key and creates an empty concept map.
+     *
+     * @param key the concept key
+     */
+    public ToscaServiceTemplates(final PfConceptKey key) {
+        super(key, new TreeMap<PfConceptKey, ToscaServiceTemplate>());
+    }
+
+    /**
+     * This Constructor creates an concept container with all of its fields defined.
+     *
+     * @param key the concept container key
+     * @param conceptMap the concepts to be stored in the concept container
+     */
+    public ToscaServiceTemplates(final PfConceptKey key, final Map<PfConceptKey, ToscaServiceTemplate> conceptMap) {
+        super(key, conceptMap);
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaServiceTemplates(final ToscaServiceTemplates copyConcept) {
+        super(copyConcept);
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaTimeInterval.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaTimeInterval.java
new file mode 100644
index 0000000..10ee6cc
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaTimeInterval.java
@@ -0,0 +1,188 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Model
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.tosca.concepts;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NonNull;
+
+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.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.
+ *
+ * @author Chenfei Gao (cgao@research.att.com)
+ * @author Liam Fallon (liam.fallon@est.tech)
+ *
+ */
+@Entity
+@Table(name = "ToscaTimeInterval")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class ToscaTimeInterval extends PfConcept {
+    private static final long serialVersionUID = 9151467029611969980L;
+
+    @EmbeddedId
+    private PfReferenceKey key;
+
+    @SerializedName("start_time")
+    private Date startTime;
+
+    @SerializedName("end_time")
+    private Date endTime;
+
+    /**
+     * The Default Constructor creates a {@link ToscaTimeInterval} object with a null key.
+     */
+    public ToscaTimeInterval() {
+        this(new PfReferenceKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaTimeInterval} object with the given concept key.
+     *
+     * @param key the key
+     */
+    public ToscaTimeInterval(@NonNull final PfReferenceKey key) {
+        this(key, new Date(0), new Date(0));
+    }
+
+    /**
+     * The full constructor creates a {@link ToscaTimeInterval} object with all fields.
+     *
+     * @param key the key
+     */
+    public ToscaTimeInterval(@NonNull final PfReferenceKey key, @NonNull final Date startTime,
+            @NonNull final Date endTime) {
+        this.key = key;
+        this.startTime = startTime;
+        this.endTime = endTime;
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaTimeInterval(final ToscaTimeInterval copyConcept) {
+        super(copyConcept);
+    }
+
+    @Override
+    public List<PfKey> getKeys() {
+        return getKey().getKeys();
+    }
+
+    @Override
+    public void clean() {
+        key.clean();
+    }
+
+    @Override
+    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
+        PfValidationResult result = resultIn;
+
+        if (key.isNullKey()) {
+            result.addValidationMessage(
+                    new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+        }
+
+        result = key.validate(result);
+
+        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"));
+        }
+
+        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"));
+        }
+
+        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() + "\""));
+        }
+
+        return result;
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+        if (this == otherConcept) {
+            return 0;
+        }
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final ToscaTimeInterval other = (ToscaTimeInterval) otherConcept;
+        if (!key.equals(other.key)) {
+            return key.compareTo(other.key);
+        }
+
+        int returnVal = PfUtils.compareObjects(startTime, other.startTime);
+        if (returnVal != 0) {
+            return returnVal;
+        }
+
+        return PfUtils.compareObjects(endTime, other.endTime);
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull final PfConcept target) {
+        final Object copyObject = target;
+        Assertions.instanceOf(copyObject, ToscaTimeInterval.class);
+
+        final ToscaTimeInterval copy = ((ToscaTimeInterval) copyObject);
+        copy.setKey(new PfReferenceKey(key));
+        copy.setStartTime(startTime);
+        copy.setEndTime(endTime);
+
+        return copy;
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaTopologyTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaTopologyTemplate.java
new file mode 100644
index 0000000..e8541f5
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaTopologyTemplate.java
@@ -0,0 +1,178 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NonNull;
+
+import org.apache.commons.lang3.ObjectUtils;
+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.PfValidationMessage;
+import org.onap.policy.models.base.PfValidationResult;
+import org.onap.policy.models.base.PfValidationResult.ValidationResult;
+
+/**
+ * This class holds a TOSCA topology template. Note: Only the policy specific parts of the TOSCA
+ * topology template are implemented.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+@Entity
+@Table(name = "ToscaTopologyTemplate")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class ToscaTopologyTemplate extends PfConcept {
+    private static final long serialVersionUID = 8969698734673232603L;
+
+    @EmbeddedId
+    private PfConceptKey key;
+
+    @Column(name = "description")
+    private String description;
+
+    @OneToOne(cascade = CascadeType.ALL)
+    private ToscaPolicies policies;
+
+    /**
+     * The Default Constructor creates a {@link ToscaTopologyTemplate} object with a null key.
+     */
+    public ToscaTopologyTemplate() {
+        this(new PfConceptKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaTopologyTemplate} object with the given concept
+     * key.
+     *
+     * @param key the key
+     */
+    public ToscaTopologyTemplate(@NonNull final PfConceptKey key) {
+        this.key = key;
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaTopologyTemplate(final ToscaTopologyTemplate copyConcept) {
+        super(copyConcept);
+    }
+
+    @Override
+    public List<PfKey> getKeys() {
+        final List<PfKey> keyList = getKey().getKeys();
+
+        if (policies != null) {
+            keyList.addAll(policies.getKeys());
+        }
+
+        return keyList;
+    }
+
+    @Override
+    public void clean() {
+        key.clean();
+
+        description = (description != null ? description.trim() : null);
+
+        if (policies != null) {
+            policies.clean();
+        }
+    }
+
+    @Override
+    public PfValidationResult validate(PfValidationResult resultIn) {
+        PfValidationResult result = resultIn;
+
+        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"));
+        }
+
+        if (policies != null) {
+            result = policies.validate(result);
+        }
+
+        return result;
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+        if (this == otherConcept) {
+            return 0;
+        }
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final ToscaTopologyTemplate other = (ToscaTopologyTemplate) otherConcept;
+        if (!key.equals(other.key)) {
+            return key.compareTo(other.key);
+        }
+
+        int result = ObjectUtils.compare(description, other.description);
+        if (result != 0) {
+            return result;
+        }
+
+        return ObjectUtils.compare(policies, other.policies);
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull PfConcept target) {
+        final Object copyObject = target;
+        Assertions.instanceOf(copyObject, PfConcept.class);
+
+        final ToscaTopologyTemplate copy = ((ToscaTopologyTemplate) copyObject);
+        copy.setKey(new PfConceptKey(key));
+        copy.setDescription(description);
+        copy.setPolicies(policies != null ? new ToscaPolicies(policies) : null);
+
+        return copy;
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaTrigger.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaTrigger.java
new file mode 100644
index 0000000..5f3b639
--- /dev/null
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/concepts/ToscaTrigger.java
@@ -0,0 +1,335 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Model
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 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.tosca.concepts;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.time.Duration;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NonNull;
+
+import org.apache.commons.lang3.ObjectUtils;
+import org.onap.policy.common.utils.validation.Assertions;
+import org.onap.policy.common.utils.validation.ParameterValidationUtils;
+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.
+ *
+ * @author Chenfei Gao (cgao@research.att.com)
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+@Entity
+@Table(name = "ToscaTrigger")
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class ToscaTrigger extends PfConcept {
+    private static final long serialVersionUID = -6515211640208986971L;
+
+    @EmbeddedId
+    private PfReferenceKey key;
+
+    @Column
+    private String description;
+
+    @Column
+    @SerializedName("event_type")
+    private String eventType;
+
+    @Column
+    @SerializedName("schedule")
+    private ToscaTimeInterval schedule;
+
+    @Column
+    @SerializedName("target_filter")
+    private ToscaEventFilter targetFilter;
+
+    @Column
+    private ToscaConstraint condition;
+
+    @Column
+    private ToscaConstraint constraint;
+
+    @Column
+    @SerializedName("period")
+    private Duration period;
+
+    @Column
+    private int evaluations = 0;
+
+    @Column
+    private String method;
+
+    @Column
+    private String action;
+
+    /**
+     * The Default Constructor creates a {@link ToscaTrigger} object with a null key.
+     */
+    public ToscaTrigger() {
+        this(new PfReferenceKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link ToscaTrigger} object with the given concept key.
+     *
+     * @param key the key
+     */
+    public ToscaTrigger(@NonNull final PfReferenceKey key) {
+        this(key, "", "");
+    }
+
+    /**
+     * The full Constructor creates a {@link ToscaTrigger} object with all mandatory objects.
+     *
+     * @param key the key
+     * @param eventType the event type
+     * @param action the trigger action
+     */
+    public ToscaTrigger(@NonNull final PfReferenceKey key, @NonNull final String eventType,
+            @NonNull final String action) {
+        this.key = key;
+        this.eventType = eventType;
+        this.action = action;
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public ToscaTrigger(final ToscaTrigger copyConcept) {
+        super(copyConcept);
+    }
+
+    @Override
+    public List<PfKey> getKeys() {
+        final List<PfKey> keyList = getKey().getKeys();
+        if (schedule != null) {
+            keyList.addAll(schedule.getKeys());
+        }
+        if (targetFilter != null) {
+            keyList.addAll(targetFilter.getKeys());
+        }
+        if (condition != null) {
+            keyList.addAll(condition.getKeys());
+        }
+        if (constraint != null) {
+            keyList.addAll(constraint.getKeys());
+        }
+        return keyList;
+    }
+
+    @Override
+    public void clean() {
+        key.clean();
+
+        description = (description != null ? description.trim() : description);
+        eventType = eventType.trim();
+
+        if (schedule != null) {
+            schedule.clean();
+        }
+        if (targetFilter != null) {
+            targetFilter.clean();
+        }
+        if (condition != null) {
+            condition.clean();
+        }
+        if (constraint != null) {
+            constraint.clean();
+        }
+
+        method = (method != null ? method.trim() : method);
+        action = action.trim();
+    }
+
+    @Override
+    public PfValidationResult validate(@NonNull final PfValidationResult resultIn) {
+        PfValidationResult result = resultIn;
+
+        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,
+                    "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);
+
+        if (evaluations < 0) {
+            result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+                    "evaluations on trigger must be zero or a positive integer"));
+        }
+
+        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 = (condition != null ? condition.validate(result) : result);
+        result = (constraint != null ? constraint.validate(result) : result);
+
+        return result;
+    }
+
+    @Override
+    public int compareTo(final PfConcept otherConcept) {
+        if (otherConcept == null) {
+            return -1;
+        }
+        if (this == otherConcept) {
+            return 0;
+        }
+        if (getClass() != otherConcept.getClass()) {
+            return this.hashCode() - otherConcept.hashCode();
+        }
+
+        final ToscaTrigger other = (ToscaTrigger) otherConcept;
+        if (!key.equals(other.key)) {
+            return key.compareTo(other.key);
+        }
+
+        return compareFields(other);
+    }
+
+    /**
+     * Compare the fields of this ToscaTrigger object with the fields of the other ToscaProperty
+     * object.
+     *
+     * @param other the other ToscaTrigger object
+     */
+    private int compareFields(final ToscaTrigger other) {
+        int result = ObjectUtils.compare(description, other.description);
+        if (result != 0) {
+            return result;
+        }
+
+        result = ObjectUtils.compare(eventType, other.eventType);
+        if (result != 0) {
+            return result;
+        }
+
+        result = ObjectUtils.compare(schedule, other.schedule);
+        if (result != 0) {
+            return result;
+        }
+
+        result = ObjectUtils.compare(targetFilter, other.targetFilter);
+        if (result != 0) {
+            return result;
+        }
+
+        result = ObjectUtils.compare(condition, other.condition);
+        if (result != 0) {
+            return result;
+        }
+
+        result = ObjectUtils.compare(constraint, other.constraint);
+        if (result != 0) {
+            return result;
+        }
+
+        result = ObjectUtils.compare(period, other.period);
+        if (result != 0) {
+            return result;
+        }
+
+        if (evaluations != other.evaluations) {
+            return evaluations - other.evaluations;
+        }
+
+        result = ObjectUtils.compare(method, other.method);
+        if (result != 0) {
+            return result;
+        }
+
+        return ObjectUtils.compare(action, other.action);
+    }
+
+    @Override
+    public PfConcept copyTo(@NonNull final PfConcept target) {
+        Assertions.instanceOf(target, ToscaTrigger.class);
+
+        final ToscaTrigger copy = ((ToscaTrigger) target);
+        copy.setKey(new PfReferenceKey(key));
+        copy.setDescription(description);
+        copy.setEventType(eventType);
+        copy.setSchedule(schedule != null ? new ToscaTimeInterval(schedule) : null);
+        copy.setTargetFilter(targetFilter != null ? new ToscaEventFilter(targetFilter) : null);
+        copy.setCondition(condition);
+        copy.setConstraint(constraint);
+        copy.setPeriod(period);
+        copy.setEvaluations(evaluations);
+        copy.setMethod(method);
+        copy.setAction(action);
+
+        return copy;
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/TestPojos.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/TestPojos.java
similarity index 96%
rename from models-tosca/src/test/java/org/onap/policy/models/tosca/TestPojos.java
rename to models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/TestPojos.java
index 28cd4cc..d5b5f55 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/TestPojos.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/TestPojos.java
@@ -20,7 +20,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.policy.models.tosca;
+package org.onap.policy.models.tosca.concepts;
 
 import com.openpojo.reflection.filters.FilterPackageInfo;
 import com.openpojo.validation.Validator;
@@ -41,7 +41,7 @@
  */
 public class TestPojos {
 
-    private static final String POJO_PACKAGE = "org.onap.policy.models.tosca";
+    private static final String POJO_PACKAGE = "org.onap.policy.models.tosca.concepts";
 
     @Test
     public void testPojos() {
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogicalKeyTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogicalKeyTest.java
new file mode 100644
index 0000000..60c6eb9
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogicalKeyTest.java
@@ -0,0 +1,134 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+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 static org.junit.Assert.fail;
+
+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 ToscaConstraintLogicalKey.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaConstraintLogicalKeyTest {
+
+    @Test
+    public void testConstraintLogicalKeyPojo() {
+        assertNotNull(new ToscaConstraintLogicalKey());
+        assertNotNull(new ToscaConstraintLogicalKey(new PfReferenceKey()));
+        assertNotNull(new ToscaConstraintLogicalKey(new PfReferenceKey(), ToscaConstraintLogicalKey.Operation.EQ,
+                new PfConceptKey()));
+
+        try {
+            new ToscaConstraintLogicalKey((PfReferenceKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaConstraintLogicalKey((ToscaConstraintLogicalKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        PfConceptKey tclParentKey = new PfConceptKey("tParentKey", "0.0.1");
+        PfReferenceKey tclKey = new PfReferenceKey(tclParentKey, "trigger0");
+        PfConceptKey constraintKey = new PfConceptKey("tParentKey", "0.0.1");
+        ToscaConstraintLogicalKey tcl =
+                new ToscaConstraintLogicalKey(tclKey, ToscaConstraintLogicalKey.Operation.EQ, constraintKey);
+
+        try {
+            new ToscaConstraintLogicalKey(tcl);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("cannot copy an immutable constraint", exc.getMessage());
+        }
+
+        ToscaConstraintLogicalKey tclClone1 = new ToscaConstraintLogicalKey();
+        try {
+            tcl.copyTo(tclClone1);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("cannot copy an immutable constraint", exc.getMessage());
+        }
+        tclClone1 = new ToscaConstraintLogicalKey(tclKey, ToscaConstraintLogicalKey.Operation.EQ, constraintKey);
+
+        assertEquals(tcl, tclClone1);
+        assertEquals(0, tcl.compareTo(tclClone1));
+
+        assertEquals(-1, tcl.compareTo(null));
+        assertEquals(0, tcl.compareTo(tcl));
+        assertFalse(tcl.compareTo(tcl.getKey()) == 0);
+
+        ToscaConstraintLogicalKey differentTcl = new ToscaConstraintLogicalKey(new PfReferenceKey(),
+                ToscaConstraintLogicalKey.Operation.EQ, constraintKey);
+        assertFalse(tcl.compareTo(differentTcl) == 0);
+
+        ToscaConstraintLogicalKey otherTc =
+                new ToscaConstraintLogicalKey(tclKey, ToscaConstraintLogicalKey.Operation.EQ, constraintKey);
+        assertEquals(0, tcl.compareTo(otherTc));
+
+        try {
+            tcl.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertEquals(2, tcl.getKeys().size());
+        assertEquals(2, new ToscaConstraintLogicalKey().getKeys().size());
+
+        new ToscaConstraintLogicalKey().clean();
+        tcl.clean();
+        assertEquals(tclClone1, tcl);
+
+        assertFalse(new ToscaConstraintLogicalKey().validate(new PfValidationResult()).isValid());
+        assertTrue(tcl.validate(new PfValidationResult()).isValid());
+
+        try {
+            tcl.validate(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("resultIn is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaConstraintLogicalKey(tclKey, ToscaConstraintLogicalKey.Operation.EQ, null)
+                    .validate(new PfValidationResult());
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("compareToKey is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertFalse(new ToscaConstraintLogicalKey(tclKey, ToscaConstraintLogicalKey.Operation.EQ, new PfConceptKey())
+                .validate(new PfValidationResult()).isValid());
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogicalStringTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogicalStringTest.java
new file mode 100644
index 0000000..5d0fe93
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogicalStringTest.java
@@ -0,0 +1,133 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+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 static org.junit.Assert.fail;
+
+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 ToscaConstraintLogicalString.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaConstraintLogicalStringTest {
+
+    @Test
+    public void testConstraintLogicalStringPojo() {
+        assertNotNull(new ToscaConstraintLogicalString());
+        assertNotNull(new ToscaConstraintLogicalString(new PfReferenceKey()));
+        assertNotNull(new ToscaConstraintLogicalString(new PfReferenceKey(), ToscaConstraintLogicalString.Operation.EQ,
+                "Constraint"));
+
+        try {
+            new ToscaConstraintLogicalString((PfReferenceKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaConstraintLogicalString((ToscaConstraintLogicalString) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        PfConceptKey tclParentKey = new PfConceptKey("tParentKey", "0.0.1");
+        PfReferenceKey tclKey = new PfReferenceKey(tclParentKey, "trigger0");
+        ToscaConstraintLogicalString tcl =
+                new ToscaConstraintLogicalString(tclKey, ToscaConstraintLogicalString.Operation.EQ, "Constraint");
+
+        try {
+            new ToscaConstraintLogicalString(tcl);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("cannot copy an immutable constraint", exc.getMessage());
+        }
+
+        ToscaConstraintLogicalString tclClone1 = new ToscaConstraintLogicalString();
+        try {
+            tcl.copyTo(tclClone1);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("cannot copy an immutable constraint", exc.getMessage());
+        }
+        tclClone1 = new ToscaConstraintLogicalString(tclKey, ToscaConstraintLogicalString.Operation.EQ, "Constraint");
+
+        assertEquals(tcl, tclClone1);
+        assertEquals(0, tcl.compareTo(tclClone1));
+
+        assertEquals(-1, tcl.compareTo(null));
+        assertEquals(0, tcl.compareTo(tcl));
+        assertFalse(tcl.compareTo(tcl.getKey()) == 0);
+
+        ToscaConstraintLogicalString differentTcl = new ToscaConstraintLogicalString(new PfReferenceKey(),
+                ToscaConstraintLogicalString.Operation.EQ, "Constraint");
+        assertFalse(tcl.compareTo(differentTcl) == 0);
+
+        ToscaConstraintLogicalString otherTc =
+                new ToscaConstraintLogicalString(tclKey, ToscaConstraintLogicalString.Operation.EQ, "Constraint");
+        assertEquals(0, tcl.compareTo(otherTc));
+
+        try {
+            tcl.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertEquals(1, tcl.getKeys().size());
+        assertEquals(1, new ToscaConstraintLogicalString().getKeys().size());
+
+        new ToscaConstraintLogicalString().clean();
+        tcl.clean();
+        assertEquals(tclClone1, tcl);
+
+        assertFalse(new ToscaConstraintLogicalString().validate(new PfValidationResult()).isValid());
+        assertTrue(tcl.validate(new PfValidationResult()).isValid());
+
+        try {
+            tcl.validate(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("resultIn is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaConstraintLogicalString(tclKey, ToscaConstraintLogicalString.Operation.EQ, null)
+                    .validate(new PfValidationResult());
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("compareToString is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertFalse(new ToscaConstraintLogicalString(tclKey, ToscaConstraintLogicalString.Operation.EQ, "")
+                .validate(new PfValidationResult()).isValid());
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogicalTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogicalTest.java
new file mode 100644
index 0000000..fc623f1
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaConstraintLogicalTest.java
@@ -0,0 +1,166 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+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 static org.junit.Assert.fail;
+
+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.concepts.testconcepts.DummyToscaConstraint;
+
+/**
+ * DAO test for ToscaConstraintLogical.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaConstraintLogicalTest {
+
+    @Test
+    public void testConstraintLogicalPojo() {
+        assertNotNull(new ToscaConstraintLogical());
+        assertNotNull(new ToscaConstraintLogical(new PfReferenceKey()));
+
+        try {
+            new ToscaConstraintLogical((PfReferenceKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaConstraintLogical((ToscaConstraintLogical) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        PfConceptKey tclParentKey = new PfConceptKey("tParentKey", "0.0.1");
+        PfReferenceKey tclKey = new PfReferenceKey(tclParentKey, "trigger0");
+        ToscaConstraintLogical tcl = new ToscaConstraintLogical(tclKey, ToscaConstraintLogical.Operation.EQ);
+
+        try {
+            new ToscaConstraintLogical(tcl);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("cannot copy an immutable constraint", exc.getMessage());
+        }
+
+        ToscaConstraintLogical tclClone1 = new ToscaConstraintLogical();
+        try {
+            tcl.copyTo(tclClone1);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("cannot copy an immutable constraint", exc.getMessage());
+        }
+        tclClone1 = new ToscaConstraintLogical(tclKey, ToscaConstraintLogical.Operation.EQ);
+
+        assertEquals(tcl, tclClone1);
+        assertEquals(0, tcl.compareTo(tclClone1));
+
+        assertEquals(-1, tcl.compareTo(null));
+        assertEquals(0, tcl.compareTo(tcl));
+        assertFalse(tcl.compareTo(tcl.getKey()) == 0);
+
+        ToscaConstraintLogical differentTcl =
+                new ToscaConstraintLogical(new PfReferenceKey(), ToscaConstraintLogical.Operation.EQ);
+        assertFalse(tcl.compareTo(differentTcl) == 0);
+
+        ToscaConstraintLogical otherTc = new ToscaConstraintLogical(tclKey, ToscaConstraintLogical.Operation.EQ);
+        assertEquals(0, tcl.compareTo(otherTc));
+
+        try {
+            tcl.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertEquals(1, tcl.getKeys().size());
+        assertEquals(1, new ToscaConstraintLogical().getKeys().size());
+
+        ToscaConstraintLogical tclClone0 = new ToscaConstraintLogical();
+        new ToscaConstraintLogical().clean();
+        tcl.clean();
+        assertEquals(tclClone0, tcl);
+
+        assertFalse(new ToscaConstraintLogical().validate(new PfValidationResult()).isValid());
+        assertTrue(tcl.validate(new PfValidationResult()).isValid());
+
+        try {
+            tcl.validate(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("resultIn is marked @NonNull but is null", exc.getMessage());
+        }
+
+        DummyToscaConstraint dtc = new DummyToscaConstraint();
+        try {
+            new DummyToscaConstraint(dtc);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("cannot copy an immutable constraint", exc.getMessage());
+        }
+
+        try {
+            new DummyToscaConstraint((PfReferenceKey)null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new DummyToscaConstraint((DummyToscaConstraint)null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        DummyToscaConstraint dtcClone = new DummyToscaConstraint();
+
+        assertEquals(dtc, dtcClone);
+        assertEquals(dtc, dtc);
+        assertEquals(0, dtc.compareTo(dtcClone));
+        assertEquals(0, dtc.compareTo(dtc));
+        assertEquals(-1, dtc.compareTo(null));
+        assertEquals(0, dtc.compareTo(dtcClone));
+        assertFalse(dtc.compareTo(dtcClone.getKey()) == 0);
+
+        try {
+            dtc.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            dtc.copyTo(dtcClone);
+            fail("target should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("cannot copy an immutable constraint", exc.getMessage());
+        }
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaDataTypeTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaDataTypeTest.java
new file mode 100644
index 0000000..d0b9c7d
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaDataTypeTest.java
@@ -0,0 +1,140 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+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 static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.concepts.ToscaConstraintLogical.Operation;
+
+/**
+ * DAO test for ToscaDatatype.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaDataTypeTest {
+
+    @Test
+    public void testDataTypePojo() {
+        assertNotNull(new ToscaDataType());
+        assertNotNull(new ToscaDataType(new PfConceptKey()));
+        assertNotNull(new ToscaDataType(new ToscaDataType()));
+
+        try {
+            new ToscaDataType((PfConceptKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaDataType((ToscaDataType) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        PfConceptKey dtKey = new PfConceptKey("tdt", "0.0.1");
+        ToscaDataType tdt = new ToscaDataType(dtKey);
+
+        List<ToscaConstraint> constraints = new ArrayList<>();
+        ToscaConstraintLogicalString lsc =
+                new ToscaConstraintLogicalString(new PfReferenceKey(dtKey, "sc"), Operation.EQ, "hello");
+        constraints.add(lsc);
+        tdt.setConstraints(constraints);
+        assertEquals(constraints, tdt.getConstraints());
+
+        List<ToscaProperty> properties = new ArrayList<>();
+        ToscaProperty tp = new ToscaProperty(new PfReferenceKey(dtKey, "pr"), new PfConceptKey("type", "0.0.1"));
+        properties.add(tp);
+        tdt.setProperties(properties);
+        assertEquals(properties, tdt.getProperties());
+
+        ToscaDataType tdtClone0 = new ToscaDataType(tdt);
+        assertEquals(tdt, tdtClone0);
+        assertEquals(0, tdt.compareTo(tdtClone0));
+
+        ToscaDataType tdtClone1 = new ToscaDataType();
+        tdt.copyTo(tdtClone1);
+        assertEquals(tdt, tdtClone1);
+        assertEquals(0, tdt.compareTo(tdtClone1));
+
+        assertEquals(-1, tdt.compareTo(null));
+        assertEquals(0, tdt.compareTo(tdt));
+        assertFalse(tdt.compareTo(tdt.getKey()) == 0);
+
+        PfConceptKey otherDtKey = new PfConceptKey("otherDt", "0.0.1");
+        ToscaDataType otherDt = new ToscaDataType(otherDtKey);
+
+        assertFalse(tdt.compareTo(otherDt) == 0);
+        otherDt.setKey(dtKey);
+        assertFalse(tdt.compareTo(otherDt) == 0);
+        otherDt.setConstraints(constraints);
+        assertFalse(tdt.compareTo(otherDt) == 0);
+        otherDt.setProperties(properties);
+        assertEquals(0, tdt.compareTo(otherDt));
+
+        try {
+            tdt.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertEquals(4, tdt.getKeys().size());
+        assertEquals(1, new ToscaDataType().getKeys().size());
+
+        new ToscaDataType().clean();
+        tdt.clean();
+        assertEquals(tdtClone0, tdt);
+
+        assertFalse(new ToscaDataType().validate(new PfValidationResult()).isValid());
+        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+
+        tdt.getConstraints().add(null);
+        assertFalse(tdt.validate(new PfValidationResult()).isValid());
+        tdt.getConstraints().remove(null);
+        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+
+        tdt.getProperties().add(null);
+        assertFalse(tdt.validate(new PfValidationResult()).isValid());
+        tdt.getProperties().remove(null);
+        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+
+        try {
+            tdt.validate(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("resultIn is marked @NonNull but is null", exc.getMessage());
+        }
+
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaDataTypesTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaDataTypesTest.java
new file mode 100644
index 0000000..cd9c53e
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaDataTypesTest.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.TreeMap;
+
+import org.junit.Test;
+import org.onap.policy.models.base.PfConceptKey;
+
+public class ToscaDataTypesTest {
+
+    @Test
+    public void testDataTypes() {
+        assertNotNull(new ToscaDataTypes());
+        assertNotNull(new ToscaDataTypes(new PfConceptKey()));
+        assertNotNull(new ToscaDataTypes(new PfConceptKey(), new TreeMap<PfConceptKey, ToscaDataType>()));
+        assertNotNull(new ToscaDataTypes(new ToscaDataTypes()));
+
+        try {
+            new ToscaDataTypes((PfConceptKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaDataTypes((ToscaDataTypes) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaDataTypes(null, null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaDataTypes(new PfConceptKey(), null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("conceptMap is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaDataTypes(null, new TreeMap<PfConceptKey, ToscaDataType>());
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaEntrySchemaTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaEntrySchemaTest.java
new file mode 100644
index 0000000..97d71a2
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaEntrySchemaTest.java
@@ -0,0 +1,147 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+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 static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.concepts.ToscaConstraintLogical.Operation;
+
+/**
+ * DAO test for ToscaEntrySchema.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaEntrySchemaTest {
+
+    @Test
+    public void testEntrySchemaPojo() {
+        assertNotNull(new ToscaEntrySchema());
+        assertNotNull(new ToscaEntrySchema(new PfReferenceKey()));
+        assertNotNull(new ToscaEntrySchema(new PfReferenceKey(), new PfConceptKey()));
+        assertNotNull(new ToscaEntrySchema(new ToscaEntrySchema()));
+
+        try {
+            new ToscaEntrySchema((PfReferenceKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaEntrySchema((ToscaEntrySchema) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        PfReferenceKey esKey = new PfReferenceKey("entrySchemaParent", "0.0.1", "entrySchema");
+        PfConceptKey typeKey = new PfConceptKey("type", "0.0.1");
+        ToscaEntrySchema tes = new ToscaEntrySchema(esKey, typeKey);
+
+        tes.setDescription("A Description");
+        assertEquals("A Description", tes.getDescription());
+
+        List<ToscaConstraint> constraints = new ArrayList<>();
+        ToscaConstraintLogicalString lsc =
+                new ToscaConstraintLogicalString(new PfReferenceKey(esKey, "sc"), Operation.EQ, "hello");
+        constraints.add(lsc);
+        tes.setConstraints(constraints);
+        assertEquals(constraints, tes.getConstraints());
+
+        ToscaEntrySchema tdtClone0 = new ToscaEntrySchema(tes);
+        assertEquals(tes, tdtClone0);
+        assertEquals(0, tes.compareTo(tdtClone0));
+
+        ToscaEntrySchema tdtClone1 = new ToscaEntrySchema();
+        tes.copyTo(tdtClone1);
+        assertEquals(tes, tdtClone1);
+        assertEquals(0, tes.compareTo(tdtClone1));
+
+        assertEquals(-1, tes.compareTo(null));
+        assertEquals(0, tes.compareTo(tes));
+        assertFalse(tes.compareTo(tes.getKey()) == 0);
+
+        PfReferenceKey otherEsKey = new PfReferenceKey("entrySchemaParent", "0.0.1", "otherEntrySchema");
+        ToscaEntrySchema otherEs = new ToscaEntrySchema(otherEsKey);
+
+        assertFalse(tes.compareTo(otherEs) == 0);
+        otherEs.setKey(esKey);
+        assertFalse(tes.compareTo(otherEs) == 0);
+        otherEs.setType(typeKey);
+        assertFalse(tes.compareTo(otherEs) == 0);
+        otherEs.setDescription("A Description");
+        assertFalse(tes.compareTo(otherEs) == 0);
+        otherEs.setConstraints(constraints);
+        assertEquals(0, tes.compareTo(otherEs));
+
+        try {
+            tes.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertEquals(3, tes.getKeys().size());
+        assertEquals(2, new ToscaEntrySchema().getKeys().size());
+
+        new ToscaEntrySchema().clean();
+        tes.clean();
+        assertEquals(tdtClone0, tes);
+
+        assertFalse(new ToscaEntrySchema().validate(new PfValidationResult()).isValid());
+        assertTrue(tes.validate(new PfValidationResult()).isValid());
+
+        tes.setType(PfConceptKey.getNullKey());
+        assertFalse(tes.validate(new PfValidationResult()).isValid());
+        tes.setType(null);
+        assertFalse(tes.validate(new PfValidationResult()).isValid());
+        tes.setType(typeKey);
+        assertTrue(tes.validate(new PfValidationResult()).isValid());
+
+        tes.setDescription("");;
+        assertFalse(tes.validate(new PfValidationResult()).isValid());
+        tes.setDescription("A Description");
+        assertTrue(tes.validate(new PfValidationResult()).isValid());
+
+        tes.getConstraints().add(null);
+        assertFalse(tes.validate(new PfValidationResult()).isValid());
+        tes.getConstraints().remove(null);
+        assertTrue(tes.validate(new PfValidationResult()).isValid());
+
+        try {
+            tes.validate(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("resultIn is marked @NonNull but is null", exc.getMessage());
+        }
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaEventFilterTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaEventFilterTest.java
new file mode 100644
index 0000000..a45d65d
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaEventFilterTest.java
@@ -0,0 +1,165 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+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 static org.junit.Assert.fail;
+
+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.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaEventFilterTest {
+
+    @Test
+    public void testEventFilterPojo() {
+        assertNotNull(new ToscaEventFilter());
+        assertNotNull(new ToscaEventFilter(new PfReferenceKey()));
+        assertNotNull(new ToscaEventFilter(new PfReferenceKey(), new PfConceptKey()));
+        assertNotNull(new ToscaEventFilter(new ToscaEventFilter()));
+
+        try {
+            new ToscaEventFilter((PfReferenceKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaEventFilter(null, null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaEventFilter(null, new PfConceptKey());
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaEventFilter(new PfReferenceKey(), null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("node is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaEventFilter((ToscaEventFilter) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        PfConceptKey efParentKey = new PfConceptKey("tParentKey", "0.0.1");
+        PfReferenceKey efKey = new PfReferenceKey(efParentKey, "trigger0");
+        PfConceptKey nodeKey = new PfConceptKey("tParentKey", "0.0.1");
+        ToscaEventFilter tef = new ToscaEventFilter(efKey, nodeKey);
+
+        tef.setRequirement("A Requrement");
+        assertEquals("A Requrement", tef.getRequirement());
+
+        tef.setCapability("A Capability");
+        assertEquals("A Capability", tef.getCapability());
+
+        ToscaEventFilter tdtClone0 = new ToscaEventFilter(tef);
+        assertEquals(tef, tdtClone0);
+        assertEquals(0, tef.compareTo(tdtClone0));
+
+        ToscaEventFilter tdtClone1 = new ToscaEventFilter();
+        tef.copyTo(tdtClone1);
+        assertEquals(tef, tdtClone1);
+        assertEquals(0, tef.compareTo(tdtClone1));
+
+        assertEquals(-1, tef.compareTo(null));
+        assertEquals(0, tef.compareTo(tef));
+        assertFalse(tef.compareTo(tef.getKey()) == 0);
+
+        PfReferenceKey otherDtKey = new PfReferenceKey("otherDt", "0.0.1", "OtherEventFilter");
+        ToscaEventFilter otherDt = new ToscaEventFilter(otherDtKey);
+
+        assertFalse(tef.compareTo(otherDt) == 0);
+        otherDt.setKey(efKey);
+        assertFalse(tef.compareTo(otherDt) == 0);
+        otherDt.setNode(nodeKey);
+        assertFalse(tef.compareTo(otherDt) == 0);
+        otherDt.setRequirement("A Requrement");
+        assertFalse(tef.compareTo(otherDt) == 0);
+        otherDt.setCapability("A Capability");
+        assertEquals(0, tef.compareTo(otherDt));
+
+        try {
+            tef.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertEquals(2, tef.getKeys().size());
+        assertEquals(2, new ToscaEventFilter().getKeys().size());
+
+        new ToscaEventFilter().clean();
+        tef.clean();
+        assertEquals(tdtClone0, tef);
+
+        assertFalse(new ToscaEventFilter().validate(new PfValidationResult()).isValid());
+        assertTrue(tef.validate(new PfValidationResult()).isValid());
+
+        tef.setRequirement(null);
+        assertTrue(tef.validate(new PfValidationResult()).isValid());
+        tef.setRequirement("");
+        assertFalse(tef.validate(new PfValidationResult()).isValid());
+        tef.setRequirement("A Requrement");
+        assertTrue(tef.validate(new PfValidationResult()).isValid());
+
+        tef.setCapability(null);
+        assertTrue(tef.validate(new PfValidationResult()).isValid());
+        tef.setCapability("");
+        assertFalse(tef.validate(new PfValidationResult()).isValid());
+        tef.setCapability("A Capability");
+        assertTrue(tef.validate(new PfValidationResult()).isValid());
+
+        tef.setNode(null);
+        assertFalse(tef.validate(new PfValidationResult()).isValid());
+        tef.setNode(PfConceptKey.getNullKey());
+        assertFalse(tef.validate(new PfValidationResult()).isValid());
+        tef.setNode(nodeKey);
+        assertTrue(tef.validate(new PfValidationResult()).isValid());
+
+        try {
+            tef.validate(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("resultIn is marked @NonNull but is null", exc.getMessage());
+        }
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaModelTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaModelTest.java
new file mode 100644
index 0000000..ca6445f
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaModelTest.java
@@ -0,0 +1,142 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+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 static org.junit.Assert.fail;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+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.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaModelTest {
+
+    @Test
+    public void testModelPojo() {
+        assertNotNull(new ToscaModel());
+        assertNotNull(new ToscaModel(new PfConceptKey()));
+        assertNotNull(new ToscaModel(new PfConceptKey(), new ToscaServiceTemplates()));
+        assertNotNull(new ToscaModel(new ToscaModel()));
+
+        try {
+            new ToscaModel((PfConceptKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaModel(null, null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaModel(null, new ToscaServiceTemplates());
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaModel(new PfConceptKey(), null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("serviceTemplates is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaModel((ToscaModel) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        PfConceptKey tstsKey = new PfConceptKey("tsts", "0.0.1");
+        Map<PfConceptKey, ToscaServiceTemplate> tstMap = new TreeMap<>();
+        ToscaServiceTemplates tsts = new ToscaServiceTemplates(tstsKey, tstMap);
+        PfConceptKey tmKey = new PfConceptKey("tst", "0.0.1");
+        ToscaModel tm = new ToscaModel(tmKey, tsts);
+
+        ToscaModel tttClone0 = new ToscaModel(tm);
+        assertEquals(tm, tttClone0);
+        assertEquals(0, tm.compareTo(tttClone0));
+
+        ToscaModel tttClone1 = new ToscaModel();
+        tm.copyTo(tttClone1);
+        assertEquals(tm, tttClone1);
+        assertEquals(0, tm.compareTo(tttClone1));
+
+        assertEquals(-1, tm.compareTo(null));
+        assertEquals(0, tm.compareTo(tm));
+        assertFalse(tm.compareTo(tm.getKey()) == 0);
+
+        PfConceptKey otherDtKey = new PfConceptKey("otherDt", "0.0.1");
+        ToscaModel otherDt = new ToscaModel(otherDtKey);
+
+        assertFalse(tm.compareTo(otherDt) == 0);
+        otherDt.setKey(tmKey);
+        assertFalse(tm.compareTo(otherDt) == 0);
+        otherDt.setServiceTemplates(tsts);
+        assertEquals(0, tm.compareTo(otherDt));
+
+        try {
+            tm.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("targetObject is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertEquals(2, tm.getKeys().size());
+        assertEquals(2, new ToscaModel().getKeys().size());
+
+        new ToscaModel().clean();
+        tm.clean();
+        assertEquals(tttClone0, tm);
+
+        assertFalse(new ToscaModel().validate(new PfValidationResult()).isValid());
+        assertFalse(tm.validate(new PfValidationResult()).isValid());
+
+        tm.register();
+        assertTrue(PfModelService.existsModel(tm.getServiceTemplates().getId()));
+        PfModelService.deregisterModel(tm.getServiceTemplates().getId());
+
+        try {
+            tm.validate(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("resultIn is marked @NonNull but is null", exc.getMessage());
+        }
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaPoliciesTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaPoliciesTest.java
new file mode 100644
index 0000000..76fdd53
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaPoliciesTest.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.TreeMap;
+
+import org.junit.Test;
+import org.onap.policy.models.base.PfConceptKey;
+
+public class ToscaPoliciesTest {
+
+    @Test
+    public void testPolicies() {
+        assertNotNull(new ToscaPolicies());
+        assertNotNull(new ToscaPolicies(new PfConceptKey()));
+        assertNotNull(new ToscaPolicies(new PfConceptKey(), new TreeMap<PfConceptKey, ToscaPolicy>()));
+        assertNotNull(new ToscaPolicies(new ToscaPolicies()));
+
+        try {
+            new ToscaPolicies((PfConceptKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaPolicies((ToscaPolicies) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaPolicies(null, null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaPolicies(new PfConceptKey(), null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("conceptMap is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaPolicies(null, new TreeMap<PfConceptKey, ToscaPolicy>());
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaPolicyTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaPolicyTest.java
new file mode 100644
index 0000000..295c0f2
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaPolicyTest.java
@@ -0,0 +1,162 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+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 static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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 ToscaDatatype.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaPolicyTest {
+
+    @Test
+    public void testPolicyPojo() {
+        assertNotNull(new ToscaPolicy());
+        assertNotNull(new ToscaPolicy(new PfConceptKey()));
+        assertNotNull(new ToscaPolicy(new PfConceptKey(), new PfConceptKey()));
+        assertNotNull(new ToscaPolicy(new ToscaPolicy()));
+
+        try {
+            new ToscaPolicy((PfConceptKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaPolicy(null, null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaPolicy(new PfConceptKey(), null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("type is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaPolicy(null, new PfConceptKey());
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaPolicy((ToscaPolicy) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        PfConceptKey tpKey = new PfConceptKey("tdt", "0.0.1");
+        PfConceptKey ptKey = new PfConceptKey("policyType", "0.0.1");
+        ToscaPolicy tp = new ToscaPolicy(tpKey, ptKey);
+
+        List<ToscaProperty> properties = new ArrayList<>();
+        ToscaProperty property = new ToscaProperty(new PfReferenceKey(tpKey, "pr"), new PfConceptKey("type", "0.0.1"));
+        properties.add(property);
+        tp.setProperties(properties);
+        assertEquals(properties, tp.getProperties());
+
+        List<PfConceptKey> targets = new ArrayList<>();
+        PfConceptKey target = new PfConceptKey("target", "0.0.1");
+        targets.add(target);
+        tp.setTargets(targets);
+        assertEquals(targets, tp.getTargets());
+
+        ToscaPolicy tdtClone0 = new ToscaPolicy(tp);
+        assertEquals(tp, tdtClone0);
+        assertEquals(0, tp.compareTo(tdtClone0));
+
+        ToscaPolicy tdtClone1 = new ToscaPolicy();
+        tp.copyTo(tdtClone1);
+        assertEquals(tp, tdtClone1);
+        assertEquals(0, tp.compareTo(tdtClone1));
+
+        assertEquals(-1, tp.compareTo(null));
+        assertEquals(0, tp.compareTo(tp));
+        assertFalse(tp.compareTo(tp.getKey()) == 0);
+
+        PfConceptKey otherDtKey = new PfConceptKey("otherDt", "0.0.1");
+        ToscaPolicy otherDt = new ToscaPolicy(otherDtKey);
+
+        assertFalse(tp.compareTo(otherDt) == 0);
+        otherDt.setKey(tpKey);
+        assertFalse(tp.compareTo(otherDt) == 0);
+        otherDt.setType(ptKey);
+        assertFalse(tp.compareTo(otherDt) == 0);
+        otherDt.setProperties(properties);
+        assertFalse(tp.compareTo(otherDt) == 0);
+        otherDt.setTargets(targets);
+        assertEquals(0, tp.compareTo(otherDt));
+
+        try {
+            tp.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertEquals(5, tp.getKeys().size());
+        assertEquals(2, new ToscaPolicy().getKeys().size());
+
+        new ToscaPolicy().clean();
+        tp.clean();
+        assertEquals(tdtClone0, tp);
+
+        assertFalse(new ToscaPolicy().validate(new PfValidationResult()).isValid());
+        assertTrue(tp.validate(new PfValidationResult()).isValid());
+
+        tp.getProperties().add(null);
+        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        tp.getProperties().remove(null);
+        assertTrue(tp.validate(new PfValidationResult()).isValid());
+
+        tp.getTargets().add(null);
+        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        tp.getTargets().remove(null);
+        assertTrue(tp.validate(new PfValidationResult()).isValid());
+
+        try {
+            tp.validate(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("resultIn is marked @NonNull but is null", exc.getMessage());
+        }
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaPolicyTypeTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaPolicyTypeTest.java
new file mode 100644
index 0000000..7926bfe
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaPolicyTypeTest.java
@@ -0,0 +1,208 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+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 static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+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 ToscaPolicyType.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaPolicyTypeTest {
+
+    @Test
+    public void testPolicyTypePojo() {
+        assertNotNull(new ToscaPolicyType());
+        assertNotNull(new ToscaPolicyType(new PfConceptKey()));
+        assertNotNull(new ToscaPolicyType(new ToscaPolicyType()));
+
+        try {
+            new ToscaPolicyType((PfConceptKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaPolicyType((ToscaPolicyType) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        PfConceptKey ptKey = new PfConceptKey("tdt", "0.0.1");
+        ToscaPolicyType tpt = new ToscaPolicyType(ptKey);
+
+        PfConceptKey derivedFromKey = new PfConceptKey("deriveFrom", "0.0.1");
+        tpt.setDerivedFrom(derivedFromKey);
+
+        Map<String, String> metadata = new HashMap<>();
+        metadata.put("key", "value");
+        tpt.setMetadata(metadata);
+        assertEquals(metadata, tpt.getMetadata());
+
+        tpt.setDescription("A Description");
+
+        PfConceptKey propTypeKey = new PfConceptKey("propType", "0.0.1");
+        List<ToscaProperty> properties = new ArrayList<>();
+        ToscaProperty tp = new ToscaProperty(new PfReferenceKey(ptKey, "aProp"), propTypeKey);
+        properties.add(tp);
+        tpt.setProperties(properties);
+        assertEquals(properties, tpt.getProperties());
+
+        List<PfConceptKey> targets = new ArrayList<>();
+        PfConceptKey target = new PfConceptKey("target", "0.0.1");
+        targets.add(target);
+        tpt.setTargets(targets);
+        assertEquals(targets, tpt.getTargets());
+
+        List<ToscaTrigger> triggers = new ArrayList<>();
+        ToscaTrigger trigger = new ToscaTrigger(new PfReferenceKey(ptKey, "aTrigger"), "EventType", "Action");
+        triggers.add(trigger);
+        tpt.setTriggers(triggers);
+        assertEquals(triggers, tpt.getTriggers());
+
+        ToscaPolicyType tdtClone0 = new ToscaPolicyType(tpt);
+        assertEquals(tpt, tdtClone0);
+        assertEquals(0, tpt.compareTo(tdtClone0));
+
+        ToscaPolicyType tdtClone1 = new ToscaPolicyType();
+        tpt.copyTo(tdtClone1);
+        assertEquals(tpt, tdtClone1);
+        assertEquals(0, tpt.compareTo(tdtClone1));
+
+        assertEquals(-1, tpt.compareTo(null));
+        assertEquals(0, tpt.compareTo(tpt));
+        assertFalse(tpt.compareTo(tpt.getKey()) == 0);
+
+        PfConceptKey otherDtKey = new PfConceptKey("otherDt", "0.0.1");
+        ToscaPolicyType otherDt = new ToscaPolicyType(otherDtKey);
+
+        assertFalse(tpt.compareTo(otherDt) == 0);
+        otherDt.setKey(ptKey);
+        assertFalse(tpt.compareTo(otherDt) == 0);
+        otherDt.setDerivedFrom(derivedFromKey);
+        assertFalse(tpt.compareTo(otherDt) == 0);
+        otherDt.setMetadata(metadata);
+        assertFalse(tpt.compareTo(otherDt) == 0);
+        otherDt.setDescription("A Description");
+        assertFalse(tpt.compareTo(otherDt) == 0);
+        otherDt.setProperties(properties);
+        assertFalse(tpt.compareTo(otherDt) == 0);
+        otherDt.setTargets(targets);
+        assertFalse(tpt.compareTo(otherDt) == 0);
+        otherDt.setTriggers(triggers);
+        assertEquals(0, tpt.compareTo(otherDt));
+
+        try {
+            tpt.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertEquals(6, tpt.getKeys().size());
+        assertEquals(1, new ToscaPolicyType().getKeys().size());
+
+        new ToscaPolicyType().clean();
+        tpt.clean();
+        assertEquals(tdtClone0, tpt);
+
+        assertFalse(new ToscaPolicyType().validate(new PfValidationResult()).isValid());
+        assertTrue(tpt.validate(new PfValidationResult()).isValid());
+
+        tpt.getProperties().add(null);
+        assertFalse(tpt.validate(new PfValidationResult()).isValid());
+        tpt.getProperties().remove(null);
+        assertTrue(tpt.validate(new PfValidationResult()).isValid());
+
+        tpt.getTargets().add(null);
+        assertFalse(tpt.validate(new PfValidationResult()).isValid());
+        tpt.getTargets().remove(null);
+        assertTrue(tpt.validate(new PfValidationResult()).isValid());
+
+        tpt.getTriggers().add(null);
+        assertFalse(tpt.validate(new PfValidationResult()).isValid());
+        tpt.getTriggers().remove(null);
+        assertTrue(tpt.validate(new PfValidationResult()).isValid());
+
+        tpt.getMetadata().put(null, null);
+        assertFalse(tpt.validate(new PfValidationResult()).isValid());
+        tpt.getMetadata().remove(null);
+        assertTrue(tpt.validate(new PfValidationResult()).isValid());
+
+        tpt.getMetadata().put("nullKey", null);
+        assertFalse(tpt.validate(new PfValidationResult()).isValid());
+        tpt.getMetadata().remove("nullKey");
+        assertTrue(tpt.validate(new PfValidationResult()).isValid());
+
+        tpt.setDescription("");;
+        assertFalse(tpt.validate(new PfValidationResult()).isValid());
+        tpt.setDescription("A Description");
+        assertTrue(tpt.validate(new PfValidationResult()).isValid());
+
+        tpt.setDerivedFrom(PfConceptKey.getNullKey());
+        assertFalse(tpt.validate(new PfValidationResult()).isValid());
+        tpt.setDerivedFrom(derivedFromKey);
+        assertTrue(tpt.validate(new PfValidationResult()).isValid());
+
+        try {
+            tpt.validate(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("resultIn is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaEntityType((PfConceptKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaEntityType((ToscaEntityType) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        ToscaEntityType tet = new ToscaEntityType(tpt.getKey());
+        assertEquals(-1, tet.compareTo(null));
+        assertEquals(0, tet.compareTo(tet));
+        assertFalse(tet.compareTo(tet.getKey()) == 0);
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaPolicyTypesTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaPolicyTypesTest.java
new file mode 100644
index 0000000..0693463
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaPolicyTypesTest.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.TreeMap;
+
+import org.junit.Test;
+import org.onap.policy.models.base.PfConceptKey;
+
+public class ToscaPolicyTypesTest {
+
+    @Test
+    public void testPolicyTypes() {
+        assertNotNull(new ToscaPolicyTypes());
+        assertNotNull(new ToscaPolicyTypes(new PfConceptKey()));
+        assertNotNull(new ToscaPolicyTypes(new PfConceptKey(), new TreeMap<PfConceptKey, ToscaPolicyType>()));
+        assertNotNull(new ToscaPolicyTypes(new ToscaPolicyTypes()));
+
+        try {
+            new ToscaPolicyTypes((PfConceptKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaPolicyTypes((ToscaPolicyTypes) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaPolicyTypes(null, null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaPolicyTypes(new PfConceptKey(), null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("conceptMap is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaPolicyTypes(null, new TreeMap<PfConceptKey, ToscaPolicyType>());
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaPropertyTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaPropertyTest.java
new file mode 100644
index 0000000..d0563fd
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaPropertyTest.java
@@ -0,0 +1,223 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+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 static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.concepts.ToscaConstraintLogical.Operation;
+
+/**
+ * DAO test for ToscaProperty.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaPropertyTest {
+
+    @Test
+    public void testPropertyPojo() {
+        assertNotNull(new ToscaProperty());
+        assertNotNull(new ToscaProperty(new PfReferenceKey()));
+        assertNotNull(new ToscaProperty(new PfReferenceKey(), new PfConceptKey()));
+        assertNotNull(new ToscaProperty(new ToscaProperty()));
+
+        try {
+            new ToscaProperty((PfReferenceKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaProperty(null, null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaProperty(null, new PfConceptKey());
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaProperty(new PfReferenceKey(), null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("type is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaProperty((ToscaProperty) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        PfConceptKey pparentKey = new PfConceptKey("tParentKey", "0.0.1");
+        PfReferenceKey pkey = new PfReferenceKey(pparentKey, "trigger0");
+        PfConceptKey ptypeKey = new PfConceptKey("TTypeKey", "0.0.1");
+        ToscaProperty tp = new ToscaProperty(pkey, ptypeKey);
+
+        tp.setDescription("A Description");
+        assertEquals("A Description", tp.getDescription());
+
+        tp.setRequired(false);
+        assertFalse(tp.isRequired());
+
+        PfConceptKey tdefaultKey = new PfConceptKey("defaultKey", "0.0.1");
+        tp.setDefaultValue(tdefaultKey);
+
+        tp.setStatus(ToscaProperty.Status.SUPPORTED);
+
+        List<ToscaConstraint> constraints = new ArrayList<>();
+        ToscaConstraintLogicalString lsc =
+                new ToscaConstraintLogicalString(new PfReferenceKey(pkey, "sc"), Operation.EQ, "hello");
+        constraints.add(lsc);
+        tp.setConstraints(constraints);
+        assertEquals(constraints, tp.getConstraints());
+
+        PfReferenceKey esKey = new PfReferenceKey(pkey, "entrySchema");
+        PfConceptKey typeKey = new PfConceptKey("type", "0.0.1");
+        ToscaEntrySchema tes = new ToscaEntrySchema(esKey, typeKey);
+        tp.setEntrySchema(tes);
+
+        ToscaProperty tdtClone0 = new ToscaProperty(tp);
+        assertEquals(tp, tdtClone0);
+        assertEquals(0, tp.compareTo(tdtClone0));
+
+        ToscaProperty tdtClone1 = new ToscaProperty();
+        tp.copyTo(tdtClone1);
+        assertEquals(tp, tdtClone1);
+        assertEquals(0, tp.compareTo(tdtClone1));
+
+        assertEquals(-1, tp.compareTo(null));
+        assertEquals(0, tp.compareTo(tp));
+        assertFalse(tp.compareTo(tp.getKey()) == 0);
+
+        PfReferenceKey otherDtKey = new PfReferenceKey("otherDt", "0.0.1", "OtherProperty");
+        ToscaProperty otherDt = new ToscaProperty(otherDtKey);
+
+        assertFalse(tp.compareTo(otherDt) == 0);
+        otherDt.setKey(pkey);
+        assertFalse(tp.compareTo(otherDt) == 0);
+        otherDt.setType(ptypeKey);
+        assertFalse(tp.compareTo(otherDt) == 0);
+        otherDt.setDescription("A Description");
+        assertFalse(tp.compareTo(otherDt) == 0);
+        otherDt.setRequired(false);
+        assertFalse(tp.compareTo(otherDt) == 0);
+        otherDt.setDefaultValue(tdefaultKey);
+        assertFalse(tp.compareTo(otherDt) == 0);
+        otherDt.setStatus(ToscaProperty.Status.SUPPORTED);
+        assertFalse(tp.compareTo(otherDt) == 0);
+        assertFalse(tp.compareTo(otherDt) == 0);
+        otherDt.setConstraints(constraints);
+        assertFalse(tp.compareTo(otherDt) == 0);
+        otherDt.setEntrySchema(tes);
+        assertEquals(0, tp.compareTo(otherDt));
+
+        otherDt.setRequired(true);
+        assertFalse(tp.compareTo(otherDt) == 0);
+        otherDt.setRequired(false);
+        assertEquals(0, tp.compareTo(otherDt));
+
+        otherDt.setStatus(ToscaProperty.Status.UNSUPPORTED);
+        assertFalse(tp.compareTo(otherDt) == 0);
+        otherDt.setStatus(ToscaProperty.Status.SUPPORTED);
+        assertEquals(0, tp.compareTo(otherDt));
+
+        try {
+            tp.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertEquals(6, tp.getKeys().size());
+        assertEquals(2, new ToscaProperty().getKeys().size());
+
+        new ToscaProperty().clean();
+        tp.clean();
+        assertEquals(tdtClone0, tp);
+
+        assertFalse(new ToscaProperty().validate(new PfValidationResult()).isValid());
+        assertTrue(tp.validate(new PfValidationResult()).isValid());
+
+        tp.setDescription(null);
+        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        tp.setDescription("");
+        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        tp.setDescription("A Description");
+        assertTrue(tp.validate(new PfValidationResult()).isValid());
+
+        tp.setType(null);
+        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        tp.setType(typeKey);
+        assertTrue(tp.validate(new PfValidationResult()).isValid());
+
+        tp.setType(PfConceptKey.getNullKey());
+        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        tp.setType(typeKey);
+        assertTrue(tp.validate(new PfValidationResult()).isValid());
+
+        tp.setDefaultValue(null);
+        assertTrue(tp.validate(new PfValidationResult()).isValid());
+        tp.setDefaultValue(tdefaultKey);
+        assertTrue(tp.validate(new PfValidationResult()).isValid());
+
+        tp.setDefaultValue(PfConceptKey.getNullKey());
+        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        tp.setDefaultValue(tdefaultKey);
+        assertTrue(tp.validate(new PfValidationResult()).isValid());
+
+        tp.getConstraints().add(null);
+        assertFalse(tp.validate(new PfValidationResult()).isValid());
+        tp.getConstraints().remove(null);
+        assertTrue(tp.validate(new PfValidationResult()).isValid());
+
+        try {
+            tp.setStatus(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("status is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            tp.validate(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("resultIn is marked @NonNull but is null", exc.getMessage());
+        }
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplateTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplateTest.java
new file mode 100644
index 0000000..0fc7a0b
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplateTest.java
@@ -0,0 +1,170 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+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 static org.junit.Assert.fail;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.junit.Test;
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfValidationResult;
+
+/**
+ * DAO test for ToscaDatatype.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaServiceTemplateTest {
+
+    @Test
+    public void testServiceTemplatePojo() {
+        assertNotNull(new ToscaServiceTemplate());
+        assertNotNull(new ToscaServiceTemplate(new PfConceptKey()));
+        assertNotNull(new ToscaServiceTemplate(new PfConceptKey(), ""));
+        assertNotNull(new ToscaServiceTemplate(new ToscaServiceTemplate()));
+
+        try {
+            new ToscaServiceTemplate((PfConceptKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaServiceTemplate(null, null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaServiceTemplate(null, "");
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaServiceTemplate(new PfConceptKey(), null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("toscaDefinitionsVersion is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaServiceTemplate((ToscaServiceTemplate) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        PfConceptKey tstKey = new PfConceptKey("tst", "0.0.1");
+        ToscaServiceTemplate tst = new ToscaServiceTemplate(tstKey, "Tosca Version");
+
+        PfConceptKey dataTypeKey = new PfConceptKey("DataType", "0.0.1");
+        ToscaDataType dataType0 = new ToscaDataType(dataTypeKey);
+        PfConceptKey dtsKey = new PfConceptKey("dts", "0.0.1");
+        Map<PfConceptKey, ToscaDataType> dataTypeMap = new TreeMap<>();
+        dataTypeMap.put(dataTypeKey, dataType0);
+        ToscaDataTypes dataTypes = new ToscaDataTypes(dtsKey, dataTypeMap);
+        tst.setDataTypes(dataTypes);
+        assertEquals(dataTypes, tst.getDataTypes());
+
+        PfConceptKey policyTypeKey = new PfConceptKey("DataType", "0.0.1");
+        ToscaPolicyType policyType0 = new ToscaPolicyType(policyTypeKey);
+        PfConceptKey ptsKey = new PfConceptKey("dts", "0.0.1");
+        Map<PfConceptKey, ToscaPolicyType> policyTypeMap = new TreeMap<>();
+        policyTypeMap.put(policyTypeKey, policyType0);
+        ToscaPolicyTypes policyTypes = new ToscaPolicyTypes(ptsKey, policyTypeMap);
+        tst.setPolicyTypes(policyTypes);
+        assertEquals(policyTypes, tst.getPolicyTypes());
+
+        PfConceptKey tttKey = new PfConceptKey("TopologyTemplate", "0.0.1");
+        ToscaTopologyTemplate ttt = new ToscaTopologyTemplate(tttKey);
+        tst.setTopologyTemplate(ttt);
+        assertEquals(ttt, tst.getTopologyTemplate());
+
+        ToscaServiceTemplate tttClone0 = new ToscaServiceTemplate(tst);
+        assertEquals(tst, tttClone0);
+        assertEquals(0, tst.compareTo(tttClone0));
+
+        ToscaServiceTemplate tttClone1 = new ToscaServiceTemplate();
+        tst.copyTo(tttClone1);
+        assertEquals(tst, tttClone1);
+        assertEquals(0, tst.compareTo(tttClone1));
+
+        assertEquals(-1, tst.compareTo(null));
+        assertEquals(0, tst.compareTo(tst));
+        assertFalse(tst.compareTo(tst.getKey()) == 0);
+
+        PfConceptKey otherDtKey = new PfConceptKey("otherDt", "0.0.1");
+        ToscaServiceTemplate otherDt = new ToscaServiceTemplate(otherDtKey);
+
+        assertFalse(tst.compareTo(otherDt) == 0);
+        otherDt.setKey(tstKey);
+        assertFalse(tst.compareTo(otherDt) == 0);
+        otherDt.setToscaDefinitionsVersion("Tosca Version");
+        assertFalse(tst.compareTo(otherDt) == 0);
+        otherDt.setDataTypes(dataTypes);
+        assertFalse(tst.compareTo(otherDt) == 0);
+        otherDt.setPolicyTypes(policyTypes);
+        assertFalse(tst.compareTo(otherDt) == 0);
+        otherDt.setTopologyTemplate(ttt);
+        assertEquals(0, tst.compareTo(otherDt));
+
+        try {
+            tst.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertEquals(6, tst.getKeys().size());
+        assertEquals(1, new ToscaServiceTemplate().getKeys().size());
+
+        new ToscaServiceTemplate().clean();
+        tst.clean();
+        assertEquals(tttClone0, tst);
+
+        assertFalse(new ToscaServiceTemplate().validate(new PfValidationResult()).isValid());
+        assertTrue(tst.validate(new PfValidationResult()).isValid());
+
+        tst.setDescription(null);
+        assertTrue(tst.validate(new PfValidationResult()).isValid());
+        tst.setDescription("");
+        assertFalse(tst.validate(new PfValidationResult()).isValid());
+        tst.setDescription("A Description");
+        assertTrue(tst.validate(new PfValidationResult()).isValid());
+
+        try {
+            tst.validate(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("resultIn is marked @NonNull but is null", exc.getMessage());
+        }
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplatesTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplatesTest.java
new file mode 100644
index 0000000..c866f11
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaServiceTemplatesTest.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.TreeMap;
+
+import org.junit.Test;
+import org.onap.policy.models.base.PfConceptKey;
+
+public class ToscaServiceTemplatesTest {
+
+    @Test
+    public void testServiceTemplates() {
+        assertNotNull(new ToscaServiceTemplates());
+        assertNotNull(new ToscaServiceTemplates(new PfConceptKey()));
+        assertNotNull(new ToscaServiceTemplates(new PfConceptKey(), new TreeMap<PfConceptKey, ToscaServiceTemplate>()));
+        assertNotNull(new ToscaServiceTemplates(new ToscaServiceTemplates()));
+
+        try {
+            new ToscaServiceTemplates((PfConceptKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaServiceTemplates((ToscaServiceTemplates) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaServiceTemplates(null, null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaServiceTemplates(new PfConceptKey(), null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("conceptMap is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaServiceTemplates(null, new TreeMap<PfConceptKey, ToscaServiceTemplate>());
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaTimeIntervalTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaTimeIntervalTest.java
new file mode 100644
index 0000000..33af683
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaTimeIntervalTest.java
@@ -0,0 +1,181 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+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 static org.junit.Assert.fail;
+
+import java.util.Date;
+
+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.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaTimeIntervalTest {
+
+    @Test
+    public void testTimeIntervalPojo() {
+        assertNotNull(new ToscaTimeInterval());
+        assertNotNull(new ToscaTimeInterval(new PfReferenceKey()));
+        assertNotNull(new ToscaTimeInterval(new PfReferenceKey(), new Date(), new Date()));
+        assertNotNull(new ToscaTimeInterval(new ToscaTimeInterval()));
+
+        try {
+            new ToscaTimeInterval((PfReferenceKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTimeInterval(null, null, null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTimeInterval(null, null, new Date());
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTimeInterval(null, new Date(), null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTimeInterval(null, new Date(), new Date());
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTimeInterval(new PfReferenceKey(), null, null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("startTime is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTimeInterval(new PfReferenceKey(), null, new Date());
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("startTime is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTimeInterval(new PfReferenceKey(), new Date(), null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("endTime is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTimeInterval((ToscaTimeInterval) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        PfConceptKey ttiParentKey = new PfConceptKey("tParentKey", "0.0.1");
+        PfReferenceKey ttiKey = new PfReferenceKey(ttiParentKey, "trigger0");
+        Date startTime = new Date(1000);
+        Date endTime = new Date(2000);
+        ToscaTimeInterval tti = new ToscaTimeInterval(ttiKey, startTime, endTime);
+
+        ToscaTimeInterval tdtClone0 = new ToscaTimeInterval(tti);
+        assertEquals(tti, tdtClone0);
+        assertEquals(0, tti.compareTo(tdtClone0));
+
+        ToscaTimeInterval tdtClone1 = new ToscaTimeInterval();
+        tti.copyTo(tdtClone1);
+        assertEquals(tti, tdtClone1);
+        assertEquals(0, tti.compareTo(tdtClone1));
+
+        assertEquals(-1, tti.compareTo(null));
+        assertEquals(0, tti.compareTo(tti));
+        assertFalse(tti.compareTo(tti.getKey()) == 0);
+
+        PfReferenceKey otherDtKey = new PfReferenceKey("otherDt", "0.0.1", "OtherTimeInterval");
+        ToscaTimeInterval otherDt = new ToscaTimeInterval(otherDtKey);
+
+        assertFalse(tti.compareTo(otherDt) == 0);
+        otherDt.setKey(ttiKey);
+        assertFalse(tti.compareTo(otherDt) == 0);
+        otherDt.setStartTime(startTime);
+        assertFalse(tti.compareTo(otherDt) == 0);
+        otherDt.setEndTime(endTime);
+        assertEquals(0, tti.compareTo(otherDt));
+
+        try {
+            tti.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertEquals(1, tti.getKeys().size());
+        assertEquals(1, new ToscaTimeInterval().getKeys().size());
+
+        new ToscaTimeInterval().clean();
+        tti.clean();
+        assertEquals(tdtClone0, tti);
+
+        assertFalse(new ToscaTimeInterval().validate(new PfValidationResult()).isValid());
+        assertTrue(tti.validate(new PfValidationResult()).isValid());
+
+        tti.setStartTime(null);
+        assertFalse(tti.validate(new PfValidationResult()).isValid());
+        tti.setStartTime(new Date(endTime.getTime() + 1));
+        assertFalse(tti.validate(new PfValidationResult()).isValid());
+        tti.setStartTime(startTime);
+        assertTrue(tti.validate(new PfValidationResult()).isValid());
+
+        tti.setEndTime(null);
+        assertFalse(tti.validate(new PfValidationResult()).isValid());
+        tti.setEndTime(new Date(startTime.getTime() - 1));
+        assertFalse(tti.validate(new PfValidationResult()).isValid());
+        tti.setEndTime(endTime);
+        assertTrue(tti.validate(new PfValidationResult()).isValid());
+
+        try {
+            tti.validate(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("resultIn is marked @NonNull but is null", exc.getMessage());
+        }
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaTopologyTemplateTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaTopologyTemplateTest.java
new file mode 100644
index 0000000..4a288f1
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaTopologyTemplateTest.java
@@ -0,0 +1,134 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+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 static org.junit.Assert.fail;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.junit.Test;
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfValidationResult;
+
+/**
+ * DAO test for ToscaDatatype.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaTopologyTemplateTest {
+
+    @Test
+    public void testTopologyTemplatePojo() {
+        assertNotNull(new ToscaTopologyTemplate());
+        assertNotNull(new ToscaTopologyTemplate(new PfConceptKey()));
+        assertNotNull(new ToscaTopologyTemplate(new ToscaTopologyTemplate()));
+
+        try {
+            new ToscaTopologyTemplate((PfConceptKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTopologyTemplate((ToscaTopologyTemplate) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        PfConceptKey tttKey = new PfConceptKey("ttt", "0.0.1");
+        ToscaTopologyTemplate ttt = new ToscaTopologyTemplate(tttKey);
+
+        ttt.setDescription("A Description");
+        assertEquals("A Description", ttt.getDescription());
+
+        PfConceptKey policy0TypeKey = new PfConceptKey("Policy0Type", "0.0.1");
+        PfConceptKey policy0Key = new PfConceptKey("Policy0", "0.0.1");
+
+        ToscaPolicy policy0 = new ToscaPolicy(policy0Key, policy0TypeKey);
+        PfConceptKey polsKey = new PfConceptKey("pols", "0.0.1");
+        Map<PfConceptKey, ToscaPolicy> policyMap = new TreeMap<>();
+        policyMap.put(policy0Key, policy0);
+        ToscaPolicies policies = new ToscaPolicies(polsKey, policyMap);
+        ttt.setPolicies(policies);
+
+        ToscaTopologyTemplate tttClone0 = new ToscaTopologyTemplate(ttt);
+        assertEquals(ttt, tttClone0);
+        assertEquals(0, ttt.compareTo(tttClone0));
+
+        ToscaTopologyTemplate tttClone1 = new ToscaTopologyTemplate();
+        ttt.copyTo(tttClone1);
+        assertEquals(ttt, tttClone1);
+        assertEquals(0, ttt.compareTo(tttClone1));
+
+        assertEquals(-1, ttt.compareTo(null));
+        assertEquals(0, ttt.compareTo(ttt));
+        assertFalse(ttt.compareTo(ttt.getKey()) == 0);
+
+        PfConceptKey otherDtKey = new PfConceptKey("otherDt", "0.0.1");
+        ToscaTopologyTemplate otherDt = new ToscaTopologyTemplate(otherDtKey);
+
+        assertFalse(ttt.compareTo(otherDt) == 0);
+        otherDt.setKey(tttKey);
+        assertFalse(ttt.compareTo(otherDt) == 0);
+        otherDt.setDescription("A Description");
+        assertFalse(ttt.compareTo(otherDt) == 0);
+        otherDt.setPolicies(policies);
+        assertEquals(0, ttt.compareTo(otherDt));
+
+        try {
+            ttt.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertEquals(4, ttt.getKeys().size());
+        assertEquals(1, new ToscaTopologyTemplate().getKeys().size());
+
+        new ToscaTopologyTemplate().clean();
+        ttt.clean();
+        assertEquals(tttClone0, ttt);
+
+        assertFalse(new ToscaTopologyTemplate().validate(new PfValidationResult()).isValid());
+        assertTrue(ttt.validate(new PfValidationResult()).isValid());
+
+        ttt.setDescription(null);
+        assertTrue(ttt.validate(new PfValidationResult()).isValid());
+        ttt.setDescription("");
+        assertFalse(ttt.validate(new PfValidationResult()).isValid());
+        ttt.setDescription("A Description");
+        assertTrue(ttt.validate(new PfValidationResult()).isValid());
+
+        try {
+            ttt.validate(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("resultIn is marked @NonNull but is null", exc.getMessage());
+        }
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaTriggerTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaTriggerTest.java
new file mode 100644
index 0000000..d1423a6
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/ToscaTriggerTest.java
@@ -0,0 +1,228 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts;
+
+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 static org.junit.Assert.fail;
+
+import java.time.Duration;
+import java.util.Date;
+
+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.concepts.ToscaConstraintLogical.Operation;
+
+/**
+ * DAO test for ToscaTrigger.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class ToscaTriggerTest {
+
+    @Test
+    public void testTriggerPojo() {
+        assertNotNull(new ToscaTrigger());
+        assertNotNull(new ToscaTrigger(new PfReferenceKey()));
+        assertNotNull(new ToscaTrigger(new PfReferenceKey(), "EventType", "Action"));
+        assertNotNull(new ToscaTrigger(new ToscaTrigger()));
+
+        try {
+            new ToscaTrigger((PfReferenceKey) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTrigger(null, null, null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTrigger(null, "EventType", null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTrigger(null, "EventType", "Action");
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTrigger(null, null, "Action");
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("key is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTrigger(new PfReferenceKey(), null, null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("eventType is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTrigger(new PfReferenceKey(), "EventType", null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("action is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTrigger(new PfReferenceKey(), null, "Action");
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("eventType is marked @NonNull but is null", exc.getMessage());
+        }
+
+        try {
+            new ToscaTrigger((ToscaTrigger) null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage());
+        }
+
+        PfConceptKey tparentKey = new PfConceptKey("tParentKey", "0.0.1");
+        PfReferenceKey tkey = new PfReferenceKey(tparentKey, "trigger0");
+        ToscaTrigger tdt = new ToscaTrigger(tkey, "EventType", "Action");
+
+        ToscaTimeInterval schedule = new ToscaTimeInterval(new PfReferenceKey(tkey, "sched"), new Date(), new Date());
+        tdt.setSchedule(schedule);
+
+        ToscaEventFilter targetFilter =
+                new ToscaEventFilter(new PfReferenceKey(tkey, "filter"), new PfConceptKey("NodeName", "0.0.1"));
+        tdt.setTargetFilter(targetFilter);
+
+        ToscaConstraintLogicalString lsc =
+                new ToscaConstraintLogicalString(new PfReferenceKey(tkey, "sc"), Operation.EQ, "hello");
+        tdt.setCondition(lsc);
+        assertEquals(lsc, tdt.getCondition());
+        tdt.setConstraint(lsc);
+        assertEquals(lsc, tdt.getConstraint());
+
+        tdt.setPeriod(Duration.ZERO);
+        assertEquals(Duration.ZERO, tdt.getPeriod());
+
+        tdt.setDescription("A Description");
+        assertEquals("A Description", tdt.getDescription());
+
+        tdt.setMethod("A Method");
+        assertEquals("A Method", tdt.getMethod());
+
+        ToscaTrigger tdtClone0 = new ToscaTrigger(tdt);
+        assertEquals(tdt, tdtClone0);
+        assertEquals(0, tdt.compareTo(tdtClone0));
+
+        ToscaTrigger tdtClone1 = new ToscaTrigger();
+        tdt.copyTo(tdtClone1);
+        assertEquals(tdt, tdtClone1);
+        assertEquals(0, tdt.compareTo(tdtClone1));
+
+        assertEquals(-1, tdt.compareTo(null));
+        assertEquals(0, tdt.compareTo(tdt));
+        assertFalse(tdt.compareTo(tdt.getKey()) == 0);
+
+        PfReferenceKey otherDtKey = new PfReferenceKey("otherDt", "0.0.1", "OtherTrigger");
+        ToscaTrigger otherDt = new ToscaTrigger(otherDtKey);
+
+        assertFalse(tdt.compareTo(otherDt) == 0);
+        otherDt.setKey(tkey);
+        assertFalse(tdt.compareTo(otherDt) == 0);
+        otherDt.setDescription("A Description");
+        assertFalse(tdt.compareTo(otherDt) == 0);
+        otherDt.setEventType("EventType");
+        assertFalse(tdt.compareTo(otherDt) == 0);
+        otherDt.setSchedule(schedule);
+        assertFalse(tdt.compareTo(otherDt) == 0);
+        otherDt.setTargetFilter(targetFilter);
+        assertFalse(tdt.compareTo(otherDt) == 0);
+        otherDt.setCondition(lsc);
+        assertFalse(tdt.compareTo(otherDt) == 0);
+        otherDt.setConstraint(lsc);
+        assertFalse(tdt.compareTo(otherDt) == 0);
+        otherDt.setPeriod(Duration.ZERO);
+        assertFalse(tdt.compareTo(otherDt) == 0);
+        otherDt.setMethod("A Method");
+        assertFalse(tdt.compareTo(otherDt) == 0);
+        otherDt.setAction("Action");
+        assertEquals(0, tdt.compareTo(otherDt));
+
+        otherDt.setEvaluations(100);
+        assertFalse(tdt.compareTo(otherDt) == 0);
+        otherDt.setEvaluations(0);
+        assertEquals(0, tdt.compareTo(otherDt));
+
+        try {
+            tdt.copyTo(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("target is marked @NonNull but is null", exc.getMessage());
+        }
+
+        assertEquals(6, tdt.getKeys().size());
+        assertEquals(1, new ToscaTrigger().getKeys().size());
+
+        new ToscaTrigger().clean();
+        tdt.clean();
+        assertEquals(tdtClone0, tdt);
+
+        assertFalse(new ToscaTrigger().validate(new PfValidationResult()).isValid());
+        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+
+        tdt.setDescription(null);
+        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+        tdt.setDescription("");
+        assertFalse(tdt.validate(new PfValidationResult()).isValid());
+        tdt.setDescription("A Description");
+        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+
+        tdt.setEvaluations(-1);
+        assertFalse(tdt.validate(new PfValidationResult()).isValid());
+        tdt.setEvaluations(100);
+        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+
+        tdt.setMethod(null);
+        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+        tdt.setMethod("");
+        assertFalse(tdt.validate(new PfValidationResult()).isValid());
+        tdt.setMethod("A Method");
+        assertTrue(tdt.validate(new PfValidationResult()).isValid());
+
+        try {
+            tdt.validate(null);
+            fail("test should throw an exception");
+        } catch (Exception exc) {
+            assertEquals("resultIn is marked @NonNull but is null", exc.getMessage());
+        }
+    }
+}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/testconcepts/DummyToscaConstraint.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/testconcepts/DummyToscaConstraint.java
new file mode 100644
index 0000000..3b27e15
--- /dev/null
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/concepts/testconcepts/DummyToscaConstraint.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.tosca.concepts.testconcepts;
+
+import javax.ws.rs.core.Response;
+
+import org.onap.policy.models.base.PfModelRuntimeException;
+import org.onap.policy.models.base.PfReferenceKey;
+import org.onap.policy.models.tosca.concepts.ToscaConstraint;
+
+/**
+ * Dummy constraint to test abstract ToscaConstraint class.
+ *
+ * @author Liam Fallon (liam.fallon@est.tech)
+ */
+public class DummyToscaConstraint extends ToscaConstraint {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * The Default Constructor creates a {@link DummyToscaConstraint} object with a null key.
+     */
+    public DummyToscaConstraint() {
+        super(new PfReferenceKey());
+    }
+
+    /**
+     * The Key Constructor creates a {@link DummyToscaConstraint} object with the given concept key.
+     *
+     * @param key the key of the constraint
+     */
+    public DummyToscaConstraint(final PfReferenceKey key) {
+        super(key);
+    }
+
+    /**
+     * Copy constructor.
+     *
+     * @param copyConcept the concept to copy from
+     */
+    public DummyToscaConstraint(final DummyToscaConstraint copyConcept) {
+        super(copyConcept);
+        throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "cannot copy an immutable constraint");
+    }
+}
diff --git a/pom.xml b/pom.xml
index 6277849..ee5092e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,6 +40,7 @@
 
     <properties>
         <derby.version>10.13.1.1</derby.version>
+        <javax.ws.rs-api.version>2.0.1</javax.ws.rs-api.version>
         <policy.common.version>1.4.0-SNAPSHOT</policy.common.version>
 
         <!-- sonar/jacoco overrides -->
@@ -54,6 +55,7 @@
         <module>models-dao</module>
         <module>models-tosca</module>
         <module>models-pap</module>
+        <module>models-provider</module>
     </modules>
 
     <distributionManagement>
@@ -86,6 +88,12 @@
         </dependency>
 
         <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
+            <version>${javax.ws.rs-api.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>
@@ -95,7 +103,6 @@
             <groupId>org.eclipse.persistence</groupId>
             <artifactId>eclipselink</artifactId>
         </dependency>
-
     </dependencies>
 
     <dependencyManagement>
