diff options
author | franciscovila <javier.paradela.vila@est.tech> | 2023-01-27 11:51:47 +0000 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2023-01-27 16:24:04 +0000 |
commit | e3a17890903ee443d0b5d0ee872e316e4369318d (patch) | |
tree | dac7db5e9ce634944f9fcb98846618735e098fd2 /catalog-model/src/main | |
parent | a522b7eb8346617883227c0a6621420cfdf44dc5 (diff) |
Error importing data type in the UI
Fix error importing a file with 'tosca_definitions_version' tag
Issue-ID: SDC-4351
Signed-off-by: franciscovila <javier.paradela.vila@est.tech>
Change-Id: I61f6dba8c15dd73de99cbf2cfb857e271f37665d
Diffstat (limited to 'catalog-model/src/main')
-rw-r--r-- | catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java index 2e35c30e06..311b4719bd 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java @@ -297,7 +297,10 @@ public class ModelOperation { rebuiltModelImportList = new ArrayList<>(modelImportList); } - final Map<String, Object> typesYamlMap = new Yaml().loadAs(typesYaml, Map.class); + Map<String, Object> typesYamlMap = new Yaml().loadAs(typesYaml, Map.class); + if (typesYamlMap.containsKey("data_types")){ + typesYamlMap = (Map<String, Object>) typesYamlMap.get("data_types"); + } removeExistingTypesFromDefaultImports(elementTypeEnum, typesYamlMap, rebuiltModelImportList); final Map<String, Object> originalContent = new Yaml().load(additionalTypeDefinitionsImport.getContent()); @@ -396,7 +399,10 @@ public class ModelOperation { final Map<String, Object> typesToUpate = new HashMap<>(); - final Map<String, Object> newTypesYaml = new Yaml().load(typesYaml); + Map<String, Object> newTypesYaml = new Yaml().load(typesYaml); + if (newTypesYaml.containsKey("data_types")){ + newTypesYaml = (Map<String, Object>) newTypesYaml.get("data_types"); + } newTypesYaml.entrySet().stream().filter(entry -> existingTypeNames.contains(entry.getKey())).forEach(newTypeToUpdate -> { final Map<String, Object> propertiesInNewDef = (Map<String, Object>) ((Map<String, Object>) newTypeToUpdate.getValue()).get("properties"); |