From 6ecc7c3e150f86528d36cdbaa94912b965619a70 Mon Sep 17 00:00:00 2001 From: aribeiro Date: Mon, 30 Aug 2021 15:18:40 +0100 Subject: Filter categories by model name Issue-ID: SDC-3706 Signed-off-by: aribeiro Change-Id: I457151f09ce0ed2edfa09340e9e08a126e114002 --- .../be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java | 4 +++- .../sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'catalog-model/src/main/java') 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 61b11b3168..b45dae9c68 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 @@ -609,7 +609,8 @@ public class TopologyTemplateOperation extends ToscaElementOperation { private StorageOperationStatus associateServiceMetadataToCategory(GraphVertex nodeTypeVertex, TopologyTemplate topologyTemplate) { String categoryName = topologyTemplate.getCategories().get(0).getName(); - Either category = categoryOperation.getCategory(categoryName, VertexTypeEnum.SERVICE_CATEGORY); + Either category = categoryOperation.getCategory(categoryName, + VertexTypeEnum.SERVICE_CATEGORY); if (category.isRight()) { log.trace("NO category {} for service {}", categoryName, topologyTemplate.getUniqueId()); return StorageOperationStatus.CATEGORY_NOT_FOUND; @@ -1176,6 +1177,7 @@ public class TopologyTemplateOperation extends ToscaElementOperation { }.getType(); 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(); final List metadataKeysfromJsonCat = getGson() 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 1037935ab5..2ff3b49a00 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 @@ -1060,6 +1060,9 @@ public abstract class ToscaElementOperation extends BaseOperation { CategoryDefinition category = new CategoryDefinition(); category.setUniqueId((String) categoryV.property(GraphPropertyEnum.UNIQUE_ID.getProperty()).value()); category.setNormalizedName(categoryNormalizedName); + category.setModels(categoryV.property(GraphPropertyEnum.MODEL.getProperty()).isPresent() ? getGson() + .fromJson((String) categoryV.property(GraphPropertyEnum.MODEL.getProperty()).value(), new TypeToken>() { + }.getType()) : Collections.emptyList()); category.setName((String) categoryV.property(GraphPropertyEnum.NAME.getProperty()).value()); category.setUseServiceSubstitutionForNestedServices( (Boolean) categoryV.property(GraphPropertyEnum.USE_SUBSTITUTION_FOR_NESTED_SERVICES.getProperty()).orElse(false)); -- cgit 1.2.3-korg