aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2022-06-15 12:50:31 +0100
committerMichael Morris <michael.morris@est.tech>2022-06-20 21:32:44 +0000
commit7081d625ddd0aadcb64f5ba882339fabb612233d (patch)
tree9e9363800f53c84561e4b3acc448de118576d221
parent14ba27afc1422243aa459e3579bee53e2284fba6 (diff)
Support metadata in Inputs during Service Import
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Change-Id: Ie010076082af7c8ed5fd5fcda874ade2a7e37389 Issue-ID: SDC-4052
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java9
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;