From cf65d5f1aa842965848de276cd8eb50a932f5757 Mon Sep 17 00:00:00 2001 From: Dmitry Puzikov Date: Wed, 19 Feb 2020 16:06:51 +0100 Subject: Fix policy property type issue When VF is exported as csar, policy properties are typed regardless types in the related shemas. This patch fixes this issue. Change-Id: Ib34f329888d454283c89a8a1aec6349069ea7234 Issue-ID: SDC-2773 Signed-off-by: Dmitry Puzikov --- .../tosca/converters/ToscaMapValueConverter.java | 29 +++++++++++----------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverter.java index 5bbd38e2ba..163d59a57c 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverter.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverter.java @@ -122,24 +122,22 @@ public class ToscaMapValueConverter extends ToscaValueBaseConverter implements T } } - private void convertEntry(String innerType, Map dataTypes, List allPropertiesRecursive, Map toscaMap, final boolean isScalarF, final ToscaValueConverter innerConverterFinal, - Entry e) { + private void convertEntry(final String innerType, final Map dataTypes, + final List allPropertiesRecursive, final Map toscaMap, final boolean isScalarF, + final ToscaValueConverter innerConverterFinal, final Entry e) { log.debug("try convert element "); - boolean scalar = false; - String propType = null; + boolean scalar = isScalarF; + String propType = innerType; ToscaValueConverter innerConverterProp = innerConverterFinal; - if ( isScalarF ){ - scalar = isScalarF; - propType = innerType; - }else{ - for ( PropertyDefinition pd : allPropertiesRecursive ){ - if ( pd.getName().equals(e.getKey()) ){ + if (!scalar) { + for (PropertyDefinition pd : allPropertiesRecursive) { + if (pd.getName().equals(e.getKey())) { propType = pd.getType(); - DataTypeDefinition pdDataType = dataTypes.get(propType); - ToscaPropertyType toscaPropType = isScalarType(pdDataType); - if ( toscaPropType == null ){ + final DataTypeDefinition pdDataType = dataTypes.get(propType); + final ToscaPropertyType toscaPropType = isScalarType(pdDataType); + if (toscaPropType == null) { scalar = false; - }else{ + } else { scalar = true; propType = toscaPropType.getType(); innerConverterProp = toscaPropType.getValueConverter(); @@ -148,7 +146,8 @@ public class ToscaMapValueConverter extends ToscaValueBaseConverter implements T } } } - Object convertedValue = convertDataTypeToToscaObject(propType, dataTypes, innerConverterProp, scalar, e.getValue(), false); + final Object convertedValue = + convertDataTypeToToscaObject(propType, dataTypes, innerConverterProp, scalar, e.getValue(), false); toscaMap.put(e.getKey(), convertedValue); } -- cgit 1.2.3-korg