diff options
Diffstat (limited to 'models-tosca/src/main')
2 files changed, 21 insertions, 1 deletions
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java index e89b31635..f5a178a37 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java @@ -54,7 +54,7 @@ public class ToscaEntity implements PfNameVersion { private String description; /** - * Copy COnstructor. + * Copy Constructor. * * @param copyObject object to copy from */ diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyType.java index 75f17ea5b..3a3b1476d 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyType.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyType.java @@ -23,10 +23,14 @@ package org.onap.policy.models.tosca.authorative.concepts; +import java.util.LinkedHashMap; import java.util.Map; +import java.util.Map.Entry; + import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import lombok.NonNull; /** * Class to represent TOSCA policy type matching input/output from/to client. @@ -39,6 +43,22 @@ import lombok.NoArgsConstructor; public class ToscaPolicyType extends ToscaEntity implements Comparable<ToscaPolicyType> { private Map<String, ToscaProperty> properties; + /** + * Copy Constructor. + * + * @param copyObject object to copy from + */ + public ToscaPolicyType(@NonNull ToscaPolicyType copyObject) { + super(copyObject); + + if (copyObject.properties != null) { + properties = new LinkedHashMap<>(); + for (final Entry<String, ToscaProperty> propertyEntry : copyObject.properties.entrySet()) { + properties.put(propertyEntry.getKey(), propertyEntry.getValue()); + } + } + } + @Override public int compareTo(final ToscaPolicyType other) { return compareNameVersion(this, other); |