summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
authoraribeiro <anderson.ribeiro@est.tech>2021-12-08 11:27:37 +0000
committerMichael Morris <michael.morris@est.tech>2021-12-17 09:37:57 +0000
commite638cd61b3f3a79046b0aaab0f3dabdabd43badc (patch)
tree0e83506d6962d16ec9703f095303bc4d9d402934 /catalog-be/src/main
parent6c682e71e580cf051e7ab30ed7a89b03ca46277b (diff)
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 <anderson.ribeiro@est.tech> Change-Id: I3d9de6936653cf857082e970213f584cdc6e54fb
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java11
1 files changed, 9 insertions, 2 deletions
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<DataTypeDefinition> privateDataTypes, final ToscaProperty toscaPropertyTobeValidated,
+ final ToscaProperty toscaProperty) {
+ final Optional<DataTypeDefinition> match = privateDataTypes.stream()
+ .filter(dataType -> dataType.getName().equals(toscaPropertyTobeValidated.getType())).findFirst();
+ return match.isPresent() ? toscaPropertyTobeValidated : toscaProperty;
+ }
+
private Map<String, ToscaAttribute> convertToToscaAttributes(final List<AttributeDefinition> attributeList,
final Map<String, DataTypeDefinition> dataTypes) {
if (CollectionUtils.isEmpty(attributeList)) {