From 2dadfcd572cc081644f74a0c03dbc4dbd4a339b9 Mon Sep 17 00:00:00 2001 From: priyanshu Date: Mon, 22 Oct 2018 17:54:45 +0530 Subject: 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 --- .../sdc/be/components/impl/ArtifactsBusinessLogic.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'catalog-be/src/main/java/org') 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){ -- cgit 1.2.3-korg