diff options
author | aribeiro <anderson.ribeiro@est.tech> | 2020-08-26 17:54:01 +0100 |
---|---|---|
committer | Sébastien Determe <sebastien.determe@intl.att.com> | 2020-09-07 07:11:49 +0000 |
commit | c572ed8873bee57ad925fb231464efbca98a8007 (patch) | |
tree | 7802838a547962886d57515f64cb5665f12b303c /catalog-model/src/main | |
parent | c70b7081d70edf93aefae514dc688d8dc1835db2 (diff) |
Delete node_filter capabilities
Issue-ID: SDC-3264
Signed-off-by: aribeiro <anderson.ribeiro@est.tech>
Change-Id: I91bb476819aaf247ec106139a3af1afe327a700c
Diffstat (limited to 'catalog-model/src/main')
-rw-r--r-- | catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeFilterOperation.java | 18 |
1 files changed, 14 insertions, 4 deletions
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<CINodeFilterDataDefinition, StorageOperationStatus> deleteConstraint(final String serviceId, final String componentInstanceId, final CINodeFilterDataDefinition nodeFilterDataDefinition, - final int propertyIndex) { - ListDataDefinition<RequirementNodeFilterPropertyDataDefinition> properties = + final int propertyIndex, + final NodeFilterConstraintType nodeFilterConstraintType) { + + if (NodeFilterConstraintType.PROPERTIES.equals(nodeFilterConstraintType)) { + final ListDataDefinition<RequirementNodeFilterPropertyDataDefinition> 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<RequirementNodeFilterCapabilityDataDefinition> capabilities = + nodeFilterDataDefinition.getCapabilities(); + capabilities.getListToscaDataDefinition().remove(propertyIndex); + nodeFilterDataDefinition.setCapabilities(capabilities); + } return addOrUpdateNodeFilter(true, serviceId, componentInstanceId, nodeFilterDataDefinition); } |