summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib
diff options
context:
space:
mode:
authoreleonorali <eleonoral@amdocs.com>2018-05-31 16:27:36 +0300
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-05-31 14:47:26 +0000
commit3407b830f0b954aea0d9cd90a7a60bcf25ef716b (patch)
tree02f1194fce2c191abf203f6f6a391066bc21845b /openecomp-be/lib
parenta8d58165f25ff2cde93ed623f0ebbf78fcd82057 (diff)
TOSCA Consolidation Data - Refactoring Part 2
Fix some issues Change-Id: I85183a6a894350985e1d197fa84328071f3a7ce2 Issue-ID: SDC-1330 Signed-off-by: eleonorali <eleonoral@amdocs.com>
Diffstat (limited to 'openecomp-be/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);