Amendment Documents
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
package net.gepafin.tendermanagement.service;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.DocumentEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserCompanyDelegationEntity;
|
||||
import net.gepafin.tendermanagement.enums.DocOtherSourceTypeEnum;
|
||||
@@ -21,7 +20,7 @@ AmazonS3Service {
|
||||
|
||||
InputStream getFile(String s3Folder, String filePath) throws IOException;
|
||||
|
||||
String generateS3PathForDeletedDocument(DocOtherSourceTypeEnum typeOfDocument, Long callId, Long applicationId);
|
||||
String generateS3PathForDeletedDocument(DocOtherSourceTypeEnum typeOfDocument, Long callId, Long applicationId,Long amendmentId);
|
||||
|
||||
String generateS3PathForDeletedDocumentForOther();
|
||||
|
||||
@@ -29,6 +28,6 @@ AmazonS3Service {
|
||||
|
||||
void deleteDelegationfromS3(UserCompanyDelegationEntity userCompanyDelegationEntity);
|
||||
|
||||
void deleteFileFromS3(DocumentEntity documentEntity, Long callId, Long applicationId);
|
||||
void deleteFileFromS3(DocumentEntity documentEntity, Long callId, Long applicationId,Long amendmentId);
|
||||
|
||||
}
|
||||
@@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -164,10 +164,10 @@ public class S3ReUploadMigrationService {
|
||||
Long callId;
|
||||
|
||||
if (sourceType.equals(DocumentSourceTypeEnum.CALL)) {
|
||||
return s3ConfigBean.generateDocumentPath(sourceType, document.getSourceId(), 0L);
|
||||
return s3ConfigBean.generateDocumentPath(sourceType, document.getSourceId(), 0L,0L);
|
||||
} else {
|
||||
callId = applicationRepository.findCallIdById(document.getSourceId());
|
||||
return s3ConfigBean.generateDocumentPath(sourceType, callId, document.getSourceId());
|
||||
return s3ConfigBean.generateDocumentPath(sourceType, callId, document.getSourceId(),0L);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ public class UserSignedAndDelegationServiceImpl {
|
||||
|
||||
private String generateNewS3PathForDelegationDoc() {
|
||||
|
||||
return s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.USER_DELEGATION, 0L, 0L);
|
||||
return s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.USER_DELEGATION, 0L, 0L,0L);
|
||||
}
|
||||
|
||||
private String generateNewS3PathForUserSignedDoc(ApplicationSignedDocumentEntity document) {
|
||||
|
||||
Reference in New Issue
Block a user