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 --- .../jsonjanusgraph/operations/NodeFilterOperation.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'catalog-model/src/main') diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeFilterOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeFilterOperation.java index 02f8e83dde..1bad8b097f 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeFilterOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeFilterOperation.java @@ -36,6 +36,7 @@ import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; import org.openecomp.sdc.be.datatypes.elements.RequirementNodeFilterCapabilityDataDefinition; import org.openecomp.sdc.be.datatypes.elements.RequirementNodeFilterPropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.enums.NodeFilterConstraintType; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; @@ -92,11 +93,20 @@ public class NodeFilterOperation extends BaseOperation { public Either deleteConstraint(final String serviceId, final String componentInstanceId, final CINodeFilterDataDefinition nodeFilterDataDefinition, - final int propertyIndex) { - ListDataDefinition properties = + final int propertyIndex, + final NodeFilterConstraintType nodeFilterConstraintType) { + + if (NodeFilterConstraintType.PROPERTIES.equals(nodeFilterConstraintType)) { + final ListDataDefinition properties = nodeFilterDataDefinition.getProperties(); - properties.getListToscaDataDefinition().remove(propertyIndex); - nodeFilterDataDefinition.setProperties(properties); + properties.getListToscaDataDefinition().remove(propertyIndex); + nodeFilterDataDefinition.setProperties(properties); + } else if (NodeFilterConstraintType.CAPABILITIES.equals(nodeFilterConstraintType)) { + final ListDataDefinition capabilities = + nodeFilterDataDefinition.getCapabilities(); + capabilities.getListToscaDataDefinition().remove(propertyIndex); + nodeFilterDataDefinition.setCapabilities(capabilities); + } return addOrUpdateNodeFilter(true, serviceId, componentInstanceId, nodeFilterDataDefinition); } -- cgit 1.2.3-korg