summaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java
index 03ffdd5fa6..65260c10a2 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java
@@ -3162,6 +3162,16 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
}
String uniqueId = implementationArtifact.getUniqueId();
+ Either<Long, CassandraOperationStatus> artifactCount = artifactCassandraDao.getCountOfArtifactById(uniqueId);
+ if(artifactCount.isLeft()){
+ CassandraOperationStatus cassandraOperationStatus = artifactCassandraDao.deleteArtifact(uniqueId);
+ if(cassandraOperationStatus != CassandraOperationStatus.OK){
+ log.debug("Failed to persist operation {} artifact, error is {}",operation.getName(),cassandraOperationStatus);
+ StorageOperationStatus storageStatus = DaoStatusConverter.convertCassandraStatusToStorageStatus(cassandraOperationStatus);
+ ActionStatus convertedFromStorageResponse = componentsUtils.convertFromStorageResponse(storageStatus);
+ return Either.right(componentsUtils.getResponseFormat(convertedFromStorageResponse));
+ }
+ }
artifactData.setId(uniqueId);
CassandraOperationStatus cassandraOperationStatus = artifactCassandraDao.saveArtifact(artifactData);
if(cassandraOperationStatus != CassandraOperationStatus.OK){