summaryrefslogtreecommitdiffstats
path: root/common-be/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'common-be/src/main/java')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java6
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java26
2 files changed, 28 insertions, 4 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java
index 969d986c4d..c885dbcc46 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java
@@ -84,14 +84,16 @@ public class PropertyDataDefinition extends ToscaDataDefinition {
super(pr);
}
- public PropertyDataDefinition(PropertyDataDefinition propertyDataDefinition) {
+ public PropertyDataDefinition(final PropertyDataDefinition propertyDataDefinition) {
super();
this.setUniqueId(propertyDataDefinition.getUniqueId());
this.setRequired(propertyDataDefinition.isRequired());
this.setDefaultValue(propertyDataDefinition.getDefaultValue());
this.setDefinition(propertyDataDefinition.getDefinition());
this.setDescription(propertyDataDefinition.getDescription());
- this.setSchema(propertyDataDefinition.getSchema());
+ if (propertyDataDefinition.getSchema() != null) {
+ this.setSchema(new SchemaDefinition(propertyDataDefinition.getSchema()));
+ }
this.setPassword(propertyDataDefinition.isPassword());
this.setType(propertyDataDefinition.getType());
this.setName(propertyDataDefinition.getName());
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java
index 1e4fc58ffe..17e21f0cc7 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java
@@ -20,10 +20,14 @@
package org.openecomp.sdc.be.datatypes.elements;
-import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
/**
* Schema allows to create new types that can be used along TOSCA definitions.
@@ -45,7 +49,25 @@ public class SchemaDefinition extends ToscaDataDefinition {
this.setDerivedFrom(derivedFrom);
this.setConstraints(constraints);
this.setProperties(properties);
+ }
+ public SchemaDefinition(final SchemaDefinition schemaDefinition) {
+ if (schemaDefinition == null) {
+ return;
+ }
+ this.derivedFrom = schemaDefinition.getDerivedFrom();
+ if (CollectionUtils.isNotEmpty(schemaDefinition.getConstraints())) {
+ this.constraints = new ArrayList<>(schemaDefinition.getConstraints());
+ }
+ if (schemaDefinition.getProperty() != null) {
+ this.property = new PropertyDataDefinition(schemaDefinition.getProperty());
+ }
+ if (MapUtils.isNotEmpty(schemaDefinition.getProperties())) {
+ this.properties = new HashMap<>();
+ for (final Entry<String, PropertyDataDefinition> propertyEntry : schemaDefinition.getProperties().entrySet()) {
+ this.properties.put(propertyEntry.getKey(), new PropertyDataDefinition(propertyEntry.getValue()));
+ }
+ }
}
public String getDerivedFrom() {