summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-lib/src
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib/src')
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
index af55aefc1a..70cae71f17 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
@@ -39,6 +39,7 @@ import org.onap.sdc.tosca.datatypes.model.AttributeDefinition;
import org.onap.sdc.tosca.datatypes.model.CapabilityAssignment;
import org.onap.sdc.tosca.datatypes.model.CapabilityDefinition;
import org.onap.sdc.tosca.datatypes.model.Constraint;
+import org.onap.sdc.tosca.datatypes.model.DataType;
import org.onap.sdc.tosca.datatypes.model.EntrySchema;
import org.onap.sdc.tosca.datatypes.model.GroupDefinition;
import org.onap.sdc.tosca.datatypes.model.Import;
@@ -317,6 +318,20 @@ public class DataModelUtil {
serviceTemplate.getNode_types().put(nodeTypeId, nodeType);
}
+ public static void addDataType(final ServiceTemplate serviceTemplate, final String key,
+ final DataType nodeTypeValue) {
+ if (serviceTemplate == null) {
+ throw new CoreException(new InvalidAddActionNullEntityErrorBuilder("Data Type", SERVICE_TEMPLATE).build());
+ }
+
+ if (serviceTemplate.getData_types() == null) {
+ serviceTemplate.setData_types(new HashMap<>());
+ }
+
+ serviceTemplate.getData_types().put(key, nodeTypeValue);
+ }
+
+
/**
* Add relationship template.
*