diff options
author | Dmitry Puzikov <dmitry.puzikov@tieto.com> | 2020-02-19 16:06:51 +0100 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-03-05 08:10:12 +0000 |
commit | cf65d5f1aa842965848de276cd8eb50a932f5757 (patch) | |
tree | e72eb04ae7a150049f02c69c7e4d7cc1f3515dbe /catalog-model/src | |
parent | ffeb962c707caf38b3eaf3ff1fc18bf1b1c8ef54 (diff) |
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 <d.puzikov2@partner.samsung.com>
Diffstat (limited to 'catalog-model/src')
-rw-r--r-- | catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverter.java | 29 |
1 files 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<String, DataTypeDefinition> dataTypes, List<PropertyDefinition> allPropertiesRecursive, Map<String, Object> toscaMap, final boolean isScalarF, final ToscaValueConverter innerConverterFinal, - Entry<String, JsonElement> e) { + private void convertEntry(final String innerType, final Map<String, DataTypeDefinition> dataTypes, + final List<PropertyDefinition> allPropertiesRecursive, final Map<String, Object> toscaMap, final boolean isScalarF, + final ToscaValueConverter innerConverterFinal, final Entry<String, JsonElement> 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); } |