diff options
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java | 19 | ||||
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/SubstitutionMapping.java | 1 |
2 files changed, 20 insertions, 0 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 d0c14f77c5..08c3d18157 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 @@ -373,6 +373,11 @@ public class ToscaExportHandler { substitutionMapping.setProperties(propertyMappingMap); } + final Map<String, String[]> attributesMappingMap = buildSubstitutionMappingAttributesMapping(component); + if (!attributesMappingMap.isEmpty()) { + substitutionMapping.setAttributes(attributesMappingMap); + } + topologyTemplate.setSubstitution_mappings(substitutionMapping); toscaNode.setTopology_template(topologyTemplate); @@ -1751,6 +1756,20 @@ public class ToscaExportHandler { ); } + private Map<String, String[]> buildSubstitutionMappingAttributesMapping(final Component component) { + if (component == null || CollectionUtils.isEmpty(component.getOutputs())) { + return Collections.emptyMap(); + } + return component.getOutputs().stream() + .map(PropertyDataDefinition::getName) + .collect( + Collectors.toMap( + outputName -> outputName, + outputName -> new String[]{outputName}, + (outputName1, outputName2) -> outputName1) + ); + } + Optional<Map<String, ToscaProperty>> getProxyNodeTypeProperties(Component proxyComponent, Map<String, DataTypeDefinition> dataTypes) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/SubstitutionMapping.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/SubstitutionMapping.java index 1a2a13817b..7b70a0b5f4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/SubstitutionMapping.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/SubstitutionMapping.java @@ -39,4 +39,5 @@ public class SubstitutionMapping { private Map<String, String[]> requirements; private NodeFilter substitution_filter; private Map<String, String[]> properties; + private Map<String, String[]> attributes; } |