From c572ed8873bee57ad925fb231464efbca98a8007 Mon Sep 17 00:00:00 2001 From: aribeiro Date: Wed, 26 Aug 2020 17:54:01 +0100 Subject: Delete node_filter capabilities Issue-ID: SDC-3264 Signed-off-by: aribeiro Change-Id: I91bb476819aaf247ec106139a3af1afe327a700c --- .../be/components/impl/ComponentNodeFilterBusinessLogic.java | 6 ++++-- .../openecomp/sdc/be/servlets/ComponentNodeFilterServlet.java | 11 +++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'catalog-be/src/main') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogic.java index ac5af15d6e..962407ca92 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogic.java @@ -225,7 +225,8 @@ public class ComponentNodeFilterBusinessLogic extends BaseBusinessLogic { final String constraint, final int position, final boolean shouldLock, - final ComponentTypeEnum componentTypeEnum) + final ComponentTypeEnum componentTypeEnum, + final NodeFilterConstraintType nodeFilterConstraintType) throws BusinessLogicException { final Component component = getComponent(componentId); @@ -238,7 +239,8 @@ public class ComponentNodeFilterBusinessLogic extends BaseBusinessLogic { wasLocked = true; } final Either result = nodeFilterOperation - .deleteConstraint(componentId, componentInstanceId, nodeFilterDataDefinition, position); + .deleteConstraint(componentId, componentInstanceId, nodeFilterDataDefinition, position, + nodeFilterConstraintType); if (result.isRight()) { janusGraphDao.rollback(); throw new BusinessLogicException(componentsUtils.getResponseFormatByResource(componentsUtils diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentNodeFilterServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentNodeFilterServlet.java index a682dc9bed..5146d5e5b5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentNodeFilterServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentNodeFilterServlet.java @@ -256,9 +256,16 @@ public class ComponentNodeFilterServlet extends AbstractValidationsServlet { componentNodeFilterBusinessLogic.validateUser(userId); try { - final OptionalactionResponse = componentNodeFilterBusinessLogic + final Optional nodeFilterConstraintType = + NodeFilterConstraintType.parse(constraintType); + if (!nodeFilterConstraintType.isPresent()) { + return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.INVALID_CONTENT_PARAM, + "Invalid value for NodeFilterConstraintType enum %s", constraintType)); + } + final Optional actionResponse = componentNodeFilterBusinessLogic .deleteNodeFilter(componentId.toLowerCase(), componentInstanceId, NodeFilterConstraintAction.DELETE, - null, index, true, ComponentTypeEnum.findByParamName(componentType)); + null, index, true, ComponentTypeEnum.findByParamName(componentType), + nodeFilterConstraintType.get()); if (!actionResponse.isPresent()) { LOGGER.debug(FAILED_TO_DELETE_NODE_FILTER); -- cgit 1.2.3-korg