From 3f816f6fdeb32061c77ab9799e18f2cb41ce8ea7 Mon Sep 17 00:00:00 2001 From: aribeiro Date: Wed, 28 Oct 2020 14:55:59 +0000 Subject: Set directives and node_filters in any node type Allows to set directives and node_filters in any node type. Issue-ID: SDC-3404 Signed-off-by: aribeiro Change-Id: Ib75821e27bf949f841c990b1353f156eda2ae8f0 --- .../sdc/be/components/impl/ComponentInstanceBusinessLogic.java | 8 +------- .../sdc/be/datamodel/utils/UiComponentDataConverter.java | 10 ++++++++++ .../openecomp/sdc/be/servlets/ComponentInstanceServlet.java | 4 +--- 3 files changed, 12 insertions(+), 10 deletions(-) (limited to 'catalog-be/src/main') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java index baa794c6cc..3f48328cc9 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java @@ -1254,9 +1254,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { ComponentInstance componentInstance = componentInstanceOptional.get(); try { - if (containerComponent instanceof Service || containerComponent instanceof Resource && - isVFC(componentInstance.getOriginType())) { - + if (containerComponent instanceof Service || containerComponent instanceof Resource) { final Either deleteServiceFilterEither = nodeFilterOperation.deleteNodeFilter(containerComponent, componentInstanceId); if (deleteServiceFilterEither.isRight()) { @@ -3454,10 +3452,6 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } } - public boolean isVFC(final OriginTypeEnum originTypeEnum) { - return OriginTypeEnum.VFC.equals(originTypeEnum); - } - public void validateUser(final String userId) { final User user = userValidations.validateUserExists(userId); userValidations.validateUserRole(user, Arrays.asList(Role.DESIGNER, Role.ADMIN)); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java index d742fb3aea..494ec9c6e8 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java @@ -390,6 +390,16 @@ public class UiComponentDataConverter { } break; + case NODE_FILTER: + if (resource.getNodeFilterComponents() == null) { + dataTransfer.setNodeFilterforNode(null); + } else { + final NodeFilterConverter nodeFilterConverter = new NodeFilterConverter(); + dataTransfer.setNodeFilterforNode( + nodeFilterConverter.convertDataMapToUI(resource.getNodeFilterComponents())); + } + break; + default: setUiTranferDataByFieldName(dataTransfer, resource, fieldName); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentInstanceServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentInstanceServlet.java index 0896891ad3..c5c89f7665 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentInstanceServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentInstanceServlet.java @@ -256,9 +256,7 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { final ComponentInstance resultValue = actionResponse.left().value(); if (ComponentTypeEnum.SERVICE.equals(componentTypeEnum) || - ComponentTypeEnum.RESOURCE.equals(componentTypeEnum) && - componentInstanceBusinessLogic.isVFC(componentInstance.getOriginType())) { - + ComponentTypeEnum.RESOURCE.equals(componentTypeEnum)) { if(CollectionUtils.isNotEmpty(componentInstance.getDirectives())) { final Optional nodeFilterDataDefinition = nodeFilterBusinessLogic.createNodeFilterIfNotExist(componentId, componentInstanceId, -- cgit 1.2.3-korg