diff options
author | MichaelMorris <michael.morris@est.tech> | 2023-10-20 19:34:42 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2023-10-20 20:25:58 +0000 |
commit | 461f20fd6fb23c594361c734525cdd281b72c2e3 (patch) | |
tree | 96be1d570f13e26e057589b9379e6e77f4b90c0f /catalog-be | |
parent | 07e9d2aae2e3fe8a786f0032e30288ec11bce387 (diff) |
Fix null values in model node type values
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Issue-ID: SDC-4663
Change-Id: I707d4532be97f093110cdc29d8807014259d8145
Diffstat (limited to 'catalog-be')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CommonCsarGenerator.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CommonCsarGenerator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CommonCsarGenerator.java index a0e4203fe0..d80a91f0e4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CommonCsarGenerator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CommonCsarGenerator.java @@ -40,6 +40,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.EnumMap; import java.util.HashMap; @@ -745,7 +746,7 @@ public class CommonCsarGenerator { final Object object = propertiesFromMergingContent.get(key); if (object instanceof Map) { ((Map<String, Object>) object).keySet().forEach(s -> - propertiesMap.put(s, ((Map<String, Object>) value).get(s)) + propertiesMap.put(s, getValue(s, (Map<String, Object>) value)) ); } else { propertiesMap.putAll(createProperties(value)); @@ -758,6 +759,24 @@ public class CommonCsarGenerator { return result; } + private Object getValue(final String key, Map<String, Object> value) { + final String mappedKey = mapKey(key); + if (mappedKey.equals("schemaType")) { + return Collections.singletonMap("type", value.get(mappedKey)); + } + return value.get(mappedKey); + } + + private String mapKey(final String key) { + if (key.equals("entry_schema")) { + return "schemaType"; + } + if (key.equals("default")) { + return "defaultValue"; + } + return key; + } + private Map<String, Object> createProperties(final Object value) { final Map<String, Object> propertiesMap = new HashMap<>(); propertiesMap.put("type", ((Map<String, Object>) value).get("type")); |