2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.translator.datatypes.heattotosca;
23 import org.openecomp.config.api.Configuration;
24 import org.openecomp.config.api.ConfigurationManager;
25 import org.openecomp.core.utilities.CommonMethods;
26 import org.openecomp.core.utilities.file.FileContentHandler;
27 import org.openecomp.sdc.common.errors.CoreException;
28 import org.openecomp.sdc.common.errors.ErrorCode;
29 import org.openecomp.sdc.common.utils.SdcCommon;
30 import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration;
31 import org.openecomp.sdc.heat.datatypes.manifest.FileData;
32 import org.openecomp.sdc.heat.datatypes.manifest.ManifestFile;
33 import org.openecomp.sdc.heat.datatypes.model.Resource;
34 import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
35 import org.openecomp.sdc.tosca.datatypes.model.RequirementAssignment;
36 import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
37 import org.openecomp.sdc.tosca.services.ToscaUtil;
38 import org.openecomp.sdc.translator.datatypes.heattotosca.to.TranslatedHeatResource;
39 import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.composition.UnifiedCompositionEntity;
40 import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.composition.UnifiedSubstitutionData;
41 import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.ConsolidationData;
42 import org.openecomp.sdc.translator.services.heattotosca.ConfigConstants;
43 import org.openecomp.sdc.translator.services.heattotosca.Constants;
44 import org.openecomp.sdc.translator.services.heattotosca.NameExtractor;
45 import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypesGenerator;
47 import java.io.InputStream;
48 import java.util.HashMap;
49 import java.util.HashSet;
50 import java.util.List;
52 import java.util.Objects;
53 import java.util.Optional;
57 public class TranslationContext {
60 private static Map<String, Map<String, Map<String, String>>> translationMapping;
61 private static Map<String, ServiceTemplate> globalServiceTemplates;
62 private static Map<String, ImplementationConfiguration> nameExtractorImplMap;
63 private static Map<String, ImplementationConfiguration> supportedConsolidationComputeResources;
64 private static Map<String, ImplementationConfiguration> supportedConsolidationPortResources;
65 private static List enrichPortResourceProperties;
68 Configuration config = ConfigurationManager.lookup();
69 String propertyFileName = SdcCommon.HEAT_TO_TOSCA_MAPPING_CONF;
71 config.generateMap(ConfigConstants.MAPPING_NAMESPACE, ConfigConstants.RESOURCE_MAPPING_KEY);
73 globalServiceTemplates = GlobalTypesGenerator.getGlobalTypesServiceTemplate();
74 } catch (Exception exc) {
75 throw new RuntimeException("Failed to load GlobalTypes", exc);
77 nameExtractorImplMap = config.populateMap(ConfigConstants.TRANSLATOR_NAMESPACE,
78 ConfigConstants.NAMING_CONVENTION_EXTRACTOR_IMPL_KEY, ImplementationConfiguration.class);
79 supportedConsolidationComputeResources = config.populateMap(ConfigConstants
80 .MANDATORY_UNIFIED_MODEL_NAMESPACE, ConfigConstants
81 .SUPPORTED_CONSOLIDATION_COMPUTE_RESOURCES_KEY, ImplementationConfiguration.class);
82 supportedConsolidationPortResources = config.populateMap(ConfigConstants
83 .MANDATORY_UNIFIED_MODEL_NAMESPACE, ConfigConstants
84 .SUPPORTED_CONSOLIDATION_PORT_RESOURCES_KEY, ImplementationConfiguration.class);
85 enrichPortResourceProperties = config.getAsStringValues(ConfigConstants
86 .MANDATORY_UNIFIED_MODEL_NAMESPACE, ConfigConstants
87 .ENRICH_PORT_RESOURCE_PROP);
91 private ManifestFile manifest;
93 public static List getEnrichPortResourceProperties() {
94 return enrichPortResourceProperties;
97 private FileContentHandler files = new FileContentHandler();
98 private Map<String, FileData.Type> manifestFiles = new HashMap<>();
99 //Key - file name, value - file type
100 private Set<String> nestedHeatsFiles = new HashSet<>();
101 private FileContentHandler externalArtifacts = new FileContentHandler();
102 // Key - heat file name,value - set of heat resource ids which were translated
103 private Map<String, Set<String>> translatedResources = new HashMap<>();
104 // Key - heat file name, value - translated Node template id
105 private Map<String, Set<String>> heatStackGroupMembers = new HashMap<>();
106 // Key - heat file name, value - Map with Key - heat resource Id, Value - tosca entity template id
107 private Map<String, Map<String, String>> translatedIds = new HashMap<>();
108 // key - service template type, value - translated service templates
109 private Map<String, ServiceTemplate> translatedServiceTemplates = new HashMap<>();
110 //key - heat param name, value - shared resource data
111 private Map<String, TranslatedHeatResource> heatSharedResourcesByParam = new HashMap<>();
112 //key - translated substitute service template file name, value - source nested heat file name
113 private Map<String, String> nestedHeatFileName = new HashMap<>();
114 //Key - heat file name,value - Map eith key - heat pseudo param name,
115 // value - translated tosca parameter name
116 private Map<String, Map<String, String>> usedHeatPseudoParams = new HashMap<>();
117 //Consolidation data gathered for Unified TOSCA model
118 private ConsolidationData consolidationData = new ConsolidationData();
119 private Map<String, UnifiedSubstitutionData> unifiedSubstitutionData = new HashMap<>();
120 private Set<String> unifiedHandledServiceTemplates = new HashSet<>();
122 private Map<String, Map<RequirementAssignment, String>>
123 mapDependencySubMappingToRequirementAssignment = new HashMap<>();
125 public static Map<String, ImplementationConfiguration>
126 getSupportedConsolidationComputeResources() {
127 return supportedConsolidationComputeResources;
130 public static void setSupportedConsolidationComputeResources(
131 Map<String, ImplementationConfiguration> supportedConsolidationComputeResources) {
132 TranslationContext.supportedConsolidationComputeResources =
133 supportedConsolidationComputeResources;
136 public static Map<String, ImplementationConfiguration> getSupportedConsolidationPortResources() {
137 return supportedConsolidationPortResources;
140 public static void setSupportedConsolidationPortResources(
141 Map<String, ImplementationConfiguration> supportedConsolidationPortResources) {
142 TranslationContext.supportedConsolidationPortResources = supportedConsolidationPortResources;
146 * Get nameExtractor implemetation class instance.
148 * @param extractorImplKey configuration key for the implementation class
149 * @return implemetation class instance
151 public static NameExtractor getNameExtractorImpl(String extractorImplKey) {
152 String nameExtractorImplClassName =
153 nameExtractorImplMap.get(extractorImplKey).getImplementationClass();
155 return CommonMethods.newInstance(nameExtractorImplClassName, NameExtractor.class);
158 public Map<String, UnifiedSubstitutionData> getUnifiedSubstitutionData() {
159 return unifiedSubstitutionData;
162 public void setUnifiedSubstitutionData(
163 Map<String, UnifiedSubstitutionData> unifiedSubstitutionData) {
164 this.unifiedSubstitutionData = unifiedSubstitutionData;
167 public void addCleanedNodeTemplate(String serviceTemplateName,
168 String nodeTemplateId,
169 UnifiedCompositionEntity unifiedCompositionEntity,
170 NodeTemplate nodeTemplate) {
171 this.unifiedSubstitutionData.putIfAbsent(serviceTemplateName, new UnifiedSubstitutionData());
172 this.unifiedSubstitutionData
173 .get(serviceTemplateName)
174 .addCleanedNodeTemplate(nodeTemplateId, unifiedCompositionEntity, nodeTemplate);
177 public NodeTemplate getCleanedNodeTemplate(String serviceTemplateName,
178 String nodeTemplateId) {
179 return this.unifiedSubstitutionData.get(serviceTemplateName)
180 .getCleanedNodeTemplate(nodeTemplateId);
183 public void addUnifiedNestedNodeTemplateId(String serviceTemplateName,
184 String nestedNodeTemplateId,
185 String unifiedNestedNodeTemplateId) {
186 this.unifiedSubstitutionData.putIfAbsent(serviceTemplateName, new UnifiedSubstitutionData());
187 this.unifiedSubstitutionData.get(serviceTemplateName)
188 .addUnifiedNestedNodeTemplateId(nestedNodeTemplateId, unifiedNestedNodeTemplateId);
191 public Optional<String> getUnifiedNestedNodeTemplateId(String serviceTemplateName,
192 String nestedNodeTemplateId) {
193 return this.unifiedSubstitutionData.get(serviceTemplateName) == null ? Optional.empty()
194 : this.unifiedSubstitutionData.get(serviceTemplateName)
195 .getUnifiedNestedNodeTemplateId(nestedNodeTemplateId);
198 public void addUnifiedNestedNodeTypeId(String serviceTemplateName,
199 String nestedNodeTypeId,
200 String unifiedNestedNodeTypeId) {
201 this.unifiedSubstitutionData.putIfAbsent(serviceTemplateName, new UnifiedSubstitutionData());
202 this.unifiedSubstitutionData.get(serviceTemplateName)
203 .addUnifiedNestedNodeTypeId(nestedNodeTypeId, unifiedNestedNodeTypeId);
206 public Optional<String> getUnifiedNestedNodeTypeId(String serviceTemplateName,
207 String nestedNodeTemplateId) {
208 return this.unifiedSubstitutionData.get(serviceTemplateName) == null ? Optional.empty()
209 : this.unifiedSubstitutionData.get(serviceTemplateName)
210 .getUnifiedNestedNodeTypeId(nestedNodeTemplateId);
213 public ConsolidationData getConsolidationData() {
214 return consolidationData;
217 public void setConsolidationData(ConsolidationData consolidationData) {
218 this.consolidationData = consolidationData;
221 public void addManifestFile(String fileName, FileData.Type fileType) {
222 this.manifestFiles.put(fileName, fileType);
225 public Set<String> getNestedHeatsFiles() {
226 return nestedHeatsFiles;
229 public Map<String, Set<String>> getHeatStackGroupMembers() {
230 return heatStackGroupMembers;
233 public FileContentHandler getFiles() {
237 public void setFiles(Map<String, byte[]> files) {
238 this.files.putAll(files);
241 public InputStream getFileContent(String fileName) {
242 return files.getFileContent(fileName);
245 public void addFile(String name, byte[] content) {
246 files.addFile(name, content);
249 public ManifestFile getManifest() {
253 public void setManifest(ManifestFile manifest) {
254 this.manifest = manifest;
257 public Map<String, Set<String>> getTranslatedResources() {
258 return translatedResources;
261 public Map<String, Map<String, String>> getTranslatedIds() {
262 return translatedIds;
265 public Set<String> getAllTranslatedResourceIdsFromDiffNestedFiles(String
266 nestedHeatFileNameToSkip){
267 Set<String> allTranslatedResourceIds = new HashSet<>();
269 this.translatedIds.entrySet().stream().filter(
270 heatFileNameToTranslatedIdsEntry -> !heatFileNameToTranslatedIdsEntry.getKey()
271 .equals(nestedHeatFileNameToSkip)).forEach(heatFileNameToTranslatedIdsEntry -> {
272 allTranslatedResourceIds.addAll(heatFileNameToTranslatedIdsEntry.getValue().keySet());
275 return allTranslatedResourceIds;
278 // get tosca name from mapping configuration file
279 //element type - parameter/attribute
280 // element name - heat parameter/attribute name
281 //return value - tosca parameter/attribute name
282 public String getElementMapping(String resourceType, String elementType, String elementName) {
283 if (Objects.isNull(translationMapping.get(resourceType))) {
286 if (Objects.isNull(translationMapping.get(resourceType).get(elementType))) {
289 return translationMapping.get(resourceType).get(elementType).get(elementName);
292 public Map<String, String> getElementMapping(String resourceType, String elementType) {
293 if (Objects.isNull(translationMapping.get(resourceType))) {
296 return translationMapping.get(resourceType).get(elementType);
299 public Set<String> getElementSet(String resourceType, String elementType) {
300 if (Objects.isNull(translationMapping.get(resourceType))) {
301 return new HashSet<>();
303 if (Objects.isNull(translationMapping.get(resourceType).get(elementType))) {
304 return new HashSet<>();
306 return translationMapping.get(resourceType).get(elementType).keySet();
309 public Map<String, ServiceTemplate> getTranslatedServiceTemplates() {
310 return translatedServiceTemplates;
313 public ServiceTemplate getGlobalSubstitutionServiceTemplate() {
314 return getTranslatedServiceTemplates().get(Constants.GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME);
317 public FileContentHandler getExternalArtifacts() {
318 return externalArtifacts;
321 public void addExternalArtifacts(String name, byte[] content) {
322 this.externalArtifacts.addFile(name, content);
325 public Map<String, TranslatedHeatResource> getHeatSharedResourcesByParam() {
326 return heatSharedResourcesByParam;
329 public void addHeatSharedResourcesByParam(String parameterName, String resourceId,
331 this.addHeatSharedResourcesByParam(parameterName,
332 new TranslatedHeatResource(resourceId, resource));
335 private void addHeatSharedResourcesByParam(String parameterName,
336 TranslatedHeatResource translatedHeatResource) {
337 this.heatSharedResourcesByParam.put(parameterName, translatedHeatResource);
340 public Map<String, ServiceTemplate> getGlobalServiceTemplates() {
341 return globalServiceTemplates;
344 public Map<String, String> getNestedHeatFileName() {
345 return nestedHeatFileName;
348 public void addNestedHeatFileName(String substituteServiceTempalteName,
349 String nestedHeatFileName) {
350 this.nestedHeatFileName.put(substituteServiceTempalteName, nestedHeatFileName);
353 public Map<String, Map<String, String>> getUsedHeatPseudoParams() {
354 return usedHeatPseudoParams;
357 public void addUsedHeatPseudoParams(String heatFileName, String heatPseudoParam, String
358 translatedToscaParam) {
359 if (Objects.isNull(this.usedHeatPseudoParams.get(heatFileName))) {
360 this.usedHeatPseudoParams.put(heatFileName, new HashMap<>());
362 this.usedHeatPseudoParams.get(heatFileName).put(heatPseudoParam, translatedToscaParam);
366 * Add the unified substitution data info in context. Contains a mapping of original node
367 * template id and the new node template id in the abstract substitute
369 * @param serviceTemplateFileName the service template file name
370 * @param originalNodeTemplateId the original node template id
371 * @param abstractNodeTemplateId the node template id in the abstract substitute
373 public void addUnifiedSubstitutionData(String serviceTemplateFileName,
374 String originalNodeTemplateId,
375 String abstractNodeTemplateId) {
377 Map<String, String> nodeAbstractNodeTemplateIdMap = this.getUnifiedSubstitutionData()
378 .computeIfAbsent(serviceTemplateFileName, k -> new UnifiedSubstitutionData())
379 .getNodesRelatedAbstractNode();
381 if (nodeAbstractNodeTemplateIdMap == null) {
382 nodeAbstractNodeTemplateIdMap = new HashMap<>();
385 if(nodeAbstractNodeTemplateIdMap.containsKey(originalNodeTemplateId)){
386 throw new CoreException((new ErrorCode.ErrorCodeBuilder())
387 .withMessage("Resource with id "
388 + originalNodeTemplateId + " occures more than once in different addOn files")
391 nodeAbstractNodeTemplateIdMap.put(originalNodeTemplateId, abstractNodeTemplateId);
392 this.getUnifiedSubstitutionData().get(serviceTemplateFileName).setNodesRelatedAbstractNode(
393 nodeAbstractNodeTemplateIdMap);
397 * Add the unified substitution data info in context. Contains a mapping of original node
398 * template id and the new node template id in the abstract substitute
400 * @param serviceTemplateFileName the service template file name
401 * @param originalNodeTemplateId the original node template id
402 * @param substitutionServiceTemplateNodeTemplateId the node template id in the substitution
405 public void addSubstitutionServiceTemplateUnifiedSubstitutionData(
406 String serviceTemplateFileName,
407 String originalNodeTemplateId,
408 String substitutionServiceTemplateNodeTemplateId) {
410 Map<String, String> nodesRelatedSubstitutionServiceTemplateNodeTemplateIdMap = this
411 .getUnifiedSubstitutionData()
412 .computeIfAbsent(serviceTemplateFileName, k -> new UnifiedSubstitutionData())
413 .getNodesRelatedSubstitutionServiceTemplateNode();
415 if (nodesRelatedSubstitutionServiceTemplateNodeTemplateIdMap == null) {
416 nodesRelatedSubstitutionServiceTemplateNodeTemplateIdMap = new HashMap<>();
418 nodesRelatedSubstitutionServiceTemplateNodeTemplateIdMap.put(originalNodeTemplateId,
419 substitutionServiceTemplateNodeTemplateId);
420 this.getUnifiedSubstitutionData().get(serviceTemplateFileName)
421 .setNodesRelatedSubstitutionServiceTemplateNode(
422 nodesRelatedSubstitutionServiceTemplateNodeTemplateIdMap);
426 * Get unified abstract node template which is mapped to the input node template id.
428 * @param serviceTemplate the service template
429 * @param nodeTemplateId the node template id
431 public String getUnifiedAbstractNodeTemplateId(ServiceTemplate serviceTemplate,
432 String nodeTemplateId) {
433 UnifiedSubstitutionData unifiedSubstitutionData =
434 this.unifiedSubstitutionData.get(ToscaUtil.getServiceTemplateFileName(serviceTemplate));
435 return unifiedSubstitutionData.getNodesRelatedAbstractNode().get(nodeTemplateId);
439 * Get unified node template in the substitution service template which is mapped to the
440 * original input node template id.
442 * @param serviceTemplate the service template
443 * @param nodeTemplateId the node template id
445 public String getUnifiedSubstitutionNodeTemplateId(ServiceTemplate serviceTemplate,
446 String nodeTemplateId) {
447 UnifiedSubstitutionData unifiedSubstitutionData =
448 this.unifiedSubstitutionData.get(ToscaUtil.getServiceTemplateFileName(serviceTemplate));
449 return unifiedSubstitutionData.getNodesRelatedSubstitutionServiceTemplateNode()
450 .get(nodeTemplateId);
453 public int getHandledNestedComputeNodeTemplateIndex(String serviceTemplateName,
454 String computeType) {
455 return this.unifiedSubstitutionData.get(serviceTemplateName)
456 .getHandledNestedComputeNodeTemplateIndex(computeType);
459 public void updateHandledComputeType(String serviceTemplateName,
460 String handledComputeType,
461 String nestedServiceTemplateFileName) {
462 String globalSTName =
463 ToscaUtil.getServiceTemplateFileName(Constants.GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME);
464 this.unifiedSubstitutionData.putIfAbsent(
465 globalSTName, new UnifiedSubstitutionData());
466 this.unifiedSubstitutionData.get(globalSTName)
467 .addHandledComputeType(handledComputeType);
468 this.unifiedSubstitutionData.get(globalSTName).addHandlesNestedServiceTemplate(nestedServiceTemplateFileName);
470 this.unifiedSubstitutionData.putIfAbsent(serviceTemplateName, new UnifiedSubstitutionData());
471 this.unifiedSubstitutionData.get(serviceTemplateName).addHandlesNestedServiceTemplate(nestedServiceTemplateFileName);
474 public void addHandledComputeTypeInServiceTemplate(String serviceTemplateName,
475 String handledComputeType){
476 this.unifiedSubstitutionData.putIfAbsent(serviceTemplateName, new UnifiedSubstitutionData());
477 this.unifiedSubstitutionData.get(serviceTemplateName).addHandledComputeType(handledComputeType);
480 public boolean isComputeTypeHandledInServiceTemplate(String serviceTemplateName,
481 String computeType) {
482 return !Objects.isNull(this.unifiedSubstitutionData.get(serviceTemplateName))
483 && this.unifiedSubstitutionData.get(serviceTemplateName)
484 .isComputeTypeHandledInServiceTemplate(computeType);
487 public int getHandledNestedComputeNodeTemplateIndex(String serviceTemplateName,
488 String nestedServiceTemplateName,
490 return this.unifiedSubstitutionData.get(serviceTemplateName)
491 .getHandledNestedComputeNodeTemplateIndex(computeType);
494 public boolean isNestedServiceTemplateWasHandled(String serviceTemplateName,
495 String nestedServiceTemplateFileName) {
496 if (Objects.isNull(this.unifiedSubstitutionData.get(serviceTemplateName))) {
499 return this.unifiedSubstitutionData.get(serviceTemplateName)
500 .isNestedServiceTemplateWasHandled(nestedServiceTemplateFileName);
503 public Set<String> getAllRelatedNestedNodeTypeIds(){
504 String globalName = "GlobalSubstitutionTypes";
505 if(Objects.isNull(this.unifiedSubstitutionData) ||
506 Objects.isNull(this.unifiedSubstitutionData.get(globalName))){
507 return new HashSet<>();
510 return this.unifiedSubstitutionData.get(globalName).getAllRelatedNestedNodeTypeIds();
513 public boolean isUnifiedHandledServiceTemplate(ServiceTemplate serviceTemplate) {
514 String serviceTemplateFileName = ToscaUtil.getServiceTemplateFileName(serviceTemplate);
515 if (unifiedHandledServiceTemplates.contains(serviceTemplateFileName)) {
523 public void addUnifiedHandledServiceTeamplte(ServiceTemplate serviceTemplate) {
524 String serviceTemplateFileName = ToscaUtil.getServiceTemplateFileName(serviceTemplate);
525 this.unifiedHandledServiceTemplates.add(serviceTemplateFileName);
528 public boolean isNestedNodeWasHandled(String serviceTemplateName,
529 String nestedNodeTemplateId) {
530 if (Objects.isNull(this.unifiedSubstitutionData.get(serviceTemplateName))) {
533 return this.unifiedSubstitutionData.get(serviceTemplateName)
534 .isNestedNodeWasHandled(nestedNodeTemplateId);
537 public void addNestedNodeAsHandled(String serviceTemplateName,
538 String nestedNodeTemplateId) {
539 this.unifiedSubstitutionData.putIfAbsent(serviceTemplateName, new UnifiedSubstitutionData());
540 this.unifiedSubstitutionData.get(serviceTemplateName)
541 .addHandledNestedNodes(nestedNodeTemplateId);
544 public void updateUsedTimesForNestedComputeNodeType(String serviceTemplateName,
545 String computeType) {
546 this.unifiedSubstitutionData.putIfAbsent(serviceTemplateName, new UnifiedSubstitutionData());
548 this.unifiedSubstitutionData.get(serviceTemplateName)
549 .updateUsedTimesForNestedComputeNodeType(computeType);
552 public int getGlobalNodeTypeIndex(String serviceTemplateName,
553 String computeType) {
554 if (Objects.isNull(this.unifiedSubstitutionData.get(serviceTemplateName))) {
557 return this.unifiedSubstitutionData.get(serviceTemplateName).getGlobalNodeTypeIndex
561 public void addNewPropertyIdToNodeTemplate(String serviceTemplateName,
562 String newPropertyId,
563 Object origPropertyValue){
564 this.unifiedSubstitutionData.putIfAbsent(serviceTemplateName, new UnifiedSubstitutionData());
565 this.unifiedSubstitutionData.get(serviceTemplateName).addNewPropertyIdToNodeTemplate(
566 newPropertyId, origPropertyValue);
569 public Optional<Object> getNewPropertyInputParamId(String serviceTemplateName,
570 String newPropertyId){
571 if(Objects.isNull(this.unifiedSubstitutionData.get(serviceTemplateName))){
572 return Optional.empty();
575 return this.unifiedSubstitutionData.get(serviceTemplateName).getNewPropertyInputParam
579 public Map<String, Object> getAllNewPropertyInputParamIdsPerNodeTenplateId(String serviceTemplateName){
580 if(Objects.isNull(this.unifiedSubstitutionData.get(serviceTemplateName))){
581 return new HashMap<>();
584 return this.unifiedSubstitutionData.get(serviceTemplateName).getAllNewPropertyInputParamIds();
588 public void addSubMappingReqAssignment(String serviceTemplateName,
589 RequirementAssignment requirementAssignment,
591 this.mapDependencySubMappingToRequirementAssignment
592 .putIfAbsent(serviceTemplateName, new HashMap<>());
593 this.mapDependencySubMappingToRequirementAssignment.get(serviceTemplateName)
594 .putIfAbsent(requirementAssignment, newReqId);
597 public Optional<String> getNewReqAssignmentDependencyId(String serviceTemplateName,
598 RequirementAssignment requirementAssignment){
599 if(!this.mapDependencySubMappingToRequirementAssignment.containsKey(serviceTemplateName)){
600 return Optional.empty();
603 Map<RequirementAssignment, String> requirementAssignmentMap =
604 this.mapDependencySubMappingToRequirementAssignment.get(serviceTemplateName);
605 return requirementAssignmentMap.containsKey
606 (requirementAssignment) ? Optional.of(requirementAssignmentMap.get(requirementAssignment)) :