From 153a35821f0d25ce23cca467b76c5a7c5092c744 Mon Sep 17 00:00:00 2001 From: Tal Gitelman Date: Mon, 3 Jul 2017 20:16:55 +0300 Subject: [sdc] - last merges before moving to LF Change-Id: I0df3ec795f0de84229ea4bb4806ec8f959243557 Signed-off-by: Tal Gitelman --- .../heattotosca/UnifiedCompositionService.java | 29 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org') diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionService.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionService.java index 50576086c8..d5a87ad668 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionService.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionService.java @@ -1706,7 +1706,7 @@ public class UnifiedCompositionService { //todo - define list of type which will match the node property type (instead of string) addPropertyInputParameter(propertyType, substitutionServiceTemplate, propertyDefinition .getEntry_schema(), - parameterId, unifiedCompositionEntity); + parameterId, unifiedCompositionEntity, context); } } } @@ -1782,7 +1782,7 @@ public class UnifiedCompositionService { addPropertyInputParameter(propertyType, substitutionServiceTemplate, enrichNodeType .getProperties().get(enrichPropertyName).getEntry_schema(), - Optional.of(inputParamId), compositionEntity); + Optional.of(inputParamId), compositionEntity, context); } } @@ -1814,8 +1814,16 @@ public class UnifiedCompositionService { private void addPropertyInputParameter(String propertyType, ServiceTemplate substitutionServiceTemplate, EntrySchema entrySchema, Optional parameterId, - UnifiedCompositionEntity unifiedCompositionEntity) { - if (isPropertySimpleType(propertyType)) { + UnifiedCompositionEntity unifiedCompositionEntity, + TranslationContext context) { + if(parameterId.isPresent() && + isParameterBelongsToEnrichedPortProperties(parameterId.get(), context)){ + addInputParameter(parameterId.get(), + propertyType, + propertyType.equals(PropertyType.LIST.getDisplayName()) ? entrySchema : null , + substitutionServiceTemplate); + } + else if (isPropertySimpleType(propertyType)) { parameterId .ifPresent(parameterIdValue -> addInputParameter(parameterIdValue, PropertyType.LIST.getDisplayName(), @@ -1842,6 +1850,19 @@ public class UnifiedCompositionService { } } + private boolean isParameterBelongsToEnrichedPortProperties(String parameterId, + TranslationContext context){ + List enrichPortResourceProperties = context.getEnrichPortResourceProperties(); + + for(int i = 0; i < enrichPortResourceProperties.size(); i++){ + if(parameterId.contains((CharSequence) enrichPortResourceProperties.get(i))){ + return true; + } + } + + return false; + } + private boolean isPropertySimpleType(String propertyType) { return !Objects.isNull(propertyType) && (propertyType.equalsIgnoreCase(PropertyType.STRING.getDisplayName()) -- cgit 1.2.3-korg