From 6e12c8ad59f11426e49f81c4a7032480b126bfbc Mon Sep 17 00:00:00 2001 From: vasraz Date: Mon, 23 Jan 2023 20:10:43 +0000 Subject: Implement hiding mechanism Signed-off-by: Vasyl Razinkov Change-Id: I799af15e31b724ca394eebe435223c03186fb6d3 Issue-ID: SDC-4344 --- .../operations/TopologyTemplateOperation.java | 13 +++++++------ .../operations/ToscaElementOperation.java | 20 ++++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) (limited to 'catalog-model/src/main') diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java index 790499c0da..603e09b590 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java @@ -1184,14 +1184,15 @@ public class TopologyTemplateOperation extends ToscaElementOperation { category.setUniqueId(categoryV.getUniqueId()); category.setNormalizedName((String) metadataProperties.get(GraphPropertyEnum.NORMALIZED_NAME)); category.setName((String) metadataProperties.get(GraphPropertyEnum.NAME)); - final Boolean useServiceSubstitutionForNestedServices = (Boolean) metadataProperties - .get(GraphPropertyEnum.USE_SUBSTITUTION_FOR_NESTED_SERVICES); + final Object useServiceSubstitutionForNestedServices = metadataProperties.get(GraphPropertyEnum.USE_SUBSTITUTION_FOR_NESTED_SERVICES); category.setUseServiceSubstitutionForNestedServices( - useServiceSubstitutionForNestedServices == null ? false : useServiceSubstitutionForNestedServices); + useServiceSubstitutionForNestedServices != null && (boolean) useServiceSubstitutionForNestedServices); Type listTypeCat = new TypeToken>() { }.getType(); - List iconsfromJsonCat = getGson().fromJson((String) metadataProperties.get(GraphPropertyEnum.ICONS.getProperty()), listTypeCat); - category.setIcons(iconsfromJsonCat); + category.setNotApplicableMetadataKeys( + (getGson().fromJson((String) metadataProperties.get(GraphPropertyEnum.NOT_APPLICABLE_METADATA_KEYS.getProperty()), listTypeCat))); + List iconsFromJsonCat = getGson().fromJson((String) metadataProperties.get(GraphPropertyEnum.ICONS.getProperty()), listTypeCat); + category.setIcons(iconsFromJsonCat); category.setModels((getGson().fromJson((String) metadataProperties.get(GraphPropertyEnum.MODEL.getProperty()), listTypeCat))); final Type metadataKeysTypeCat = new TypeToken>() { }.getType(); @@ -1589,7 +1590,7 @@ public class TopologyTemplateOperation extends ToscaElementOperation { String policyName = policyDefinition.getName(); if (StringUtils.isBlank(policyName)) { policyName = buildSubComponentName((String) componentV.getJsonMetadataField(JsonPresentationFields.NAME), - policyDefinition.getPolicyTypeName(), counter); + policyDefinition.getPolicyTypeName(), counter); policyDefinition.setName(policyName); } policyDefinition.setInvariantName(policyName); diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java index 910d7ae1b6..327ece3da7 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java @@ -152,7 +152,7 @@ public abstract class ToscaElementOperation extends BaseOperation { protected GraphVertex getHighestVersionFrom(GraphVertex v) { Either childVertexE = janusGraphDao - .getChildVertex(v, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse); + .getChildVertex(v, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse); GraphVertex highestVersionVertex = v; while (childVertexE.isLeft()) { highestVersionVertex = childVertexE.left().value(); @@ -279,9 +279,10 @@ public abstract class ToscaElementOperation extends BaseOperation { /** * Creates the MODEL in case it exits on the previous version - * @param previousToscaElement previous element version - * @param nextToscaElement latest element version - * @param user user + * + * @param previousToscaElement previous element version + * @param nextToscaElement latest element version + * @param user user * @param createdToscaElementVertex created tosca element * @param edgeLabelEnum * @return @@ -1079,6 +1080,10 @@ public abstract class ToscaElementOperation extends BaseOperation { List metadataKeys = categoryV.property(GraphPropertyEnum.METADATA_KEYS.getProperty()).isPresent() ? getGson() .fromJson((String) categoryV.property(GraphPropertyEnum.METADATA_KEYS.getProperty()).value(), listTypeCat) : Collections.emptyList(); category.setMetadataKeys(metadataKeys); + VertexProperty property = categoryV.property(GraphPropertyEnum.NOT_APPLICABLE_METADATA_KEYS.getProperty()); + category.setNotApplicableMetadataKeys( + property.isPresent() ? getGson().fromJson((String) property.value(), new TypeToken>() { + }.getType()) : Collections.emptyList()); categories.add(category); catalogComponent.setCategories(categories); return JanusGraphOperationStatus.OK; @@ -1241,11 +1246,10 @@ public abstract class ToscaElementOperation extends BaseOperation { private void generateNewToscaFileName(String componentType, String componentName, ArtifactDataDefinition artifactInfo) { Optional> oConfig = ConfigurationManager.getConfigurationManager().getConfiguration().getToscaArtifacts() - .entrySet().stream().filter(p -> p.getKey().equalsIgnoreCase(artifactInfo.getArtifactLabel())).findAny(); + .entrySet().stream().filter(p -> p.getKey().equalsIgnoreCase(artifactInfo.getArtifactLabel())).findAny(); if (oConfig.isPresent()) { - artifactInfo.setArtifactName(componentType + "-" + componentName + ((Map)oConfig.get().getValue()).get("artifactName")); - } - else { + artifactInfo.setArtifactName(componentType + "-" + componentName + ((Map) oConfig.get().getValue()).get("artifactName")); + } else { artifactInfo.setArtifactName(componentType + "-" + componentName); } } -- cgit 1.2.3-korg