From 50c930a4095964a77611900401eff85f001c4aed Mon Sep 17 00:00:00 2001 From: aribeiro Date: Mon, 25 May 2020 11:33:22 +0100 Subject: Add Support for node_filters Allows for node_filter to be specified for a node template to provide processing instructions to the orchestrator Issue-ID: SDC-3095 Change-Id: I4e496e300552049d9bfd00df878b86d9fb97312b Signed-off-by: aribeiro --- .../operations/NodeFilterOperation.java | 26 ++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'catalog-model') 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 13ad534bbb..7ed7818ab4 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 @@ -26,7 +26,6 @@ import fj.data.Either; import java.util.ArrayList; import java.util.List; import java.util.Set; - import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; @@ -36,7 +35,7 @@ import org.openecomp.sdc.be.datatypes.elements.CINodeFilterDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; import org.openecomp.sdc.be.datatypes.elements.RequirementNodeFilterPropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.model.Service; +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; import org.openecomp.sdc.common.jsongraph.util.CommonUtility; @@ -47,23 +46,21 @@ public class NodeFilterOperation extends BaseOperation { private static Logger logger = Logger.getLogger(NodeFilterOperation.class); - public Either, StorageOperationStatus> deleteNodeFilters(Service service, - Set componentInstanceIds) { - Either getComponentVertex; - Either getNodeFilterVertex; + public Either, StorageOperationStatus> deleteNodeFilters(final Component component, + final Set componentInstanceIds) { + final Either getComponentVertex; + final Either getNodeFilterVertex; StorageOperationStatus status; - getComponentVertex = janusGraphDao.getVertexById(service.getUniqueId(), JsonParseFlagEnum.NoParse); + getComponentVertex = janusGraphDao.getVertexById(component.getUniqueId(), JsonParseFlagEnum.NoParse); if (getComponentVertex.isRight()) { return Either.right( DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getComponentVertex.right().value())); } - - getNodeFilterVertex = - janusGraphDao.getChildVertex(getComponentVertex.left().value(), EdgeLabelEnum.NODE_FILTER_TEMPLATE, - JsonParseFlagEnum.NoParse); + getNodeFilterVertex = janusGraphDao.getChildVertex(getComponentVertex.left().value(), + EdgeLabelEnum.NODE_FILTER_TEMPLATE, JsonParseFlagEnum.NoParse); if (getNodeFilterVertex.isLeft()) { - status = deleteToscaDataElements(service.getUniqueId(), EdgeLabelEnum.NODE_FILTER_TEMPLATE, + status = deleteToscaDataElements(component.getUniqueId(), EdgeLabelEnum.NODE_FILTER_TEMPLATE, new ArrayList<>(componentInstanceIds)); if (status != StorageOperationStatus.OK) { return Either.right(status); @@ -74,9 +71,10 @@ public class NodeFilterOperation extends BaseOperation { } - public Either deleteNodeFilter(Service service, String componentInstanceId) { + public Either deleteNodeFilter(final Component component, + final String componentInstanceId) { final Either, StorageOperationStatus> listStorageOperationStatusEither = - deleteNodeFilters(service, ImmutableSet.of(componentInstanceId)); + deleteNodeFilters(component, ImmutableSet.of(componentInstanceId)); if (listStorageOperationStatusEither.isRight()) { return Either.right(listStorageOperationStatusEither.right().value()); } -- cgit 1.2.3-korg