From 3a7c314a597a7ceda028696b9542be15e747b2af Mon Sep 17 00:00:00 2001 From: Tal Gitelman Date: Tue, 24 Oct 2017 18:45:00 +0300 Subject: align MME - [BUG323816] Don't add a property to a newly generated csar if the value is not set and the default value is not provided Change-Id: I76b312ef8140ca6207aa7604026c1b0a89bfbe02 Issue-ID:SDC-500 Signed-off-by: Tal Gitelman --- .../openecomp/sdc/be/tosca/PropertyConvertor.java | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'catalog-be/src/main/java/org') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PropertyConvertor.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PropertyConvertor.java index 646a7ecc8b..68adbd5ae3 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PropertyConvertor.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PropertyConvertor.java @@ -74,7 +74,9 @@ public class PropertyConvertor { props.stream().filter(p -> p.getOwnerId() == null || p.getOwnerId().equals(component.getUniqueId())).forEach(property -> { ToscaProperty prop = convertProperty(dataTypes, property, false); - properties.put(property.getName(), prop); + if (prop != null) { + properties.put(property.getName(), prop); + } }); if (!properties.isEmpty()) { toscaNodeType.setProperties(properties); @@ -98,13 +100,17 @@ public class PropertyConvertor { } log.trace("try to convert property {} from type {} with default value [{}]", property.getName(), property.getType(), property.getDefaultValue()); prop.setDefaultp(convertToToscaObject(property.getType(), property.getDefaultValue(), innerType, dataTypes)); + + if (prop.getDefaultp() == null) { + return null; + } prop.setType(property.getType()); - prop.setDescription(property.getDescription()); - if (isCapabiltyProperty) { - prop.setStatus(property.getStatus()); - prop.setRequired(property.isRequired()); - } - return prop; + prop.setDescription(property.getDescription()); + if (isCapabiltyProperty) { + prop.setStatus(property.getStatus()); + prop.setRequired(property.isRequired()); + } + return prop; } public Object convertToToscaObject(String propertyType, String value, String innerType, Map dataTypes) { -- cgit 1.2.3-korg