From 08a24bfbff3b1f830084fa23c8eb9f097e21db0b Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Thu, 4 Mar 2021 12:25:35 +0000 Subject: Fix issue with invariantUUID in exported tosca Signed-off-by: MichaelMorris Issue-ID: SDC-3496 Change-Id: If12426466d2e9f8cfd97cef888f8a710e46afb01 --- .../java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'catalog-be/src/main/java') 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 1f0270fee9..ab87b5e739 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 @@ -143,6 +143,7 @@ import org.yaml.snakeyaml.representer.Representer; public class ToscaExportHandler { private static final Logger log = Logger.getLogger(ToscaExportHandler.class); + private static final String INVARIANT_UUID = "invariantUUID"; private ApplicationDataTypeCache dataTypeCache; private ToscaOperationFacade toscaOperationFacade; @@ -444,7 +445,7 @@ public class ToscaExportHandler { private Map convertMetadata(Component component, boolean isInstance, ComponentInstance componentInstance) { Map toscaMetadata = new LinkedHashMap<>(); - toscaMetadata.put(JsonPresentationFields.INVARIANT_UUID.getPresentation(), component.getInvariantUUID()); + toscaMetadata.put(convertMetadataKey(JsonPresentationFields.INVARIANT_UUID), component.getInvariantUUID()); toscaMetadata.put(JsonPresentationFields.UUID.getPresentation(), component.getUUID()); toscaMetadata .put(JsonPresentationFields.NAME.getPresentation(), component.getComponentMetadataDefinition().getMetadataDataDefinition().getName()); @@ -515,6 +516,13 @@ public class ToscaExportHandler { } return toscaMetadata; } + + private String convertMetadataKey(JsonPresentationFields jsonPresentationField) { + if (JsonPresentationFields.INVARIANT_UUID.equals(jsonPresentationField)) { + return INVARIANT_UUID; + } + return jsonPresentationField.getPresentation(); + } private Either>, ToscaError> fillImports(Component component, ToscaTemplate toscaTemplate) { -- cgit 1.2.3-korg