From e638cd61b3f3a79046b0aaab0f3dabdabd43badc Mon Sep 17 00:00:00 2001 From: aribeiro Date: Wed, 8 Dec 2021 11:27:37 +0000 Subject: Allows custom property type names When onboarding a VSP with private data types SDC shall allow custom property type name on its declaration. Issue-ID: SDC-3805 Signed-off-by: aribeiro Change-Id: I3d9de6936653cf857082e970213f584cdc6e54fb --- .../java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'catalog-be') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java index d228db5f4b..cdd5d60ed4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java @@ -814,8 +814,8 @@ public class ToscaExportHandler { toscaDataType.setProperties(dataType.getProperties().stream() .collect(Collectors.toMap( PropertyDataDefinition::getName, - s -> propertyConvertor - .convertProperty(dataTypes, s, PropertyType.PROPERTY) + s -> propertyConvertor.convertProperty(dataTypes, s, PropertyType.PROPERTY), + (toscaPropertyTobeValidated, toscaProperty) -> validateToscaProperty(privateDataTypes, toscaPropertyTobeValidated, toscaProperty) ))); } toscaDataTypeMap.put(dataType.getName(), toscaDataType); @@ -827,6 +827,13 @@ public class ToscaExportHandler { return convertReqCapAndTypeName(componentsCache, component, toscaNode, nodeTypes, toscaNodeType, dataTypes); } + private ToscaProperty validateToscaProperty(final List privateDataTypes, final ToscaProperty toscaPropertyTobeValidated, + final ToscaProperty toscaProperty) { + final Optional match = privateDataTypes.stream() + .filter(dataType -> dataType.getName().equals(toscaPropertyTobeValidated.getType())).findFirst(); + return match.isPresent() ? toscaPropertyTobeValidated : toscaProperty; + } + private Map convertToToscaAttributes(final List attributeList, final Map dataTypes) { if (CollectionUtils.isEmpty(attributeList)) { -- cgit 1.2.3-korg