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<String, Map<String, Integer>>>
123 requirementIdAppearanceInNodeTemplate = new HashMap<>();
125 private Set<String> serviceTemplatesWithoutNodeTemplateSection = new HashSet<>();
127 public static Map<String, ImplementationConfiguration>
128 getSupportedConsolidationComputeResources() {
129 return supportedConsolidationComputeResources;
132 public static void setSupportedConsolidationComputeResources(
133 Map<String, ImplementationConfiguration> supportedConsolidationComputeResources) {
134 TranslationContext.supportedConsolidationComputeResources =
135 supportedConsolidationComputeResources;
138 public static Map<String, ImplementationConfiguration> getSupportedConsolidationPortResources() {
139 return supportedConsolidationPortResources;
142 public static void setSupportedConsolidationPortResources(
143 Map<String, ImplementationConfiguration> supportedConsolidationPortResources) {
144 TranslationContext.supportedConsolidationPortResources = supportedConsolidationPortResources;
148 * Get nameExtractor implemetation class instance.
150 * @param extractorImplKey configuration key for the implementation class
151 * @return implemetation class instance
153 public static NameExtractor getNameExtractorImpl(String extractorImplKey) {
154 String nameExtractorImplClassName =
155 nameExtractorImplMap.get(extractorImplKey).getImplementationClass();
157 return CommonMethods.newInstance(nameExtractorImplClassName, NameExtractor.class);
160 public Map<String, UnifiedSubstitutionData> getUnifiedSubstitutionData() {
161 return unifiedSubstitutionData;
164 public void setUnifiedSubstitutionData(
165 Map<String, UnifiedSubstitutionData> unifiedSubstitutionData) {
166 this.unifiedSubstitutionData = unifiedSubstitutionData;
169 public void addCleanedNodeTemplate(String serviceTemplateName,
170 String nodeTemplateId,
171 UnifiedCompositionEntity unifiedCompositionEntity,
172 NodeTemplate nodeTemplate) {
173 this.unifiedSubstitutionData.putIfAbsent(serviceTemplateName, new UnifiedSubstitutionData());
174 this.unifiedSubstitutionData
175 .get(serviceTemplateName)
176 .addCleanedNodeTemplate(nodeTemplateId, unifiedCompositionEntity, nodeTemplate);
179 public NodeTemplate getCleanedNodeTemplate(String serviceTemplateName,
180 String nodeTemplateId) {
181 return this.unifiedSubstitutionData.get(serviceTemplateName)
182 .getCleanedNodeTemplate(nodeTemplateId);
185 public void addUnifiedNestedNodeTemplateId(String serviceTemplateName,
186 String nestedNodeTemplateId,
187 String unifiedNestedNodeTemplateId) {
188 this.unifiedSubstitutionData.putIfAbsent(serviceTemplateName, new UnifiedSubstitutionData());
189 this.unifiedSubstitutionData.get(serviceTemplateName)
190 .addUnifiedNestedNodeTemplateId(nestedNodeTemplateId, unifiedNestedNodeTemplateId);
193 public Optional<String> getUnifiedNestedNodeTemplateId(String serviceTemplateName,
194 String nestedNodeTemplateId) {
195 return this.unifiedSubstitutionData.get(serviceTemplateName) == null ? Optional.empty()
196 : this.unifiedSubstitutionData.get(serviceTemplateName)
197 .getUnifiedNestedNodeTemplateId(nestedNodeTemplateId);
200 public void addUnifiedNestedNodeTypeId(String serviceTemplateName,
201 String nestedNodeTypeId,
202 String unifiedNestedNodeTypeId) {
203 this.unifiedSubstitutionData.putIfAbsent(serviceTemplateName, new UnifiedSubstitutionData());
204 this.unifiedSubstitutionData.get(serviceTemplateName)
205 .addUnifiedNestedNodeTypeId(nestedNodeTypeId, unifiedNestedNodeTypeId);
208 public Optional<String> getUnifiedNestedNodeTypeId(String serviceTemplateName,
209 String nestedNodeTemplateId) {
210 return this.unifiedSubstitutionData.get(serviceTemplateName) == null ? Optional.empty()
211 : this.unifiedSubstitutionData.get(serviceTemplateName)
212 .getUnifiedNestedNodeTypeId(nestedNodeTemplateId);
215 public ConsolidationData getConsolidationData() {
216 return consolidationData;
219 public void setConsolidationData(ConsolidationData consolidationData) {
220 this.consolidationData = consolidationData;
223 public void addManifestFile(String fileName, FileData.Type fileType) {
224 this.manifestFiles.put(fileName, fileType);
227 public Set<String> getNestedHeatsFiles() {
228 return nestedHeatsFiles;
231 public Map<String, Set<String>> getHeatStackGroupMembers() {
232 return heatStackGroupMembers;
235 public FileContentHandler getFiles() {
239 public void setFiles(Map<String, byte[]> files) {
240 this.files.putAll(files);
243 public InputStream getFileContent(String fileName) {
244 return files.getFileContent(fileName);
247 public void addFile(String name, byte[] content) {
248 files.addFile(name, content);
251 public ManifestFile getManifest() {
255 public void setManifest(ManifestFile manifest) {
256 this.manifest = manifest;
259 public Map<String, Set<String>> getTranslatedResources() {
260 return translatedResources;
263 public Map<String, Map<String, String>> getTranslatedIds() {
264 return translatedIds;
267 public Set<String> getAllTranslatedResourceIdsFromDiffNestedFiles(String
268 nestedHeatFileNameToSkip){
269 Set<String> allTranslatedResourceIds = new HashSet<>();
271 this.translatedIds.entrySet().stream().filter(
272 heatFileNameToTranslatedIdsEntry -> !heatFileNameToTranslatedIdsEntry.getKey()
273 .equals(nestedHeatFileNameToSkip)).forEach(heatFileNameToTranslatedIdsEntry -> {
274 allTranslatedResourceIds.addAll(heatFileNameToTranslatedIdsEntry.getValue().keySet());
277 return allTranslatedResourceIds;
280 // get tosca name from mapping configuration file
281 //element type - parameter/attribute
282 // element name - heat parameter/attribute name
283 //return value - tosca parameter/attribute name
284 public String getElementMapping(String resourceType, String elementType, String elementName) {
285 if (Objects.isNull(translationMapping.get(resourceType))) {
288 if (Objects.isNull(translationMapping.get(resourceType).get(elementType))) {
291 return translationMapping.get(resourceType).get(elementType).get(elementName);
294 public Map<String, String> getElementMapping(String resourceType, String elementType) {
295 if (Objects.isNull(translationMapping.get(resourceType))) {
298 return translationMapping.get(resourceType).get(elementType);
301 public Set<String> getElementSet(String resourceType, String elementType) {
302 if (Objects.isNull(translationMapping.get(resourceType))) {
303 return new HashSet<>();
305 if (Objects.isNull(translationMapping.get(resourceType).get(elementType))) {
306 return new HashSet<>();
308 return translationMapping.get(resourceType).get(elementType).keySet();
311 public Map<String, ServiceTemplate> getTranslatedServiceTemplates() {
312 return translatedServiceTemplates;
315 public ServiceTemplate getGlobalSubstitutionServiceTemplate() {
316 return getTranslatedServiceTemplates().get(Constants.GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME);
319 public FileContentHandler getExternalArtifacts() {
320 return externalArtifacts;
323 public void addExternalArtifacts(String name, byte[] content) {
324 this.externalArtifacts.addFile(name, content);
327 public Map<String, TranslatedHeatResource> getHeatSharedResourcesByParam() {
328 return heatSharedResourcesByParam;
331 public void addHeatSharedResourcesByParam(String parameterName, String resourceId,
333 this.addHeatSharedResourcesByParam(parameterName,
334 new TranslatedHeatResource(resourceId, resource));
337 private void addHeatSharedResourcesByParam(String parameterName,
338 TranslatedHeatResource translatedHeatResource) {
339 this.heatSharedResourcesByParam.put(parameterName, translatedHeatResource);
342 public Map<String, ServiceTemplate> getGlobalServiceTemplates() {
343 return globalServiceTemplates;
346 public Map<String, String> getNestedHeatFileName() {
347 return nestedHeatFileName;
350 public void addNestedHeatFileName(String substituteServiceTempalteName,
351 String nestedHeatFileName) {
352 this.nestedHeatFileName.put(substituteServiceTempalteName, nestedHeatFileName);
355 public Map<String, Map<String, String>> getUsedHeatPseudoParams() {
356 return usedHeatPseudoParams;
359 public void addUsedHeatPseudoParams(String heatFileName, String heatPseudoParam, String
360 translatedToscaParam) {
361 if (Objects.isNull(this.usedHeatPseudoParams.get(heatFileName))) {
362 this.usedHeatPseudoParams.put(heatFileName, new HashMap<>());
364 this.usedHeatPseudoParams.get(heatFileName).put(heatPseudoParam, translatedToscaParam);
368 * Add the unified substitution data info in context. Contains a mapping of original node
369 * template id and the new node template id in the abstract substitute
371 * @param serviceTemplateFileName the service template file name
372 * @param originalNodeTemplateId the original node template id
373 * @param abstractNodeTemplateId the node template id in the abstract substitute
375 public void addUnifiedSubstitutionData(String serviceTemplateFileName,
376 String originalNodeTemplateId,
377 String abstractNodeTemplateId) {
379 Map<String, String> nodeAbstractNodeTemplateIdMap = this.getUnifiedSubstitutionData()
380 .computeIfAbsent(serviceTemplateFileName, k -> new UnifiedSubstitutionData())
381 .getNodesRelatedAbstractNode();
383 if (nodeAbstractNodeTemplateIdMap == null) {
384 nodeAbstractNodeTemplateIdMap = new HashMap<>();
387 if(nodeAbstractNodeTemplateIdMap.containsKey(originalNodeTemplateId)){
388 throw new CoreException((new ErrorCode.ErrorCodeBuilder())
389 .withMessage("Resource with id "
390 + originalNodeTemplateId + " occures more than once in different addOn files")
393 nodeAbstractNodeTemplateIdMap.put(originalNodeTemplateId, abstractNodeTemplateId);
394 this.getUnifiedSubstitutionData().get(serviceTemplateFileName).setNodesRelatedAbstractNode(
395 nodeAbstractNodeTemplateIdMap);
399 * Add the unified substitution data info in context. Contains a mapping of original node
400 * template id and the new node template id in the abstract substitute
402 * @param serviceTemplateFileName the service template file name
403 * @param originalNodeTemplateId the original node template id
404 * @param substitutionServiceTemplateNodeTemplateId the node template id in the substitution
407 public void addSubstitutionServiceTemplateUnifiedSubstitutionData(
408 String serviceTemplateFileName,
409 String originalNodeTemplateId,
410 String substitutionServiceTemplateNodeTemplateId) {
412 Map<String, String> nodesRelatedSubstitutionServiceTemplateNodeTemplateIdMap = this
413 .getUnifiedSubstitutionData()
414 .computeIfAbsent(serviceTemplateFileName, k -> new UnifiedSubstitutionData())
415 .getNodesRelatedSubstitutionServiceTemplateNode();
417 if (nodesRelatedSubstitutionServiceTemplateNodeTemplateIdMap == null) {
418 nodesRelatedSubstitutionServiceTemplateNodeTemplateIdMap = new HashMap<>();
420 nodesRelatedSubstitutionServiceTemplateNodeTemplateIdMap.put(originalNodeTemplateId,
421 substitutionServiceTemplateNodeTemplateId);
422 this.getUnifiedSubstitutionData().get(serviceTemplateFileName)
423 .setNodesRelatedSubstitutionServiceTemplateNode(
424 nodesRelatedSubstitutionServiceTemplateNodeTemplateIdMap);
428 * Get unified abstract node template which is mapped to the input node template id.
430 * @param serviceTemplate the service template
431 * @param nodeTemplateId the node template id
433 public String getUnifiedAbstractNodeTemplateId(ServiceTemplate serviceTemplate,
434 String nodeTemplateId) {
435 UnifiedSubstitutionData unifiedSubstitutionData =
436 this.unifiedSubstitutionData.get(ToscaUtil.getServiceTemplateFileName(serviceTemplate));
437 return unifiedSubstitutionData.getNodesRelatedAbstractNode().get(nodeTemplateId);
441 * Get unified node template in the substitution service template which is mapped to the
442 * original input node template id.
444 * @param serviceTemplate the service template
445 * @param nodeTemplateId the node template id
447 public String getUnifiedSubstitutionNodeTemplateId(ServiceTemplate serviceTemplate,
448 String nodeTemplateId) {
449 UnifiedSubstitutionData unifiedSubstitutionData =
450 this.unifiedSubstitutionData.get(ToscaUtil.getServiceTemplateFileName(serviceTemplate));
451 return unifiedSubstitutionData.getNodesRelatedSubstitutionServiceTemplateNode()
452 .get(nodeTemplateId);
455 public int getHandledNestedComputeNodeTemplateIndex(String serviceTemplateName,
456 String computeType) {
457 return this.unifiedSubstitutionData.get(serviceTemplateName)
458 .getHandledNestedComputeNodeTemplateIndex(computeType);
461 public void updateHandledComputeType(String serviceTemplateName,
462 String handledComputeType,
463 String nestedServiceTemplateFileName) {
464 String globalSTName =
465 ToscaUtil.getServiceTemplateFileName(Constants.GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME);
466 this.unifiedSubstitutionData.putIfAbsent(
467 globalSTName, new UnifiedSubstitutionData());
468 this.unifiedSubstitutionData.get(globalSTName)
469 .addHandledComputeType(handledComputeType);
470 this.unifiedSubstitutionData.get(globalSTName).addHandlesNestedServiceTemplate(nestedServiceTemplateFileName);
472 this.unifiedSubstitutionData.putIfAbsent(serviceTemplateName, new UnifiedSubstitutionData());
473 this.unifiedSubstitutionData.get(serviceTemplateName).addHandlesNestedServiceTemplate(nestedServiceTemplateFileName);
476 public void addHandledComputeTypeInServiceTemplate(String serviceTemplateName,
477 String handledComputeType){
478 this.unifiedSubstitutionData.putIfAbsent(serviceTemplateName, new UnifiedSubstitutionData());
479 this.unifiedSubstitutionData.get(serviceTemplateName).addHandledComputeType(handledComputeType);
482 public boolean isComputeTypeHandledInServiceTemplate(String serviceTemplateName,
483 String computeType) {
484 return !Objects.isNull(this.unifiedSubstitutionData.get(serviceTemplateName))
485 && this.unifiedSubstitutionData.get(serviceTemplateName)
486 .isComputeTypeHandledInServiceTemplate(computeType);
489 public int getHandledNestedComputeNodeTemplateIndex(String serviceTemplateName,
490 String nestedServiceTemplateName,
492 return this.unifiedSubstitutionData.get(serviceTemplateName)
493 .getHandledNestedComputeNodeTemplateIndex(computeType);
496 public boolean isNestedServiceTemplateWasHandled(String serviceTemplateName,
497 String nestedServiceTemplateFileName) {
498 if (Objects.isNull(this.unifiedSubstitutionData.get(serviceTemplateName))) {
501 return this.unifiedSubstitutionData.get(serviceTemplateName)
502 .isNestedServiceTemplateWasHandled(nestedServiceTemplateFileName);
505 public Set<String> getAllRelatedNestedNodeTypeIds(){
506 String globalName = "GlobalSubstitutionTypes";
507 if(Objects.isNull(this.unifiedSubstitutionData) ||
508 Objects.isNull(this.unifiedSubstitutionData.get(globalName))){
509 return new HashSet<>();
512 return this.unifiedSubstitutionData.get(globalName).getAllRelatedNestedNodeTypeIds();
515 public boolean isUnifiedHandledServiceTemplate(ServiceTemplate serviceTemplate) {
516 String serviceTemplateFileName = ToscaUtil.getServiceTemplateFileName(serviceTemplate);
517 if (unifiedHandledServiceTemplates.contains(serviceTemplateFileName)) {
525 public void addUnifiedHandledServiceTeamplte(ServiceTemplate serviceTemplate) {
526 String serviceTemplateFileName = ToscaUtil.getServiceTemplateFileName(serviceTemplate);
527 this.unifiedHandledServiceTemplates.add(serviceTemplateFileName);
530 public boolean isNestedNodeWasHandled(String serviceTemplateName,
531 String nestedNodeTemplateId) {
532 if (Objects.isNull(this.unifiedSubstitutionData.get(serviceTemplateName))) {
535 return this.unifiedSubstitutionData.get(serviceTemplateName)
536 .isNestedNodeWasHandled(nestedNodeTemplateId);
539 public void addNestedNodeAsHandled(String serviceTemplateName,
540 String nestedNodeTemplateId) {
541 this.unifiedSubstitutionData.putIfAbsent(serviceTemplateName, new UnifiedSubstitutionData());
542 this.unifiedSubstitutionData.get(serviceTemplateName)
543 .addHandledNestedNodes(nestedNodeTemplateId);
546 public void updateUsedTimesForNestedComputeNodeType(String serviceTemplateName,
547 String computeType) {
548 this.unifiedSubstitutionData.putIfAbsent(serviceTemplateName, new UnifiedSubstitutionData());
550 this.unifiedSubstitutionData.get(serviceTemplateName)
551 .updateUsedTimesForNestedComputeNodeType(computeType);
554 public int getGlobalNodeTypeIndex(String serviceTemplateName,
555 String computeType) {
556 if (Objects.isNull(this.unifiedSubstitutionData.get(serviceTemplateName))) {
559 return this.unifiedSubstitutionData.get(serviceTemplateName).getGlobalNodeTypeIndex
563 public void addNewPropertyIdToNodeTemplate(String serviceTemplateName,
564 String newPropertyId,
565 Object origPropertyValue){
566 this.unifiedSubstitutionData.putIfAbsent(serviceTemplateName, new UnifiedSubstitutionData());
567 this.unifiedSubstitutionData.get(serviceTemplateName).addNewPropertyIdToNodeTemplate(
568 newPropertyId, origPropertyValue);
571 public Optional<Object> getNewPropertyInputParamId(String serviceTemplateName,
572 String newPropertyId){
573 if(Objects.isNull(this.unifiedSubstitutionData.get(serviceTemplateName))){
574 return Optional.empty();
577 return this.unifiedSubstitutionData.get(serviceTemplateName).getNewPropertyInputParam
581 public Map<String, Object> getAllNewPropertyInputParamIdsPerNodeTenplateId(String serviceTemplateName){
582 if(Objects.isNull(this.unifiedSubstitutionData.get(serviceTemplateName))){
583 return new HashMap<>();
586 return this.unifiedSubstitutionData.get(serviceTemplateName).getAllNewPropertyInputParamIds();
590 public Set<String> getServiceTemplatesWithoutNodeTemplateSection() {
591 return serviceTemplatesWithoutNodeTemplateSection;
594 public void setServiceTemplatesWithoutNodeTemplateSection(
595 Set<String> serviceTemplatesWithoutNodeTemplateSection) {
596 this.serviceTemplatesWithoutNodeTemplateSection = serviceTemplatesWithoutNodeTemplateSection;
599 public void addServiceTemplateWithoutNodeTemplates(String serviceTemplateName){
600 this.serviceTemplatesWithoutNodeTemplateSection.add(serviceTemplateName);
603 public boolean isServiceTemplateWithoutNodeTemplates(String serviceTemplateName){
604 return !Objects.isNull(serviceTemplateName) &&
605 this.serviceTemplatesWithoutNodeTemplateSection.contains(serviceTemplateName);
608 public void updateRequirementAssignmentIdIndex(String serviceTemplateName,
609 String nodeTemplateId,
610 String requirementId){
611 requirementIdAppearanceInNodeTemplate.putIfAbsent(serviceTemplateName, new HashMap<>());
612 requirementIdAppearanceInNodeTemplate
613 .get(serviceTemplateName).putIfAbsent(nodeTemplateId, new HashMap<>());
615 Map<String, Integer> requirementIdToAppearance =
616 requirementIdAppearanceInNodeTemplate.get(serviceTemplateName).get(nodeTemplateId);
618 if(requirementIdToAppearance.containsKey(requirementId)){
619 requirementIdToAppearance
620 .put(requirementId, requirementIdToAppearance.get(requirementId) + 1);
622 requirementIdToAppearance.put(requirementId, 0);