aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-translator-lib
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-translator-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java14
-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/PortTemplateConsolidationData.java13
2 files changed, 19 insertions, 8 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java
index df6bad594d..2ae64e2566 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java
@@ -35,7 +35,12 @@ import org.openecomp.sdc.tosca.services.ToscaUtil;
import org.openecomp.sdc.translator.datatypes.heattotosca.to.TranslatedHeatResource;
import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.composition.UnifiedCompositionEntity;
import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.composition.UnifiedSubstitutionData;
-import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.*;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.ComputeConsolidationDataHandler;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.ConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.ConsolidationDataHandler;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.PortConsolidationDataHandler;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.NestedConsolidationDataHandler;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.SubInterfaceConsolidationDataHandler;
import org.openecomp.sdc.translator.services.heattotosca.ConfigConstants;
import org.openecomp.sdc.translator.services.heattotosca.ConsolidationEntityType;
import org.openecomp.sdc.translator.services.heattotosca.Constants;
@@ -223,8 +228,9 @@ public class TranslationContext {
}
public Optional<String> getUnifiedNestedNodeTypeId(String serviceTemplateName, String nestedNodeTemplateId) {
- return this.unifiedSubstitutionData.get(serviceTemplateName) == null ? Optional.empty() :
- this.unifiedSubstitutionData.get(serviceTemplateName).getUnifiedNestedNodeTypeId(nestedNodeTemplateId);
+ UnifiedSubstitutionData substitutionData = this.unifiedSubstitutionData.get(serviceTemplateName);
+ return substitutionData == null ? Optional.empty() :
+ substitutionData.getUnifiedNestedNodeTypeId(nestedNodeTemplateId);
}
public ConsolidationData getConsolidationData() {
@@ -552,7 +558,7 @@ public class TranslationContext {
public boolean isUnifiedHandledServiceTemplate(ServiceTemplate serviceTemplate) {
String serviceTemplateFileName = ToscaUtil.getServiceTemplateFileName(serviceTemplate);
- return unifiedHandledServiceTemplates.contains(serviceTemplateFileName)? true:false;
+ return unifiedHandledServiceTemplates.contains(serviceTemplateFileName);
}
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/PortTemplateConsolidationData.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/PortTemplateConsolidationData.java
index 6cdee5a6c5..3755baafbc 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/PortTemplateConsolidationData.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/unifiedmodel/consolidation/PortTemplateConsolidationData.java
@@ -117,10 +117,10 @@ public class PortTemplateConsolidationData extends EntityConsolidationData {
public boolean isNumberOfSubInterfacesPerTypeSimilar(PortTemplateConsolidationData other) {
return isBothSubInterfaceConsolidationDataEmpty(this, other)
- || !isBothSubInterfaceConsolidationDataEmpty(this, other)
- && this.subInterfaceConsolidationData.keySet().stream().allMatch(
- subInterfaceType -> calculateSize(other.subInterfaceConsolidationData.get(subInterfaceType))
- == calculateSize(this.subInterfaceConsolidationData.get(subInterfaceType)));
+ || isBothSubInterfaceConsolidationDataNotEmpty(this, other)
+ && this.subInterfaceConsolidationData.keySet().stream().allMatch(
+ subInterfaceType -> calculateSize(other.subInterfaceConsolidationData.get(subInterfaceType))
+ == calculateSize(this.subInterfaceConsolidationData.get(subInterfaceType)));
}
@@ -129,6 +129,11 @@ public class PortTemplateConsolidationData extends EntityConsolidationData {
return object.subInterfaceConsolidationData.isEmpty() && other.subInterfaceConsolidationData.isEmpty();
}
+ private boolean isBothSubInterfaceConsolidationDataNotEmpty(
+ PortTemplateConsolidationData object, PortTemplateConsolidationData other) {
+ return !object.subInterfaceConsolidationData.isEmpty() && !other.subInterfaceConsolidationData.isEmpty();
+ }
+
public boolean isSubInterfaceNodeTemplateIdParameter(String nodeTemplateType) {
List<SubInterfaceTemplateConsolidationData> subInterfaceTemplateConsolidationDataList =
this.subInterfaceConsolidationData.get(nodeTemplateType);