diff options
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java index f53726743c..3a1c55a31f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java @@ -403,6 +403,7 @@ public final class ImportUtils { setField(inputValue, TypeUtils.ToscaTagNamesEnum.LABEL, inputDef::setLabel); setFieldBoolean(inputValue, TypeUtils.ToscaTagNamesEnum.HIDDEN, hidden -> inputDef.setHidden(Boolean.parseBoolean(hidden))); setFieldBoolean(inputValue, TypeUtils.ToscaTagNamesEnum.IMMUTABLE, immutable -> inputDef.setImmutable(Boolean.parseBoolean(immutable))); + setFieldMap(inputValue, ToscaTagNamesEnum.METADATA, inputDef::setMetadata); setSchema(inputValue, inputDef); setPropertyConstraints(inputValue, inputDef); return inputDef; @@ -493,6 +494,14 @@ public final class ImportUtils { } } + private static void setFieldMap(final Map<String, Object> toscaJson, final ToscaTagNamesEnum tagName, + final Consumer<Map<String, String>> setter) { + final Either<Map<String, String>, ResultStatusEnum> toscaMapElement = findFirstToscaMapElement(toscaJson, tagName); + if (toscaMapElement.isLeft()) { + setter.accept(toscaMapElement.left().value()); + } + } + public static Either<Map<String, PropertyDefinition>, ResultStatusEnum> getProperties(Map<String, Object> toscaJson) { Function<String, PropertyDefinition> elementGenByName = ImportUtils::createProperties; Function<Map<String, Object>, PropertyDefinition> func = ImportUtils::createModuleProperty; |