summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java
diff options
context:
space:
mode:
authoraribeiro <anderson.ribeiro@est.tech>2020-08-26 17:54:01 +0100
committerSébastien Determe <sebastien.determe@intl.att.com>2020-09-07 07:11:49 +0000
commitc572ed8873bee57ad925fb231464efbca98a8007 (patch)
tree7802838a547962886d57515f64cb5665f12b303c /catalog-be/src/main/java
parentc70b7081d70edf93aefae514dc688d8dc1835db2 (diff)
Delete node_filter capabilities
Issue-ID: SDC-3264 Signed-off-by: aribeiro <anderson.ribeiro@est.tech> Change-Id: I91bb476819aaf247ec106139a3af1afe327a700c
Diffstat (limited to 'catalog-be/src/main/java')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogic.java6
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentNodeFilterServlet.java11
2 files changed, 13 insertions, 4 deletions
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<CINodeFilterDataDefinition, StorageOperationStatus> 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 Optional<CINodeFilterDataDefinition>actionResponse = componentNodeFilterBusinessLogic
+ final Optional<NodeFilterConstraintType> nodeFilterConstraintType =
+ NodeFilterConstraintType.parse(constraintType);
+ if (!nodeFilterConstraintType.isPresent()) {
+ return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.INVALID_CONTENT_PARAM,
+ "Invalid value for NodeFilterConstraintType enum %s", constraintType));
+ }
+ final Optional<CINodeFilterDataDefinition> 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);