From 0b3c65c18977212bc74b1f01cefe5ebecc2586f3 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Wed, 5 Feb 2020 12:13:57 +0000 Subject: Onboard TOSCA data_types defined in package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Onboard TOSCA data_types defined in a CSAR package that does not exists in the SDC default data_types library. Those data_types were being lost. All data_types declared in the package will be included in the "GlobalSubstitutionServiceTemplate". This includes the data_types declared in the main topology template and in its imported definition files. Defines a maven profile to compile the catalog-be in the main SDC pom. Change-Id: I39445b0f42e924dc1015945b7e605e804c1d505b Issue-ID: SDC-2763 Signed-off-by: André Schmid Signed-off-by: Vasyl Razinkov --- .../org/openecomp/sdc/tosca/services/DataModelUtil.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/main/java/org') 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. * -- cgit 1.2.3-korg