Amendment Documents

This commit is contained in:
nishainnogent
2024-11-28 12:17:31 +05:30
parent 80cd8c4bb0
commit d21445be38
13 changed files with 132 additions and 41 deletions

View File

@@ -146,9 +146,9 @@ public class AmazonS3ServiceImpl implements AmazonS3Service {
}
@Override
public String generateS3PathForDeletedDocument(DocOtherSourceTypeEnum typeOfDocument, Long callId, Long applicationId) {
public String generateS3PathForDeletedDocument(DocOtherSourceTypeEnum typeOfDocument, Long callId, Long applicationId,Long amendmentId) {
try {
return s3ConfigBean.generateDocumentPathForOther(typeOfDocument, callId, applicationId);
return s3ConfigBean.generateDocumentPathForOther(typeOfDocument, callId, applicationId,amendmentId);
} catch (IllegalArgumentException e) {
throw new CustomValidationException(
Status.VALIDATION_ERROR,
@@ -207,10 +207,10 @@ public class AmazonS3ServiceImpl implements AmazonS3Service {
}
@Override
public void deleteFileFromS3(DocumentEntity documentEntity, Long callId, Long applicationId) {
public void deleteFileFromS3(DocumentEntity documentEntity, Long callId, Long applicationId,Long amendmentId) {
try {
String oldS3Path = documentEntity.getFilePath();
String newS3Path = generateS3PathForDeletedDocument(DocOtherSourceTypeEnum.valueOf("DELETED_" + documentEntity.getSource().toUpperCase()), callId, applicationId)
String newS3Path = generateS3PathForDeletedDocument(DocOtherSourceTypeEnum.valueOf("DELETED_" + documentEntity.getSource().toUpperCase()), callId, applicationId,amendmentId)
+ "/" + oldS3Path.substring(oldS3Path.lastIndexOf("/") + 1);
String bucketUrlPrefix = getBucketUrlPrefix();
if (oldS3Path.startsWith(bucketUrlPrefix)) {
@@ -224,6 +224,4 @@ public class AmazonS3ServiceImpl implements AmazonS3Service {
throw new CustomValidationException(Status.VALIDATION_ERROR, "Error occurred while moving file to deleted folder.");
}
}
}