From b734ea21ac7be393c59cf9976f0e5ddeaf27d568 Mon Sep 17 00:00:00 2001 From: siddharth0905 Date: Thu, 22 Nov 2018 13:37:31 +0530 Subject: Service Workflow changes Service workflow change with few bug fixes Change-Id: Ice2376565bf46fb8d86fb6062654ec54bb2daa43 Issue-ID: SDC-1937 Signed-off-by: siddharth0905 --- .../jsontitan/operations/InterfaceOperation.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'catalog-model') diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java index 916a34c0f3..f9f2ce9b35 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java @@ -17,6 +17,7 @@ package org.openecomp.sdc.be.model.jsontitan.operations; import fj.data.Either; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; @@ -93,6 +94,17 @@ public class InterfaceOperation extends BaseOperation { Either getToscaElementRes; Either getToscaElementInt; + if(isUpdateAction && operation.getImplementationArtifact() != null){ + String artifactUUID = operation.getImplementationArtifact().getArtifactUUID(); + Either artifactCount = artifactCassandraDao.getCountOfArtifactById(artifactUUID); + if(artifactCount.isLeft()){ + CassandraOperationStatus cassandraStatus = artifactCassandraDao.deleteArtifact(artifactUUID); + if (cassandraStatus != CassandraOperationStatus.OK) { + return Either.right(DaoStatusConverter.convertCassandraStatusToStorageStatus(cassandraStatus)); + } + } + } + getToscaElementRes = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); if (getToscaElementRes.isRight()) { TitanOperationStatus status = getToscaElementRes.right().value(); @@ -139,6 +151,21 @@ public class InterfaceOperation extends BaseOperation { return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getInterfaceVertex.right().value())); } + if (!interfaceDef.getOperationsMap().isEmpty()) { + Either getInterfaceOpVertex = + titanDao.getChildVertex(getInterfaceVertex.left().value(), EdgeLabelEnum.INTERFACE_OPERATION, + JsonParseFlagEnum.NoParse); + if (getInterfaceOpVertex.isRight()) { + List toscaDataList = new ArrayList<>(interfaceDef.getOperationsMap().values()); + StorageOperationStatus statusRes = + addToscaDataToToscaElement(getInterfaceVertex.left().value(), EdgeLabelEnum.INTERFACE_OPERATION, + VertexTypeEnum.INTERFACE_OPERATION, toscaDataList, JsonPresentationFields.UNIQUE_ID); + if (!statusRes.equals(StorageOperationStatus.OK)) { + return Either.right(statusRes); + } + } + } + Optional> operationToRemove = interfaceDef.getOperationsMap().entrySet().stream() .filter(entry -> entry.getValue().getUniqueId().equals(operationToDelete)).findAny(); if (operationToRemove.isPresent()){ -- cgit 1.2.3-korg