From: priyanshu Date: Mon, 22 Oct 2018 12:24:45 +0000 (+0530) Subject: Workflow duplicate artifacts in CSAR X-Git-Tag: 1.3.2~52 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=2dadfcd572cc081644f74a0c03dbc4dbd4a339b9;p=sdc.git Workflow duplicate artifacts in CSAR Old workflow artifacts still packed in csar even if another workflow is assigned to same operation Change-Id: Iee956903222d1fc1e8c898b4989b2198501554bb Issue-ID: SDC-1862 Signed-off-by: priyanshu --- 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 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){