diff options
author | vasraz <vasyl.razinkov@est.tech> | 2023-01-20 17:03:45 +0000 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2023-01-26 09:52:15 +0000 |
commit | dce3a3476f0d08dc9ffc1b012f11da6aa02a6858 (patch) | |
tree | 6e253b3deeccf738c83b5a7bc6f78e802f79548d /catalog-model/src/main/java/org/openecomp | |
parent | 6e12c8ad59f11426e49f81c4a7032480b126bfbc (diff) |
Fix 'Property Constraint error when uprading VFC instance version in service'-bug
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Change-Id: I72b813073645909e37937373178b823e0ca694f9
Issue-ID: SDC-4345
Diffstat (limited to 'catalog-model/src/main/java/org/openecomp')
-rw-r--r-- | catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java | 6 | ||||
-rw-r--r-- | catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java | 18 |
2 files changed, 11 insertions, 13 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java index f612514070..5d78d37364 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java @@ -27,18 +27,16 @@ import com.google.gson.GsonBuilder; import java.lang.reflect.Type; import java.util.List; import java.util.stream.Collectors; +import lombok.NoArgsConstructor; import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; +@NoArgsConstructor public class PropertyDefinition extends PropertyDataDefinition implements IOperationParameter, IComplexDefaultValue, ToscaPropertyData { private List<PropertyConstraint> constraints; - public PropertyDefinition() { - super(); - } - public String getToscaSubPath() { return toscaSubPath; } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java index 7924e09f79..4082905769 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java @@ -119,7 +119,6 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate; import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum; import org.openecomp.sdc.be.model.jsonjanusgraph.enums.JsonConstantKeysEnum; -import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.resources.data.ComponentMetadataData; import org.openecomp.sdc.be.resources.data.ProductMetadataData; @@ -767,7 +766,7 @@ public class ModelConverter { component.setSystemName((String) toscaElement.getMetadataValue(JsonPresentationFields.SYSTEM_NAME)); component.setDerivedFromGenericType(toscaElement.getDerivedFromGenericType()); component.setDerivedFromGenericVersion(toscaElement.getDerivedFromGenericVersion()); - if(toscaElement.getModel() != null) { + if (toscaElement.getModel() != null) { component.setModel(toscaElement.getModel()); } Map<String, PropertyDataDefinition> properties = toscaElement.getProperties(); @@ -791,7 +790,8 @@ public class ModelConverter { } else { resource.setResourceVendorModelNumber(""); } - Boolean isNormative = toscaElement.getMetadataValue(JsonPresentationFields.NORMATIVE) == null ? false : (Boolean) toscaElement.getMetadataValue(JsonPresentationFields.NORMATIVE); + Boolean isNormative = toscaElement.getMetadataValue(JsonPresentationFields.NORMATIVE) == null ? false + : (Boolean) toscaElement.getMetadataValue(JsonPresentationFields.NORMATIVE); resource.getComponentMetadataDefinition().getMetadataDataDefinition().setNormative(isNormative); } else if (component.getComponentType() == ComponentTypeEnum.SERVICE) { Service service = (Service) component; @@ -835,7 +835,7 @@ public class ModelConverter { component.setCategorySpecificMetadata(categorySpecificMetadata); } } - + private static List<MetadataKeyDataDefinition> getCategorySpecificMetadataKeys(final ToscaElement toscaElement) { final List<MetadataKeyDataDefinition> metadataKeys = new ArrayList<>(); final Optional<CategoryDefinition> category = getCategory(toscaElement); @@ -959,7 +959,7 @@ public class ModelConverter { private static void convertSubstitutionFiltersComponents(final TopologyTemplate topologyTemplate, final Component component) { final SubstitutionFilterDataDefinition filters = topologyTemplate.getSubstitutionFilters(); - if (filters == null){ + if (filters == null) { component.setSubstitutionFilter(null); return; } @@ -1359,7 +1359,8 @@ public class ModelConverter { } else { toscaElement.setMetadataValue(JsonPresentationFields.RESOURCE_VENDOR_MODEL_NUMBER, ""); } - toscaElement.setMetadataValue(JsonPresentationFields.NORMATIVE, ((Resource) component).getComponentMetadataDefinition().getMetadataDataDefinition().isNormative()); + toscaElement.setMetadataValue(JsonPresentationFields.NORMATIVE, + ((Resource) component).getComponentMetadataDefinition().getMetadataDataDefinition().isNormative()); } else if (component.getComponentType() == ComponentTypeEnum.SERVICE) { // field isn't mandatory , but shouldn't be null(should be an empty string instead) if (((Service) component).getServiceType() != null) { @@ -1508,10 +1509,9 @@ public class ModelConverter { Map<String, List<ComponentInstanceProperty>> properties = new HashMap<>(); for (Entry<String, MapPropertiesDataDefinition> entry : topologyTemplate.getInstProperties().entrySet()) { if (entry.getValue() != null && entry.getValue().getMapToscaDataDefinition() != null) { - String key = entry.getKey(); List<ComponentInstanceProperty> componentInstanceAttributes = entry.getValue().getMapToscaDataDefinition().entrySet().stream() - .map(e -> new ComponentInstanceProperty(new PropertyDefinition(e.getValue()))).collect(Collectors.toList()); - properties.put(key, componentInstanceAttributes); + .map(e -> new ComponentInstanceProperty(new PropertyDataDefinition(e.getValue()))).collect(Collectors.toList()); + properties.put(entry.getKey(), componentInstanceAttributes); } } component.setComponentInstancesProperties(properties); |