Moved signed document to deleted folder
This commit is contained in:
@@ -1180,8 +1180,7 @@ public class ApplicationDao {
|
||||
ApplicationSignedDocumentEntity oldApplicationSingedDocumentData = Utils.getClonedEntityForData(applicationSignedDocument);
|
||||
|
||||
if (applicationSignedDocument != null) {
|
||||
applicationSignedDocument.setStatus(ApplicationSignedDocumentStatusEnum.INACTIVE.getValue());
|
||||
applicationSignedDocumentRepository.save(applicationSignedDocument);
|
||||
deleteSignedDocumentFromS3(applicationSignedDocument);
|
||||
}
|
||||
UploadFileOnAmazonS3Response uploadFileOnAmazonS3 = uploadFileOnAmazonS3ForUserSignedDocument(file, applicationEntity.getCall().getId(), applicationId);
|
||||
applicationSignedDocument = new ApplicationSignedDocumentEntity();
|
||||
@@ -1204,6 +1203,19 @@ public class ApplicationDao {
|
||||
|
||||
return convertApplicationSignedDocumentToApplicationSignedDocumentResponse(applicationSignedDocument);
|
||||
}
|
||||
public void deleteSignedDocumentFromS3(ApplicationSignedDocumentEntity applicationSignedDocumentEntity){
|
||||
ApplicationSignedDocumentEntity oldApplicationSignedDocument = Utils.getClonedEntityForData(applicationSignedDocumentEntity);
|
||||
String oldS3Path = applicationSignedDocumentEntity.getFilePath();
|
||||
String newS3Path = s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.DELETED_USER_SIGNED_DOCUMENT,applicationSignedDocumentEntity.getApplication().getCall().getId(),applicationSignedDocumentEntity.getApplication().getId(),0L);
|
||||
|
||||
UploadFileOnAmazonS3Response response = amazonS3Service.moveFile(applicationSignedDocumentEntity.getFileName(), oldS3Path, newS3Path);
|
||||
applicationSignedDocumentEntity.setStatus(ApplicationSignedDocumentStatusEnum.INACTIVE.getValue());
|
||||
applicationSignedDocumentEntity.setFileName(response.getFileName());
|
||||
applicationSignedDocumentEntity.setFilePath(response.getFilePath());
|
||||
|
||||
applicationSignedDocumentRepository.save(applicationSignedDocumentEntity);
|
||||
loggingUtil.addVersionHistory(VersionHistoryRequest.builder().request(request).actionType(VersionActionTypeEnum.SOFT_DELETE).oldData(oldApplicationSignedDocument).newData(applicationSignedDocumentEntity).build());
|
||||
}
|
||||
|
||||
private void validateFileTypeForCall(MultipartFile file, ApplicationEntity applicationEntity) {
|
||||
List<String> validCallIds = Arrays.asList(callId.split(","));
|
||||
|
||||
@@ -8,7 +8,8 @@ public enum DocOtherSourceTypeEnum {
|
||||
DELETED_APPLICATION("DELETED_APPLICATION"),
|
||||
DELETED_EVALUATION("DELETED_EVALUATION"),
|
||||
DELETED_CALL("DELETED_CALL"),
|
||||
DELETED_AMENDMENT("DELETED_AMENDMENT");
|
||||
DELETED_AMENDMENT("DELETED_AMENDMENT"),
|
||||
DELETED_USER_SIGNED_DOCUMENT("DELETED_USER_SIGNED_DOCUMENT");
|
||||
|
||||
private String value;
|
||||
|
||||
|
||||
@@ -2675,4 +2675,15 @@
|
||||
</insert>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="25-03-2025_PK_193115" author="Piyush Kag">
|
||||
<insert tableName="s3_path_configuration">
|
||||
<column name="type" value="DELETED_USER_SIGNED_DOCUMENT"/>
|
||||
<column name="path" value="call/{call_id}/application/{application_id}/user_signed_document/deleted"/>
|
||||
<column name="bucket_name" value="mementoresources"/>
|
||||
<column name="created_date" value="2025-03-25 03:00:00"/>
|
||||
<column name="updated_date" value="2024-03-25 03:00:00"/>
|
||||
<column name="parent_folder" value="gepafin/local"/>
|
||||
</insert>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
||||
Reference in New Issue
Block a user