aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-model
diff options
context:
space:
mode:
authorsiddharth0905 <siddharth.singh4@amdocs.com>2018-11-22 13:37:31 +0530
committersiddharth0905 <siddharth.singh4@amdocs.com>2018-11-23 12:48:21 +0530
commitb734ea21ac7be393c59cf9976f0e5ddeaf27d568 (patch)
treedde5d205c378ac748bcecdf7f17f5a41567156fe /catalog-model
parentabbd5cf62a0bdd6a22b9bea0cf589e42da0be229 (diff)
Service Workflow changes
Service workflow change with few bug fixes Change-Id: Ice2376565bf46fb8d86fb6062654ec54bb2daa43 Issue-ID: SDC-1937 Signed-off-by: siddharth0905 <siddharth.singh4@amdocs.com>
Diffstat (limited to 'catalog-model')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java27
1 files changed, 27 insertions, 0 deletions
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<GraphVertex, TitanOperationStatus> getToscaElementRes;
Either<GraphVertex, TitanOperationStatus> getToscaElementInt;
+ if(isUpdateAction && operation.getImplementationArtifact() != null){
+ String artifactUUID = operation.getImplementationArtifact().getArtifactUUID();
+ Either<Long, CassandraOperationStatus> 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<GraphVertex, TitanOperationStatus> getInterfaceOpVertex =
+ titanDao.getChildVertex(getInterfaceVertex.left().value(), EdgeLabelEnum.INTERFACE_OPERATION,
+ JsonParseFlagEnum.NoParse);
+ if (getInterfaceOpVertex.isRight()) {
+ List<ToscaDataDefinition> 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<Entry<String, Operation>> operationToRemove = interfaceDef.getOperationsMap().entrySet().stream()
.filter(entry -> entry.getValue().getUniqueId().equals(operationToDelete)).findAny();
if (operationToRemove.isPresent()){