summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java/org
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2023-03-06 17:52:41 +0000
committerMichael Morris <michael.morris@est.tech>2023-03-08 15:59:30 +0000
commita522a3a2c2b262780dd0efab5747ef937e124bee (patch)
treebe77440948ffbdb03cef541d9c1d8482c752d8d8 /catalog-be/src/main/java/org
parent99ac5dc08792191a79a18101e830ccacb71edde7 (diff)
Add backend support for VFC property metadata
Remove empty tags from tosca file Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Change-Id: I0c446b537934ffd19c1162326e075e13845db23e Issue-ID: SDC-4424
Diffstat (limited to 'catalog-be/src/main/java/org')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java13
1 files changed, 7 insertions, 6 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 fff9f0bf1c..62b345c499 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
@@ -40,7 +40,10 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.function.Consumer;
import java.util.function.Function;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.onap.sdc.tosca.datatypes.model.EntrySchema;
import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
@@ -83,6 +86,7 @@ import org.yaml.snakeyaml.nodes.Tag;
import org.yaml.snakeyaml.representer.Representer;
import org.yaml.snakeyaml.resolver.Resolver;
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Component
public final class ImportUtils {
@@ -91,9 +95,6 @@ public final class ImportUtils {
private static final Logger log = Logger.getLogger(ImportUtils.class);
private static ComponentsUtils componentsUtils;
- private ImportUtils() {
- }
-
@Autowired
public static void setComponentsUtils(ComponentsUtils cu) {
componentsUtils = cu;
@@ -361,6 +362,7 @@ public final class ImportUtils {
setJsonStringField(propertyValue, TypeUtils.ToscaTagNamesEnum.VALUE, propertyDef.getType(), propertyDef::setValue);
setFieldBoolean(propertyValue, TypeUtils.ToscaTagNamesEnum.IS_PASSWORD, pass -> propertyDef.setPassword(Boolean.parseBoolean(pass)));
setField(propertyValue, TypeUtils.ToscaTagNamesEnum.STATUS, propertyDef::setStatus);
+ setFieldMap(propertyValue, ToscaTagNamesEnum.METADATA, propertyDef::setMetadata);
setSchema(propertyValue, propertyDef);
setPropertyConstraints(propertyValue, propertyDef);
return propertyDef;
@@ -533,7 +535,7 @@ 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()) {
+ if (toscaMapElement.isLeft() && MapUtils.isNotEmpty(toscaMapElement.left().value())) {
setter.accept(toscaMapElement.left().value());
}
}
@@ -770,6 +772,7 @@ public final class ImportUtils {
}
}
+ @NoArgsConstructor(access = AccessLevel.PRIVATE)
public static class Constants {
public static final String FIRST_NON_CERTIFIED_VERSION = "0.1";
@@ -790,7 +793,5 @@ public final class ImportUtils {
public static final String VF_DESCRIPTION = "Nested VF in service";
public static final String TENANT = "tenant";
- private Constants() {
- }
}
}