From 924ba9adf027dd4969896cd905a8a41ba4c30655 Mon Sep 17 00:00:00 2001 From: talio Date: Mon, 29 Jan 2018 11:23:39 +0200 Subject: Add Tosca model healer create a Tosca model healer for future changes in Tosca structure Change-Id: I3843e4727b6bbb383576ae6a4fb055c5b6fa001f Issue-ID: SDC-973 Signed-off-by: talio --- .../sdc/tosca/datatypes/ToscaServiceModel.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/main/java') diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java index 4512fce159..b1a0976b36 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java @@ -29,13 +29,13 @@ import org.openecomp.sdc.tosca.services.DataModelUtil; import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.Optional; /** * Tosca service model. */ public class ToscaServiceModel implements AsdcModel { private FileContentHandler artifactFiles; - private FileContentHandler externalFiles; private Map serviceTemplates; private String entryDefinitionServiceTemplate; @@ -57,16 +57,6 @@ public class ToscaServiceModel implements AsdcModel { this.entryDefinitionServiceTemplate = entryDefinitionServiceTemplate; } - public ToscaServiceModel(FileContentHandler artifactFiles, - FileContentHandler externalFiles, - Map serviceTemplates, - String entryDefinitionServiceTemplate) { - this.artifactFiles = artifactFiles; - this.externalFiles = externalFiles; - this.serviceTemplates = serviceTemplates; - this.entryDefinitionServiceTemplate = entryDefinitionServiceTemplate; - } - /** * Gets artifact files. * @@ -89,6 +79,11 @@ public class ToscaServiceModel implements AsdcModel { return Collections.unmodifiableMap(serviceTemplates); } + public Optional getServiceTemplate(String serviceTemplateName) { + return MapUtils.isEmpty(this.serviceTemplates) ? Optional.empty() + : Optional.of(this.serviceTemplates.get(serviceTemplateName)); + } + public void addServiceTemplate(String serviceTemplateName, ServiceTemplate serviceTemplate) { if(MapUtils.isEmpty(serviceTemplates)){ -- cgit 1.2.3-korg