diff options
-rw-r--r-- | catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java | 10 | ||||
-rw-r--r-- | catalog-ui/src/app/utils/service-data-type-reader.ts | 2 |
2 files changed, 9 insertions, 3 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"); diff --git a/catalog-ui/src/app/utils/service-data-type-reader.ts b/catalog-ui/src/app/utils/service-data-type-reader.ts index fd5ee2fc19..99b3d3ae63 100644 --- a/catalog-ui/src/app/utils/service-data-type-reader.ts +++ b/catalog-ui/src/app/utils/service-data-type-reader.ts @@ -34,7 +34,7 @@ export class ServiceDataTypeReader { const result = <String>reader.result; const loadedContent = load(result); console.log("Readed content: " + loadedContent); - this.readName(loadedContent); + this.readName(this.getDataType(loadedContent)); this.readDerivedFrom(this.getDataType(loadedContent)); this.readDescription(this.getDataType(loadedContent)); this.readProperties(this.getDataType(loadedContent)); |