summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel')
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/composition/UnifiedSubstitutionData.java50
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/ConsolidationData.java28
2 files changed, 34 insertions, 44 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/composition/UnifiedSubstitutionData.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/composition/UnifiedSubstitutionData.java
index c7fb7bb75a..7b461d2903 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/composition/UnifiedSubstitutionData.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/composition/UnifiedSubstitutionData.java
@@ -7,6 +7,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.Set;
@@ -25,11 +26,13 @@ public class UnifiedSubstitutionData {
private Map<String, Integer> handledComputeTypesInNestedSubstitutionTemplate =
new HashMap<>();
//Key - nested compute type, Value - list of nested files that the compute type is present
- private Map<String, Set<String>> handledNestedComputeTypesNestedFiles = new HashMap<>();
+ private Map<String, Integer> handledNestedComputeTypesNestedFiles = new HashMap<>();
//Key - new property id, Value - orig property value
private Map<String, Object> newParameterIdsToPropertiesFromOrigNodeTemplate = new HashMap<>();
//handled nested files
private Set<String> handledNestedFiles = new HashSet<>();
+ //handled nested nodes
+ private Set<String> handledNestedNodes = new HashSet<>();
public Map<String, String> getNodesRelatedAbstractNode() {
return nodesRelatedAbstractNode;
@@ -40,6 +43,10 @@ public class UnifiedSubstitutionData {
this.nodesRelatedAbstractNode = nodesRelatedAbstractNode;
}
+ public void addHandledNestedNodes(String handledNestedNodeId) {
+ this.handledNestedNodes.add(handledNestedNodeId);
+ }
+
public Map<String, String> getNodesRelatedSubstitutionServiceTemplateNode() {
return nodesRelatedSubstitutionServiceTemplateNode;
}
@@ -114,8 +121,7 @@ public class UnifiedSubstitutionData {
return new HashSet<>(this.nestedNodeTypeRelatedUnifiedTranslatedId.values());
}
- public void addHandledComputeType(String nestedServiceTemplateFileName,
- String handledComputeType) {
+ public void addHandledComputeType(String handledComputeType) {
if (this.handledComputeTypesInNestedSubstitutionTemplate.containsKey(handledComputeType)) {
Integer timesHandled =
@@ -123,7 +129,7 @@ public class UnifiedSubstitutionData {
this.handledComputeTypesInNestedSubstitutionTemplate
.put(handledComputeType, timesHandled + 1);
} else {
- this.handledNestedFiles.add(nestedServiceTemplateFileName);
+ //this.handledNestedFiles.add(nestedServiceTemplateFileName);
handledComputeTypesInNestedSubstitutionTemplate.put(handledComputeType, 0);
}
}
@@ -134,23 +140,38 @@ public class UnifiedSubstitutionData {
public int getHandledNestedComputeNodeTemplateIndex(String computeType) {
return this.handledComputeTypesInNestedSubstitutionTemplate.containsKey(computeType) ?
- this.handledComputeTypesInNestedSubstitutionTemplate.get(computeType):
- 0;
+ this.handledComputeTypesInNestedSubstitutionTemplate.get(computeType) : 0;
+ }
+
+ public void addHandlesNestedServiceTemplate(String nestedServiceTemplateFileName){
+ this.handledNestedFiles.add(nestedServiceTemplateFileName);
}
public boolean isNestedServiceTemplateWasHandled(String nestedServiceTemplateFileName) {
return this.handledNestedFiles.contains(nestedServiceTemplateFileName);
}
- public void addNestedFileToUsedNestedComputeType(String computeType,
- String nestedServiceTemplateFileName){
- this.handledNestedComputeTypesNestedFiles.putIfAbsent(computeType, new HashSet<>());
- this.handledNestedComputeTypesNestedFiles.get(computeType).add(nestedServiceTemplateFileName);
+ public void updateUsedTimesForNestedComputeNodeType(String computeType) {
+ this.handledNestedComputeTypesNestedFiles.putIfAbsent(computeType, 0);
+
+ Integer usedNumber = this.handledNestedComputeTypesNestedFiles.get(computeType);
+ this.handledNestedComputeTypesNestedFiles.put(computeType, usedNumber + 1);
+
+ }
+
+ public int getGlobalNodeTypeIndex(String computeType) {
+ return Objects.isNull(this.handledNestedComputeTypesNestedFiles.get(computeType))
+ || this.handledNestedComputeTypesNestedFiles.get(computeType)== 0 ? 0
+ : this.handledNestedComputeTypesNestedFiles.get(computeType);
}
- public int getGlobalNodeTypeIndex(String computeType){
- return this.handledNestedComputeTypesNestedFiles.get(computeType).size() == 1 ? 0:
- this.handledNestedComputeTypesNestedFiles.get(computeType).size() - 1;
+ public boolean isNestedNodeWasHandled(String nestedNodeId) {
+ return this.handledNestedNodes.contains(nestedNodeId);
+ }
+
+
+ public Map<String, Object> getAllNewPropertyInputParamIds(){
+ return this.newParameterIdsToPropertiesFromOrigNodeTemplate;
}
public void addNewPropertyIdToNodeTemplate(String newPropertyId,
@@ -168,7 +189,4 @@ public class UnifiedSubstitutionData {
return Optional.of(newParameterIdsToPropertiesFromOrigNodeTemplate.get(newPropertyId));
}
- public Map<String, Object> getAllNewPropertyInputParamIds(){
- return this.newParameterIdsToPropertiesFromOrigNodeTemplate;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/ConsolidationData.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/ConsolidationData.java
index 496da78f76..20cc3be3cd 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/ConsolidationData.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/ConsolidationData.java
@@ -1,9 +1,5 @@
package org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
/**
* The type Consolidation data.
*/
@@ -15,11 +11,6 @@ public class ConsolidationData {
//Port Consolidation data
private PortConsolidationData portConsolidationData;
- //Key - Service Template file name
- //value - List of the abstract/substitute node template id
- private Map<String, List<String>> substituteNodeTemplates; // todo - remove this one and use
- // nestedConsolidationData instead
-
//Nested Consolidation data
private NestedConsolidationData nestedConsolidationData;
@@ -31,7 +22,6 @@ public class ConsolidationData {
computeConsolidationData = new ComputeConsolidationData();
portConsolidationData = new PortConsolidationData();
nestedConsolidationData = new NestedConsolidationData();
- substituteNodeTemplates = new HashMap<>();
}
/**
@@ -72,24 +62,6 @@ public class ConsolidationData {
}
/**
- * Gets substitute node templates.
- *
- * @return the substitute node templates
- */
- public Map<String, List<String>> getSubstituteNodeTemplates() {
- return substituteNodeTemplates;
- }
-
- /**
- * Sets substitute node templates.
- *
- * @param substituteNodeTemplates the substitute node templates
- */
- public void setSubstituteNodeTemplates(Map<String, List<String>> substituteNodeTemplates) {
- this.substituteNodeTemplates = substituteNodeTemplates;
- }
-
- /**
* Gets nested consolidation data.
*
* @return the nested consolidation data