From e3a17890903ee443d0b5d0ee872e316e4369318d Mon Sep 17 00:00:00 2001 From: franciscovila Date: Fri, 27 Jan 2023 11:51:47 +0000 Subject: 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 Change-Id: I61f6dba8c15dd73de99cbf2cfb857e271f37665d --- .../openecomp/sdc/be/model/operations/impl/ModelOperation.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'catalog-model/src/main/java/org') 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 typesYamlMap = new Yaml().loadAs(typesYaml, Map.class); + Map typesYamlMap = new Yaml().loadAs(typesYaml, Map.class); + if (typesYamlMap.containsKey("data_types")){ + typesYamlMap = (Map) typesYamlMap.get("data_types"); + } removeExistingTypesFromDefaultImports(elementTypeEnum, typesYamlMap, rebuiltModelImportList); final Map originalContent = new Yaml().load(additionalTypeDefinitionsImport.getContent()); @@ -396,7 +399,10 @@ public class ModelOperation { final Map typesToUpate = new HashMap<>(); - final Map newTypesYaml = new Yaml().load(typesYaml); + Map newTypesYaml = new Yaml().load(typesYaml); + if (newTypesYaml.containsKey("data_types")){ + newTypesYaml = (Map) newTypesYaml.get("data_types"); + } newTypesYaml.entrySet().stream().filter(entry -> existingTypeNames.contains(entry.getKey())).forEach(newTypeToUpdate -> { final Map propertiesInNewDef = (Map) ((Map) newTypeToUpdate.getValue()).get("properties"); -- cgit 1.2.3-korg