Done Ticket GEPAFINBE-71
This commit is contained in:
@@ -249,5 +249,14 @@ public class GepafinConstant {
|
|||||||
public static final String HUB_NOT_FOUND = "hub_not_found";
|
public static final String HUB_NOT_FOUND = "hub_not_found";
|
||||||
public static final String EVALUATIONCRITERIA_INVALID = "evaluationCriteria.invalid";
|
public static final String EVALUATIONCRITERIA_INVALID = "evaluationCriteria.invalid";
|
||||||
public static final String GET_ERROR_S3 = "get.error.s3";
|
public static final String GET_ERROR_S3 = "get.error.s3";
|
||||||
|
|
||||||
|
public static final String ADDED_S3_PATH_STRUCTURE ="added.s3.path.structure";
|
||||||
|
public static final String S3_PATH_STRUCTURE_BY_TYPE ="fetched.s3.path.structure.by.type.successfully";
|
||||||
|
public static final String S3_PATH_STRUCTURE_NOT_FOUND_BY_TYPE_MSG ="s3.path.not.found.by.type";
|
||||||
|
public static final String S3_PATH_STRUCTURE_NOT_FOUND_BY_ID_MSG ="s3.path.not.found.by.id";
|
||||||
|
public static final String S3_PATH_DELETE_MSG ="s3.path.config.delete.successfully";
|
||||||
|
public static final String S3_PATH_CONFIG_UPDATE_MSG ="s3.path.config.updated.successfully";
|
||||||
|
public static final String S3_PATH_CONFIG_DUPLICATE_TYPE_ALREADY_EXIST ="s3.path.config.already.exist.";
|
||||||
|
public static final String S3_PATH_GENERATION_ERROR_MSG ="s3.path.config.already.exist.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import net.gepafin.tendermanagement.entities.*;
|
|||||||
import net.gepafin.tendermanagement.entities.SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum;
|
import net.gepafin.tendermanagement.entities.SystemEmailTemplatesEntity.SystemEmailTemplatesEntityTypeEnum;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationSignedDocumentStatusEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationSignedDocumentStatusEnum;
|
||||||
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.DocOtherSourceTypeEnum;
|
||||||
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||||
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
|
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserCompanyDelegationStatusEnum;
|
import net.gepafin.tendermanagement.enums.UserCompanyDelegationStatusEnum;
|
||||||
@@ -127,6 +128,9 @@ public class ApplicationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
S3PathConfig s3ConfigBean;
|
||||||
|
|
||||||
|
|
||||||
public ApplicationResponseBean createApplication(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long formId, Long applicationId) {
|
public ApplicationResponseBean createApplication(HttpServletRequest request, ApplicationRequestBean applicationRequestBean, Long formId, Long applicationId) {
|
||||||
FormEntity formEntity = formService.validateForm(formId);
|
FormEntity formEntity = formService.validateForm(formId);
|
||||||
@@ -805,8 +809,8 @@ public class ApplicationDao {
|
|||||||
applicationSignedDocument.setStatus(ApplicationSignedDocumentStatusEnum.INACTIVE.getValue());
|
applicationSignedDocument.setStatus(ApplicationSignedDocumentStatusEnum.INACTIVE.getValue());
|
||||||
applicationSignedDocumentRepository.save(applicationSignedDocument);
|
applicationSignedDocumentRepository.save(applicationSignedDocument);
|
||||||
}
|
}
|
||||||
UploadFileOnAmazonS3Response uploadFileOnAmazonS3 = amazonS3Service.uploadFileOnAmazonS3(signedDocumentS3Folder,
|
UploadFileOnAmazonS3Response uploadFileOnAmazonS3 = uploadFileOnAmazonS3ForUserSignedDocument(file,
|
||||||
file);
|
applicationEntity.getCall().getId(), applicationId);
|
||||||
applicationSignedDocument = new ApplicationSignedDocumentEntity();
|
applicationSignedDocument = new ApplicationSignedDocumentEntity();
|
||||||
applicationSignedDocument.setApplication(applicationEntity);
|
applicationSignedDocument.setApplication(applicationEntity);
|
||||||
applicationSignedDocument.setFileName(uploadFileOnAmazonS3.getFileName());
|
applicationSignedDocument.setFileName(uploadFileOnAmazonS3.getFileName());
|
||||||
@@ -815,7 +819,22 @@ public class ApplicationDao {
|
|||||||
applicationSignedDocumentRepository.save(applicationSignedDocument);
|
applicationSignedDocumentRepository.save(applicationSignedDocument);
|
||||||
return convertApplicationSignedDocumentToApplicationSignedDocumentResponse(applicationSignedDocument);
|
return convertApplicationSignedDocumentToApplicationSignedDocumentResponse(applicationSignedDocument);
|
||||||
}
|
}
|
||||||
|
private UploadFileOnAmazonS3Response uploadFileOnAmazonS3ForUserSignedDocument(MultipartFile file, Long callId, Long applicationId) {
|
||||||
|
try {
|
||||||
|
String s3Path = generateS3PathForDelegation(callId, applicationId);
|
||||||
|
log.info("S3 Path {}", s3Path);
|
||||||
|
return amazonS3Service.uploadFileOnAmazonS3(s3Path, file);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.UPLOAD_ERROR_S3));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private String generateS3PathForDelegation(Long callId, Long applicationId) {
|
||||||
|
try {
|
||||||
|
return s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.USER_SIGNED_DOCUMENT, callId, applicationId);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.S3_PATH_GENERATION_ERROR_MSG));
|
||||||
|
}
|
||||||
|
}
|
||||||
private ApplicationSignedDocumentResponse convertApplicationSignedDocumentToApplicationSignedDocumentResponse(
|
private ApplicationSignedDocumentResponse convertApplicationSignedDocumentToApplicationSignedDocumentResponse(
|
||||||
ApplicationSignedDocumentEntity applicationSignedDocument) {
|
ApplicationSignedDocumentEntity applicationSignedDocument) {
|
||||||
ApplicationSignedDocumentResponse applicationSignedDocumentResponse = new ApplicationSignedDocumentResponse();
|
ApplicationSignedDocumentResponse applicationSignedDocumentResponse = new ApplicationSignedDocumentResponse();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.enums.DocOtherSourceTypeEnum;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -52,6 +53,9 @@ public class DelegationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DocumentRepository documentRepository;
|
private DocumentRepository documentRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private S3PathConfig s3ConfigBean;
|
||||||
|
|
||||||
@Value("${aws.s3.url.folder.delegation}")
|
@Value("${aws.s3.url.folder.delegation}")
|
||||||
private String s3Folder;
|
private String s3Folder;
|
||||||
|
|
||||||
@@ -179,7 +183,7 @@ public class DelegationDao {
|
|||||||
userCompanyDelegationEntity.setStatus(UserCompanyDelegationStatusEnum.INACTIVE.getValue());
|
userCompanyDelegationEntity.setStatus(UserCompanyDelegationStatusEnum.INACTIVE.getValue());
|
||||||
userCompanyDelegationRepository.save(userCompanyDelegationEntity);
|
userCompanyDelegationRepository.save(userCompanyDelegationEntity);
|
||||||
}
|
}
|
||||||
UploadFileOnAmazonS3Response uploadFileOnAmazonS3Response = amazonS3Service.uploadFileOnAmazonS3(s3Folder, file);
|
UploadFileOnAmazonS3Response uploadFileOnAmazonS3Response = uploadFileOnAmazonS3ForCompanyDelegation(file);
|
||||||
userCompanyDelegationEntity = new UserCompanyDelegationEntity();
|
userCompanyDelegationEntity = new UserCompanyDelegationEntity();
|
||||||
userCompanyDelegationEntity.setCompanyId(companyId);
|
userCompanyDelegationEntity.setCompanyId(companyId);
|
||||||
userCompanyDelegationEntity.setUserId(userEntity.getId());
|
userCompanyDelegationEntity.setUserId(userEntity.getId());
|
||||||
@@ -192,7 +196,21 @@ public class DelegationDao {
|
|||||||
userCompanyDelegationRepository.save(userCompanyDelegationEntity);
|
userCompanyDelegationRepository.save(userCompanyDelegationEntity);
|
||||||
return convertUserCompanyDelegationToCompanyDelegationResponse(userCompanyDelegationEntity);
|
return convertUserCompanyDelegationToCompanyDelegationResponse(userCompanyDelegationEntity);
|
||||||
}
|
}
|
||||||
|
private UploadFileOnAmazonS3Response uploadFileOnAmazonS3ForCompanyDelegation(MultipartFile file) {
|
||||||
|
try {
|
||||||
|
String s3Path = generateS3PathForDelegation();
|
||||||
|
return amazonS3Service.uploadFileOnAmazonS3(s3Path, file);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.UPLOAD_ERROR_S3));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private String generateS3PathForDelegation() {
|
||||||
|
try {
|
||||||
|
return s3ConfigBean.generateDocumentPathForDelegationAndSignedDocument(DocOtherSourceTypeEnum.USER_DELEGATION);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.S3_PATH_GENERATION_ERROR_MSG));
|
||||||
|
}
|
||||||
|
}
|
||||||
private CompanyDelegationResponse convertUserCompanyDelegationToCompanyDelegationResponse(
|
private CompanyDelegationResponse convertUserCompanyDelegationToCompanyDelegationResponse(
|
||||||
UserCompanyDelegationEntity userCompanyDelegationEntity) {
|
UserCompanyDelegationEntity userCompanyDelegationEntity) {
|
||||||
return Utils.convertSourceObjectToDestinationObject(userCompanyDelegationEntity, CompanyDelegationResponse.class);
|
return Utils.convertSourceObjectToDestinationObject(userCompanyDelegationEntity, CompanyDelegationResponse.class);
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ package net.gepafin.tendermanagement.dao;
|
|||||||
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -24,6 +27,7 @@ import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class DocumentDao {
|
public class DocumentDao {
|
||||||
|
|
||||||
@@ -39,6 +43,12 @@ public class DocumentDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CallService callService;
|
private CallService callService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private S3PathConfig s3ConfigBean;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationRepository applicationFormRepository;
|
||||||
|
|
||||||
@Value("${aws.s3.url.folder}")
|
@Value("${aws.s3.url.folder}")
|
||||||
private String s3Folder;
|
private String s3Folder;
|
||||||
|
|
||||||
@@ -46,8 +56,7 @@ public class DocumentDao {
|
|||||||
List<DocumentEntity> documentEntities = new ArrayList<>();
|
List<DocumentEntity> documentEntities = new ArrayList<>();
|
||||||
Long source = resolveSourceId(sourceId, sourceType);
|
Long source = resolveSourceId(sourceId, sourceType);
|
||||||
for (MultipartFile file : files) {
|
for (MultipartFile file : files) {
|
||||||
UploadFileOnAmazonS3Response uploadFileOnAmazonS3Response = amazonS3Service.uploadFileOnAmazonS3(s3Folder,
|
UploadFileOnAmazonS3Response uploadFileOnAmazonS3Response = uploadFileOnAmazonS3(file, sourceType, sourceId);
|
||||||
file);
|
|
||||||
if (uploadFileOnAmazonS3Response != null) {
|
if (uploadFileOnAmazonS3Response != null) {
|
||||||
DocumentEntity documentEntity = new DocumentEntity();
|
DocumentEntity documentEntity = new DocumentEntity();
|
||||||
documentEntity.setFileName(uploadFileOnAmazonS3Response.getFileName());
|
documentEntity.setFileName(uploadFileOnAmazonS3Response.getFileName());
|
||||||
@@ -62,6 +71,30 @@ public class DocumentDao {
|
|||||||
documentRepository.saveAll(documentEntities);
|
documentRepository.saveAll(documentEntities);
|
||||||
return documentEntities.stream().map(callDao::convertToDocumentResponseBean).collect(Collectors.toList());
|
return documentEntities.stream().map(callDao::convertToDocumentResponseBean).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
private UploadFileOnAmazonS3Response uploadFileOnAmazonS3(MultipartFile file, DocumentSourceTypeEnum type, Long sourceId) {
|
||||||
|
|
||||||
|
Long applicationId = 0L;
|
||||||
|
Long callId = sourceId;
|
||||||
|
if (type == DocumentSourceTypeEnum.APPLICATION) {
|
||||||
|
applicationId = sourceId;
|
||||||
|
callId = applicationFormRepository.findCallIdById(applicationId);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
String s3Path = generateS3Path(type, callId, applicationId);
|
||||||
|
log.info("Generated S3 path {}", s3Path);
|
||||||
|
return amazonS3Service.uploadFileOnAmazonS3(s3Path, file);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.UPLOAD_ERROR_S3));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public String generateS3Path(DocumentSourceTypeEnum typeOfDocument, Long callId, Long applicationId) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
return s3ConfigBean.generateDocumentPath(typeOfDocument, callId, applicationId);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.S3_PATH_GENERATION_ERROR_MSG));
|
||||||
|
}
|
||||||
|
}
|
||||||
private Long resolveSourceId(Long sourceId, DocumentSourceTypeEnum sourceType) {
|
private Long resolveSourceId(Long sourceId, DocumentSourceTypeEnum sourceType) {
|
||||||
if (sourceType == DocumentSourceTypeEnum.CALL) {
|
if (sourceType == DocumentSourceTypeEnum.CALL) {
|
||||||
CallEntity callEntity = callService.validateCall(sourceId);
|
CallEntity callEntity = callService.validateCall(sourceId);
|
||||||
@@ -91,7 +124,8 @@ public class DocumentDao {
|
|||||||
|
|
||||||
public DocumentResponseBean updateDocument(Long documentId, MultipartFile file, DocumentTypeEnum documentTypeEnum) {
|
public DocumentResponseBean updateDocument(Long documentId, MultipartFile file, DocumentTypeEnum documentTypeEnum) {
|
||||||
DocumentEntity documentEntity = validateDocument(documentId);
|
DocumentEntity documentEntity = validateDocument(documentId);
|
||||||
UploadFileOnAmazonS3Response uploadFileOnAmazonS3Response = amazonS3Service.uploadFileOnAmazonS3(s3Folder, file);
|
String type = documentEntity.getSource();
|
||||||
|
UploadFileOnAmazonS3Response uploadFileOnAmazonS3Response = updateFileOnAmazonS3(file, DocumentSourceTypeEnum.valueOf(type), documentEntity.getSourceId());
|
||||||
if (uploadFileOnAmazonS3Response != null) {
|
if (uploadFileOnAmazonS3Response != null) {
|
||||||
documentEntity.setFileName(uploadFileOnAmazonS3Response.getFileName());
|
documentEntity.setFileName(uploadFileOnAmazonS3Response.getFileName());
|
||||||
documentEntity.setFilePath(uploadFileOnAmazonS3Response.getFilePath());
|
documentEntity.setFilePath(uploadFileOnAmazonS3Response.getFilePath());
|
||||||
@@ -102,7 +136,25 @@ public class DocumentDao {
|
|||||||
}
|
}
|
||||||
return callDao.convertToDocumentResponseBean(documentEntity);
|
return callDao.convertToDocumentResponseBean(documentEntity);
|
||||||
}
|
}
|
||||||
|
private UploadFileOnAmazonS3Response updateFileOnAmazonS3(MultipartFile file, DocumentSourceTypeEnum type, Long id) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
Long callId;
|
||||||
|
Long applicationId;
|
||||||
|
if(type.equals("APPLICATION")){
|
||||||
|
callId = applicationFormRepository.findCallIdById(id);
|
||||||
|
applicationId = id;
|
||||||
|
}else{
|
||||||
|
callId = id;
|
||||||
|
applicationId = 0L;
|
||||||
|
}
|
||||||
|
String s3Path = generateS3Path(type, callId, applicationId);
|
||||||
|
log.info("Generated S3 path {}", s3Path);
|
||||||
|
return amazonS3Service.uploadFileOnAmazonS3(s3Path, file);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.UPLOAD_ERROR_S3));
|
||||||
|
}
|
||||||
|
}
|
||||||
public DocumentResponseBean getDocument(Long documentId) {
|
public DocumentResponseBean getDocument(Long documentId) {
|
||||||
DocumentEntity documentEntity = validateDocument(documentId);
|
DocumentEntity documentEntity = validateDocument(documentId);
|
||||||
return callDao.convertToDocumentResponseBean(documentEntity);
|
return callDao.convertToDocumentResponseBean(documentEntity);
|
||||||
|
|||||||
104
src/main/java/net/gepafin/tendermanagement/dao/S3ConfigDao.java
Normal file
104
src/main/java/net/gepafin/tendermanagement/dao/S3ConfigDao.java
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import net.gepafin.tendermanagement.entities.S3ConfigEntity;
|
||||||
|
import net.gepafin.tendermanagement.model.request.S3ConfigReq;
|
||||||
|
import net.gepafin.tendermanagement.model.response.S3ConfigBean;
|
||||||
|
import net.gepafin.tendermanagement.repositories.S3ConfigRepository;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class S3ConfigDao {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(S3ConfigDao.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
S3ConfigRepository s3ConfigRepository;
|
||||||
|
|
||||||
|
public S3ConfigBean addS3Path(S3ConfigReq s3PathConfigurationReq) {
|
||||||
|
|
||||||
|
log.info("Adding s3 s3PathConfigurationReq structure with it's type..");
|
||||||
|
S3ConfigEntity s3PathConfigurationEntity = convertToS3pathEntity(s3PathConfigurationReq);
|
||||||
|
s3PathConfigurationEntity = s3ConfigRepository.save(s3PathConfigurationEntity);
|
||||||
|
log.info("Added s3 path config details {} to DB.", s3PathConfigurationEntity);
|
||||||
|
return convertToS3pathBean(s3PathConfigurationEntity);
|
||||||
|
}
|
||||||
|
private S3ConfigEntity convertToS3pathEntity(S3ConfigReq s3PathConfigReq) {
|
||||||
|
|
||||||
|
S3ConfigEntity s3PathConfigEntity = new S3ConfigEntity();
|
||||||
|
s3PathConfigEntity.setPath(s3PathConfigReq.getPath());
|
||||||
|
s3PathConfigEntity.setType(s3PathConfigReq.getType());
|
||||||
|
s3PathConfigEntity.setBucketName(s3PathConfigReq.getBucketName());
|
||||||
|
return s3PathConfigEntity;
|
||||||
|
}
|
||||||
|
private S3ConfigBean convertToS3pathBean(S3ConfigEntity s3PathConfigReq) {
|
||||||
|
|
||||||
|
S3ConfigBean s3PathConfigBean = new S3ConfigBean();
|
||||||
|
s3PathConfigBean.setPath(s3PathConfigReq.getPath());
|
||||||
|
s3PathConfigBean.setType(s3PathConfigReq.getType());
|
||||||
|
s3PathConfigBean.setBucketName(s3PathConfigReq.getBucketName());
|
||||||
|
return s3PathConfigBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<S3ConfigEntity> getS3PathByType(String type) {
|
||||||
|
|
||||||
|
log.info("Fetching S3-Path structure by type: {}", type);
|
||||||
|
Optional<S3ConfigEntity> s3PathData = s3ConfigRepository.getPathByType(type);
|
||||||
|
if (s3PathData == null) {
|
||||||
|
log.error("No S3-Path found for type: {}", type);
|
||||||
|
throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.S3_PATH_STRUCTURE_NOT_FOUND_BY_TYPE_MSG));
|
||||||
|
}
|
||||||
|
log.info("Fetched S3-Path: {} for type: {}", s3PathData, type);
|
||||||
|
return s3PathData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public S3ConfigEntity deleteS3PathConfigById(Long id) {
|
||||||
|
|
||||||
|
log.info("Checking s3-path associated with this id {} to delete....", id);
|
||||||
|
S3ConfigEntity s3PathConfigData = s3ConfigRepository.findS3PathConfigurationById(id);
|
||||||
|
if (s3PathConfigData == null) {
|
||||||
|
log.error("No S3-Path found for id: {}", id);
|
||||||
|
throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.S3_PATH_STRUCTURE_NOT_FOUND_BY_ID_MSG));
|
||||||
|
} else {
|
||||||
|
log.info("Found s3-path associated with this id {} to delete.", id);
|
||||||
|
s3ConfigRepository.deleteById(id);
|
||||||
|
log.error("Deleted s3-path configuration successfully for id: {}", id);
|
||||||
|
return s3PathConfigData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public S3ConfigBean updateS3PathConfiguration(S3ConfigReq s3PathConfigurationReq, Long id) {
|
||||||
|
|
||||||
|
log.info("Updating S3-path Configuration.");
|
||||||
|
S3ConfigEntity s3PathConfigDataExists = s3ConfigRepository.findS3PathConfigurationById(id);
|
||||||
|
if (s3PathConfigDataExists == null) {
|
||||||
|
log.error("No S3-Path found for id: {}", id);
|
||||||
|
throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.S3_PATH_STRUCTURE_NOT_FOUND_BY_ID_MSG));
|
||||||
|
} else {
|
||||||
|
Optional<S3ConfigEntity> s3PathData = s3ConfigRepository.getPathByType(s3PathConfigurationReq.getType());
|
||||||
|
if(s3PathData != null){
|
||||||
|
log.error("S3-Path type already exist. {}", s3PathData);
|
||||||
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.S3_PATH_CONFIG_DUPLICATE_TYPE_ALREADY_EXIST));
|
||||||
|
}
|
||||||
|
S3ConfigEntity s3PathConfigurationEntity = convertToS3pathEntity(s3PathConfigurationReq);
|
||||||
|
setIfUpdated(s3PathConfigurationEntity::getPath, s3PathConfigurationEntity::setPath, s3PathConfigurationReq.getPath());
|
||||||
|
setIfUpdated(s3PathConfigurationEntity::getBucketName, s3PathConfigurationEntity::setBucketName, s3PathConfigurationReq.getBucketName());
|
||||||
|
setIfUpdated(s3PathConfigurationEntity::getType, s3PathConfigurationEntity::setType, s3PathConfigurationReq.getType());
|
||||||
|
// s3PathConfigurationEntity.setType(s3PathConfigurationReq.getType());
|
||||||
|
// s3PathConfigurationEntity.setPath(s3PathConfigurationReq.getPath());
|
||||||
|
// s3PathConfigurationEntity.setBucketName(s3PathConfigurationReq.getBucketName());
|
||||||
|
s3ConfigRepository.save(s3PathConfigurationEntity);
|
||||||
|
log.info("Updated S3-path-configuration successfully.");
|
||||||
|
return convertToS3pathBean(s3PathConfigurationEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.S3ConfigEntity;
|
||||||
|
import net.gepafin.tendermanagement.enums.DocOtherSourceTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.repositories.S3ConfigRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class S3PathConfig {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
S3ConfigRepository s3ConfigRepository;
|
||||||
|
|
||||||
|
public String generateDocumentPath(DocumentSourceTypeEnum type, Long callId, Long applicationId) {
|
||||||
|
|
||||||
|
S3ConfigEntity config = getDocumentPath(type);
|
||||||
|
return config.getParentFolder() + "/" + buildS3Path(config.getPath(), callId, applicationId);
|
||||||
|
}
|
||||||
|
public String generateDocumentPathForOther(DocOtherSourceTypeEnum type, Long callId, Long applicationId) {
|
||||||
|
|
||||||
|
S3ConfigEntity config = getDocumentPathForOther(type);
|
||||||
|
return config.getParentFolder() + "/" + buildS3Path(config.getPath(), callId, applicationId);
|
||||||
|
}
|
||||||
|
private String buildS3Path(String pathTemplate, Long callId, Long applicationId) {
|
||||||
|
|
||||||
|
return pathTemplate.replace("{call_id}", callId != null && callId != 0L ? "call_" + callId : "").replace("{application_id}", applicationId != null && applicationId != 0L ? "application_" + applicationId : "");
|
||||||
|
}
|
||||||
|
public String generateDocumentPathForDelegationAndSignedDocument(DocOtherSourceTypeEnum type) {
|
||||||
|
|
||||||
|
S3ConfigEntity config = getDocumentPathForOther(type);
|
||||||
|
return config.getParentFolder() + "/" + config.getPath();
|
||||||
|
}
|
||||||
|
private S3ConfigEntity getDocumentPath(DocumentSourceTypeEnum type) {
|
||||||
|
|
||||||
|
return s3ConfigRepository.getPathByType(type.name()).orElseThrow(() -> new IllegalArgumentException("No path configuration found for type: " + type));
|
||||||
|
}
|
||||||
|
private S3ConfigEntity getDocumentPathForOther(DocOtherSourceTypeEnum type) {
|
||||||
|
|
||||||
|
return s3ConfigRepository.getPathByType(type.name()).orElseThrow(() -> new IllegalArgumentException("No path configuration found for type: " + type));
|
||||||
|
}
|
||||||
|
public String getBucketNameForOtherType(DocOtherSourceTypeEnum type){
|
||||||
|
return s3ConfigRepository.getBucketNameByType(type);
|
||||||
|
}
|
||||||
|
public String getBucketNameForCallAppType(DocumentSourceTypeEnum type){
|
||||||
|
return s3ConfigRepository.getBucketNameByType(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "s3_path_configuration")
|
||||||
|
@Data
|
||||||
|
public class S3ConfigEntity extends BaseEntity {
|
||||||
|
|
||||||
|
@Column(name = "TYPE")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Column(name = "PATH")
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
@Column(name = "BUCKET_NAME")
|
||||||
|
private String bucketName;
|
||||||
|
|
||||||
|
@Column(name = "PARENT_FOLDER")
|
||||||
|
private String parentFolder;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package net.gepafin.tendermanagement.enums;
|
||||||
|
|
||||||
|
public enum DocOtherSourceTypeEnum {
|
||||||
|
USER_SIGNED_DOCUMENT("USER_SIGNED_DOCUMENT"),
|
||||||
|
USER_DELEGATION("USER_DELEGATION"),
|
||||||
|
TEMPLATE("TEMPLATE");
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
DocOtherSourceTypeEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class S3ConfigReq {
|
||||||
|
@NotNull
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private String bucketName;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private String parentFolder;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class S3ConfigBean {
|
||||||
|
private String path;
|
||||||
|
private String type;
|
||||||
|
private String bucketName;
|
||||||
|
private String parentFolder;
|
||||||
|
}
|
||||||
@@ -40,5 +40,6 @@ public interface ApplicationRepository extends JpaRepository<ApplicationEntity,
|
|||||||
|
|
||||||
List<ApplicationEntity> findByCompanyIdAndUserIdAndIsDeletedFalse(Long companyId,Long userId);
|
List<ApplicationEntity> findByCompanyIdAndUserIdAndIsDeletedFalse(Long companyId,Long userId);
|
||||||
|
|
||||||
|
@Query("SELECT a.call.id FROM ApplicationEntity a WHERE a.id = :id")
|
||||||
|
Long findCallIdById(@Param("id") Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,24 @@
|
|||||||
package net.gepafin.tendermanagement.repositories;
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import net.gepafin.tendermanagement.entities.ApplicationSignedDocumentEntity;
|
import net.gepafin.tendermanagement.entities.ApplicationSignedDocumentEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface ApplicationSignedDocumentRepository extends JpaRepository<ApplicationSignedDocumentEntity, Long> {
|
public interface ApplicationSignedDocumentRepository extends JpaRepository<ApplicationSignedDocumentEntity, Long> {
|
||||||
|
|
||||||
ApplicationSignedDocumentEntity findByApplicationIdAndStatus(Long applicationId, String status);
|
ApplicationSignedDocumentEntity findByApplicationIdAndStatus(Long applicationId, String status);
|
||||||
|
|
||||||
|
Long findApplicationIdById(Long id);
|
||||||
|
|
||||||
|
@Query("SELECT a.id FROM ApplicationSignedDocumentEntity d JOIN d.application a WHERE d.id = :id")
|
||||||
|
List<Long> findApplicationIdIdsById(@Param("id") Long id);
|
||||||
|
|
||||||
|
@Query("SELECT d FROM ApplicationSignedDocumentEntity d WHERE d.status = :status")
|
||||||
|
List<ApplicationSignedDocumentEntity> findAllByIsStatus(@Param("status")String status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,5 +25,7 @@ public interface DocumentRepository extends JpaRepository<DocumentEntity, Long>
|
|||||||
|
|
||||||
Optional<DocumentEntity> findByIdAndSourceIdAndSourceAndIsDeletedFalse(Long id, Long sourceId, String source);
|
Optional<DocumentEntity> findByIdAndSourceIdAndSourceAndIsDeletedFalse(Long id, Long sourceId, String source);
|
||||||
|
|
||||||
|
@Query("SELECT d FROM DocumentEntity d WHERE d.isDeleted = false")
|
||||||
|
List<DocumentEntity> findAllByIsDeleteFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.S3ConfigEntity;
|
||||||
|
import net.gepafin.tendermanagement.enums.DocOtherSourceTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface S3ConfigRepository extends JpaRepository<S3ConfigEntity, Long> {
|
||||||
|
Optional<S3ConfigEntity> getPathByType(String type);
|
||||||
|
|
||||||
|
S3ConfigEntity findS3PathConfigurationById(Long id);
|
||||||
|
|
||||||
|
String getBucketNameByType(DocumentSourceTypeEnum type);
|
||||||
|
|
||||||
|
String getBucketNameByType(DocOtherSourceTypeEnum type);
|
||||||
|
|
||||||
|
@Query("Select s3.parentFolder From S3ConfigEntity s3 Where s3.type = :s")
|
||||||
|
String getPathByTypeOther(String s);
|
||||||
|
}
|
||||||
@@ -2,9 +2,15 @@ package net.gepafin.tendermanagement.repositories;
|
|||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import net.gepafin.tendermanagement.entities.UserCompanyDelegationEntity;
|
import net.gepafin.tendermanagement.entities.UserCompanyDelegationEntity;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface UserCompanyDelegationRepository extends JpaRepository<UserCompanyDelegationEntity, Long> {
|
public interface UserCompanyDelegationRepository extends JpaRepository<UserCompanyDelegationEntity, Long> {
|
||||||
|
|
||||||
UserCompanyDelegationEntity findByUserIdAndCompanyIdAndStatus(Long userId, Long companyId, String status);
|
UserCompanyDelegationEntity findByUserIdAndCompanyIdAndStatus(Long userId, Long companyId, String status);
|
||||||
|
|
||||||
|
@Query("SELECT d FROM UserCompanyDelegationEntity d where d.status = :status")
|
||||||
|
List<UserCompanyDelegationEntity> findAllByStatus(@Param("status") String status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package net.gepafin.tendermanagement.service;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.S3ConfigEntity;
|
||||||
|
import net.gepafin.tendermanagement.model.request.S3ConfigReq;
|
||||||
|
import net.gepafin.tendermanagement.model.response.S3ConfigBean;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public interface S3ConfigService {
|
||||||
|
S3ConfigBean addS3Path(S3ConfigReq s3Path);
|
||||||
|
|
||||||
|
Optional<S3ConfigEntity> getS3PathByType(String type);
|
||||||
|
|
||||||
|
S3ConfigEntity deleteS3PathById(Long id);
|
||||||
|
|
||||||
|
S3ConfigBean updateS3PathConfiguration(S3ConfigReq s3PathConfigurationReq, Long id);
|
||||||
|
}
|
||||||
@@ -34,7 +34,7 @@ public class DocumentServiceImpl implements DocumentService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocumentResponseBean updateDocument(HttpServletRequest httpServletRequest, Long documentId, MultipartFile file, DocumentTypeEnum documentTypeEnum) {
|
public DocumentResponseBean updateDocument(HttpServletRequest httpServletRequest, Long documentId, MultipartFile file, DocumentTypeEnum documentTypeEnum) {
|
||||||
return documentDao.updateDocument(documentId,file,documentTypeEnum);
|
return documentDao.updateDocument(documentId, file,documentTypeEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package net.gepafin.tendermanagement.service.impl;
|
||||||
|
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
|
import net.gepafin.tendermanagement.dao.S3ConfigDao;
|
||||||
|
import net.gepafin.tendermanagement.entities.S3ConfigEntity;
|
||||||
|
import net.gepafin.tendermanagement.model.request.S3ConfigReq;
|
||||||
|
import net.gepafin.tendermanagement.model.response.S3ConfigBean;
|
||||||
|
import net.gepafin.tendermanagement.service.S3ConfigService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class S3ConfigServiceImpl implements S3ConfigService {
|
||||||
|
@Autowired
|
||||||
|
S3ConfigDao s3ConfigDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public S3ConfigBean addS3Path(S3ConfigReq s3Path) {
|
||||||
|
|
||||||
|
return s3ConfigDao.addS3Path(s3Path);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Optional<S3ConfigEntity> getS3PathByType(String type) {
|
||||||
|
|
||||||
|
return s3ConfigDao.getS3PathByType(type);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public S3ConfigEntity deleteS3PathById(Long id) {
|
||||||
|
|
||||||
|
return s3ConfigDao.deleteS3PathConfigById(id);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public S3ConfigBean updateS3PathConfiguration(S3ConfigReq s3PathConfigurationReq, Long id) {
|
||||||
|
|
||||||
|
return s3ConfigDao.updateS3PathConfiguration(s3PathConfigurationReq, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
package net.gepafin.tendermanagement.service.impl;
|
||||||
|
|
||||||
|
import com.amazonaws.AmazonServiceException;
|
||||||
|
import com.amazonaws.SdkClientException;
|
||||||
|
import com.amazonaws.services.s3.AmazonS3;
|
||||||
|
import com.amazonaws.services.s3.AmazonS3Client;
|
||||||
|
import com.amazonaws.services.s3.model.GetObjectRequest;
|
||||||
|
import com.amazonaws.services.s3.model.ObjectMetadata;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.gepafin.tendermanagement.dao.S3PathConfig;
|
||||||
|
import net.gepafin.tendermanagement.entities.DocumentEntity;
|
||||||
|
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.ApplicationSignedDocumentRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.DocumentRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class S3ReUploadMigrationService {
|
||||||
|
|
||||||
|
private static final String OLD_BUCKET = "mementoresources";
|
||||||
|
|
||||||
|
private static final String SECURE_KEY = "267163962963";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DocumentRepository documentRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AmazonS3Client s3Client;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private S3PathConfig s3ConfigBean;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationRepository applicationRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationSignedDocumentRepository applicationSignedDocumentRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AmazonS3 amazonS3;
|
||||||
|
|
||||||
|
@Value("${aws.s3.url}")
|
||||||
|
private String s3Url;
|
||||||
|
|
||||||
|
private boolean migrationCompleted = false;
|
||||||
|
|
||||||
|
public String reUploadAndMigrateDocuments(String providedKey) {
|
||||||
|
|
||||||
|
if (migrationCompleted) {
|
||||||
|
return "Migration already completed.";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate the provided key
|
||||||
|
if (!isValidKey(providedKey)) {
|
||||||
|
return "Invalid or missing migration key.";
|
||||||
|
}
|
||||||
|
|
||||||
|
List<DocumentEntity> documents = documentRepository.findAllByIsDeleteFalse();
|
||||||
|
|
||||||
|
if (documents.isEmpty()) {
|
||||||
|
return "No documents found to migrate.";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (DocumentEntity document : documents) {
|
||||||
|
String oldUrl = document.getFilePath(); // This should contain the full URL
|
||||||
|
log.info("Processing {}", oldUrl);
|
||||||
|
|
||||||
|
try {
|
||||||
|
File localFile = downloadFileFromS3(oldUrl);
|
||||||
|
String newKey = generateNewS3Path(document); // Make sure this generates the correct new path
|
||||||
|
String uploadedPath = uploadFileToNewBucket(localFile, newKey);
|
||||||
|
updateDocumentPathAndDeleteOldEntry(document, uploadedPath);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Error processing document {}: {}", document.getId(), e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "Migrated Successfully.";
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isValidKey(String providedKey) {
|
||||||
|
|
||||||
|
return providedKey != null && providedKey.equals(SECURE_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
private File downloadFileFromS3(String fileUrl) throws Exception {
|
||||||
|
|
||||||
|
String key = extractS3KeyFromUrl(fileUrl); // Get the S3 key from the URL
|
||||||
|
File localFile = new File("/tmp/" + extractFileName(key)); // Save file locally
|
||||||
|
|
||||||
|
GetObjectRequest getObjectRequest = new GetObjectRequest(OLD_BUCKET, key); // Use the key
|
||||||
|
|
||||||
|
try (InputStream s3Stream = s3Client.getObject(getObjectRequest).getObjectContent(); FileOutputStream outputStream = new FileOutputStream(localFile)) {
|
||||||
|
s3Stream.transferTo(outputStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("Downloaded file from old S3 bucket: {}", key);
|
||||||
|
return localFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String extractS3KeyFromUrl(String url) {
|
||||||
|
// Assuming the URL structure is consistent
|
||||||
|
return url.replace("https://mementoresources.s3.eu-west-1.amazonaws.com/", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
private String uploadFileToNewBucket(File localFile, String s3Folder) {
|
||||||
|
|
||||||
|
InputStream inputStream = null; // Declare the InputStream here for cleanup
|
||||||
|
try {
|
||||||
|
// Extract file name from the local file
|
||||||
|
String fileName = extractFileName(localFile.getAbsolutePath()); // Get the file name
|
||||||
|
String path = s3Folder + "/" + fileName; // Construct the S3 path
|
||||||
|
|
||||||
|
// Create InputStream from the local file
|
||||||
|
inputStream = new FileInputStream(localFile);
|
||||||
|
|
||||||
|
// Set up object metadata
|
||||||
|
ObjectMetadata objectMetadata = new ObjectMetadata();
|
||||||
|
objectMetadata.setContentType("application/octet-stream");
|
||||||
|
objectMetadata.setContentLength(localFile.length());
|
||||||
|
|
||||||
|
// Upload to S3
|
||||||
|
s3Client.putObject(OLD_BUCKET, path, inputStream, objectMetadata);
|
||||||
|
|
||||||
|
// Construct the full S3 URL
|
||||||
|
String fullUrl = String.format("https://%s.s3.%s.amazonaws.com/%s", OLD_BUCKET, "eu-west-1", path);
|
||||||
|
log.info("File '{}' uploaded successfully to Amazon S3 with URL: {}", fileName, fullUrl);
|
||||||
|
return fullUrl;
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("IOException occurred during file upload for '{}': {}", localFile.getName(), e.getMessage());
|
||||||
|
throw new RuntimeException("Upload failed for: " + s3Folder + "/" + localFile.getName(), e);
|
||||||
|
} catch (AmazonServiceException e) {
|
||||||
|
log.error("Amazon service exception while uploading file '{}': {}", localFile.getName(), e.getMessage());
|
||||||
|
throw new RuntimeException("Upload failed for: " + s3Folder + "/" + localFile.getName(), e);
|
||||||
|
} catch (SdkClientException e) {
|
||||||
|
log.error("SDK client exception while uploading file '{}': {}", localFile.getName(), e.getMessage());
|
||||||
|
throw new RuntimeException("Upload failed for: " + s3Folder + "/" + localFile.getName(), e);
|
||||||
|
} finally {
|
||||||
|
// Close InputStream if it was opened
|
||||||
|
if (inputStream != null) {
|
||||||
|
try {
|
||||||
|
inputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.warn("Failed to close InputStream for file '{}': {}", localFile.getName(), e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String generateNewS3Path(DocumentEntity document) {
|
||||||
|
|
||||||
|
DocumentSourceTypeEnum sourceType = DocumentSourceTypeEnum.valueOf(document.getSource());
|
||||||
|
Long callId;
|
||||||
|
|
||||||
|
if (sourceType.equals(DocumentSourceTypeEnum.CALL)) {
|
||||||
|
return s3ConfigBean.generateDocumentPath(sourceType, document.getSourceId(), 0L);
|
||||||
|
} else {
|
||||||
|
callId = applicationRepository.findCallIdById(document.getSourceId());
|
||||||
|
return s3ConfigBean.generateDocumentPath(sourceType, callId, document.getSourceId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String extractFileName(String filePath) {
|
||||||
|
|
||||||
|
String[] parts = filePath.split("/");
|
||||||
|
return parts[parts.length - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void updateDocumentPathAndDeleteOldEntry(DocumentEntity document, String newPath) {
|
||||||
|
|
||||||
|
String fileName = extractFileName(newPath);
|
||||||
|
DocumentEntity newDocument = new DocumentEntity();
|
||||||
|
newDocument.setFilePath(newPath);
|
||||||
|
newDocument.setSource(document.getSource());
|
||||||
|
newDocument.setType(document.getType());
|
||||||
|
newDocument.setIsDeleted(false);
|
||||||
|
newDocument.setSourceId(document.getSourceId());
|
||||||
|
newDocument.setFileName(fileName);
|
||||||
|
|
||||||
|
documentRepository.save(newDocument);
|
||||||
|
documentRepository.delete(document);
|
||||||
|
|
||||||
|
log.info("Migrated document ID: {} to new path: {}", document.getId(), newPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,261 @@
|
|||||||
|
package net.gepafin.tendermanagement.service.impl;
|
||||||
|
|
||||||
|
import com.amazonaws.AmazonServiceException;
|
||||||
|
import com.amazonaws.SdkClientException;
|
||||||
|
import com.amazonaws.services.s3.AmazonS3Client;
|
||||||
|
import com.amazonaws.services.s3.model.GetObjectRequest;
|
||||||
|
import com.amazonaws.services.s3.model.ObjectMetadata;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.gepafin.tendermanagement.dao.S3PathConfig;
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationSignedDocumentEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.UserCompanyDelegationEntity;
|
||||||
|
import net.gepafin.tendermanagement.enums.DocOtherSourceTypeEnum;
|
||||||
|
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.ApplicationSignedDocumentRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.S3ConfigRepository;
|
||||||
|
import net.gepafin.tendermanagement.repositories.UserCompanyDelegationRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class UserSignedAndDelegationServiceImpl {
|
||||||
|
private static final String OLD_BUCKET = "mementoresources";
|
||||||
|
|
||||||
|
private static final String NEW_BUCKET = "mementoresources";
|
||||||
|
|
||||||
|
private static final String SECURE_KEY = "267163962963";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserCompanyDelegationRepository userCompanyDelegationRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AmazonS3Client s3Client;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private S3PathConfig s3ConfigBean;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationSignedDocumentRepository applicationSignedDocumentRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ApplicationRepository applicationRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
S3ConfigRepository s3ConfigRepository;
|
||||||
|
|
||||||
|
@Value("${aws.s3.url}")
|
||||||
|
private String s3Url;
|
||||||
|
|
||||||
|
private boolean migrationCompleted = false;
|
||||||
|
|
||||||
|
|
||||||
|
public String migrateUserDelegatedDocuments(String providedKey) {
|
||||||
|
|
||||||
|
if (migrationCompleted) {
|
||||||
|
return "Migration already completed.";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate the provided key
|
||||||
|
if (isValidKey(providedKey)) {
|
||||||
|
return "Invalid or missing migration key.";
|
||||||
|
}
|
||||||
|
|
||||||
|
List<UserCompanyDelegationEntity> documents = userCompanyDelegationRepository.findAllByStatus("ACTIVE");
|
||||||
|
|
||||||
|
if (documents.isEmpty()) {
|
||||||
|
return "No documents found to migrate.";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (UserCompanyDelegationEntity document : documents) {
|
||||||
|
String oldUrl = document.getFilePath();
|
||||||
|
log.info("Processing user designated document: {}", oldUrl);
|
||||||
|
|
||||||
|
try {
|
||||||
|
File localFile = downloadFileFromS3(oldUrl);
|
||||||
|
String newKey = generateNewS3PathForDelegationDoc();
|
||||||
|
String uploadedPath = uploadFileToNewBucket(localFile, newKey);
|
||||||
|
updateDelegatedDocumentPathAndDeleteOldEntry(document, uploadedPath);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Error processing user designated document {}: {}", document.getId(), e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "Migrated";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String migrateUserSignedDocuments(String providedKey) {
|
||||||
|
|
||||||
|
if (migrationCompleted) {
|
||||||
|
return "Migration already completed.";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate the provided key
|
||||||
|
if (isValidKey(providedKey)) {
|
||||||
|
return "Invalid or missing migration key.";
|
||||||
|
}
|
||||||
|
List<ApplicationSignedDocumentEntity> documents = applicationSignedDocumentRepository.findAllByIsStatus("ACTIVE");
|
||||||
|
|
||||||
|
if (documents.isEmpty()) {
|
||||||
|
return "No documents found to migrate.";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ApplicationSignedDocumentEntity document : documents) {
|
||||||
|
String oldUrl = document.getFilePath();
|
||||||
|
log.info("Processing user signed document: {}", oldUrl);
|
||||||
|
|
||||||
|
try {
|
||||||
|
File localFile = downloadFileFromS3(oldUrl);
|
||||||
|
String newKey = generateNewS3PathForUserSignedDoc(document);
|
||||||
|
String uploadedPath = uploadFileToNewBucket(localFile, newKey);
|
||||||
|
updateDocumentPathAndDeleteOldEntry(document, uploadedPath);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Error processing user signed document {}: {}", document.getId(), e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "Migrated.";
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isValidKey(String providedKey) {
|
||||||
|
|
||||||
|
return providedKey == null || !providedKey.equals(SECURE_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String generateNewS3PathForDelegationDoc() {
|
||||||
|
|
||||||
|
return s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.USER_DELEGATION, 0L, 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String generateNewS3PathForUserSignedDoc(ApplicationSignedDocumentEntity document) {
|
||||||
|
// Fetch the list of application IDs associated with the document
|
||||||
|
List<Long> applicationIds = applicationSignedDocumentRepository.findApplicationIdIdsById(document.getId());
|
||||||
|
List<String> paths = new ArrayList<>();
|
||||||
|
|
||||||
|
// Loop through the application IDs and generate paths
|
||||||
|
for (Long applicationId : applicationIds) {
|
||||||
|
Long callId = applicationRepository.findCallIdById(applicationId);
|
||||||
|
|
||||||
|
// Construct the path for the current application and call ID
|
||||||
|
String newPath = String.format("%s/call/call_%d/application/application_%d/user_signed_document", s3ConfigRepository.getPathByTypeOther(
|
||||||
|
String.valueOf(DocOtherSourceTypeEnum.USER_SIGNED_DOCUMENT)) , callId, applicationId);
|
||||||
|
|
||||||
|
log.info("Generated new S3 path: {}", newPath);
|
||||||
|
paths.add(newPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.join(",", paths);
|
||||||
|
}
|
||||||
|
|
||||||
|
private File downloadFileFromS3(String fileUrl) throws Exception {
|
||||||
|
|
||||||
|
String key = extractS3KeyFromUrl(fileUrl);
|
||||||
|
File localFile = new File("/tmp/" + extractFileName(key));
|
||||||
|
|
||||||
|
GetObjectRequest getObjectRequest = new GetObjectRequest(OLD_BUCKET, key);
|
||||||
|
|
||||||
|
try (InputStream s3Stream = s3Client.getObject(getObjectRequest).getObjectContent(); FileOutputStream outputStream = new FileOutputStream(localFile)) {
|
||||||
|
s3Stream.transferTo(outputStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("Downloaded file from old S3 bucket: {}", key);
|
||||||
|
return localFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String extractS3KeyFromUrl(String url) {
|
||||||
|
|
||||||
|
return url.replace("https://mementoresources.s3.eu-west-1.amazonaws.com/", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
private String uploadFileToNewBucket(File localFile, String s3Path) {
|
||||||
|
|
||||||
|
InputStream inputStream = null;
|
||||||
|
try {
|
||||||
|
String fileName = extractFileName(localFile.getAbsolutePath()); // Extract file name
|
||||||
|
String fullPath = String.format("%s/%s", s3Path, fileName); // Construct full path
|
||||||
|
|
||||||
|
inputStream = new FileInputStream(localFile); // Create InputStream
|
||||||
|
|
||||||
|
// Set metadata for the file
|
||||||
|
ObjectMetadata objectMetadata = new ObjectMetadata();
|
||||||
|
objectMetadata.setContentLength(localFile.length());
|
||||||
|
objectMetadata.setContentType("application/octet-stream");
|
||||||
|
|
||||||
|
// Upload the file to S3 with the constructed path
|
||||||
|
s3Client.putObject(NEW_BUCKET, fullPath, inputStream, objectMetadata);
|
||||||
|
|
||||||
|
// Construct the full S3 URL for the uploaded file
|
||||||
|
String fullUrl = String.format("https://%s.s3.%s.amazonaws.com/%s", NEW_BUCKET, "eu-west-1", fullPath);
|
||||||
|
log.info("File '{}' uploaded successfully to Amazon S3 with URL: {}", fileName, fullUrl);
|
||||||
|
return fullUrl;
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("IOException occurred during file upload for '{}': {}", localFile.getName(), e.getMessage());
|
||||||
|
throw new RuntimeException("Upload failed for: " + localFile, e);
|
||||||
|
} catch (AmazonServiceException e) {
|
||||||
|
log.error("Amazon service exception while uploading file '{}': {}", localFile.getName(), e.getMessage());
|
||||||
|
throw new RuntimeException("Upload failed for: " + localFile, e);
|
||||||
|
} catch (SdkClientException e) {
|
||||||
|
log.error("SDK client exception while uploading file '{}': {}", localFile.getName(), e.getMessage());
|
||||||
|
throw new RuntimeException("Upload failed for: " + localFile, e);
|
||||||
|
} finally {
|
||||||
|
if (inputStream != null) {
|
||||||
|
try {
|
||||||
|
inputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.warn("Failed to close InputStream for file '{}': {}", localFile.getName(), e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String extractFileName(String filePath) {
|
||||||
|
|
||||||
|
String[] parts = filePath.split("/");
|
||||||
|
return parts[parts.length - 1];
|
||||||
|
}
|
||||||
|
private String extractFileNameFromPath(String path) {
|
||||||
|
|
||||||
|
return path.substring(path.lastIndexOf('/') + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateDocumentPathAndDeleteOldEntry(ApplicationSignedDocumentEntity document, String newPath) {
|
||||||
|
|
||||||
|
ApplicationSignedDocumentEntity newDocument = new ApplicationSignedDocumentEntity();
|
||||||
|
String fileName = extractFileNameFromPath(newPath);
|
||||||
|
newDocument.setFilePath(newPath);
|
||||||
|
newDocument.setFileName(fileName);
|
||||||
|
newDocument.setApplication(document.getApplication());
|
||||||
|
newDocument.setStatus("ACTIVE");
|
||||||
|
|
||||||
|
applicationSignedDocumentRepository.save(newDocument);
|
||||||
|
applicationSignedDocumentRepository.delete(document);
|
||||||
|
|
||||||
|
log.info("Migrated document ID: {} to new path: {}", document.getId(), newPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateDelegatedDocumentPathAndDeleteOldEntry(UserCompanyDelegationEntity document, String newPath) {
|
||||||
|
|
||||||
|
String fileName = extractFileNameFromPath(newPath);
|
||||||
|
UserCompanyDelegationEntity newDocument = new UserCompanyDelegationEntity();
|
||||||
|
newDocument.setFilePath(newPath);
|
||||||
|
newDocument.setFileName(fileName);
|
||||||
|
newDocument.setBeneficiaryId(document.getBeneficiaryId());
|
||||||
|
newDocument.setUserId(document.getUserId());
|
||||||
|
newDocument.setCompanyId(document.getCompanyId());
|
||||||
|
newDocument.setStatus("ACTIVE");
|
||||||
|
|
||||||
|
userCompanyDelegationRepository.save(newDocument);
|
||||||
|
userCompanyDelegationRepository.delete(document);
|
||||||
|
|
||||||
|
log.info("Migrated document ID: {} to new path: {}", document.getId(), newPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package net.gepafin.tendermanagement.web.rest.api;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import net.gepafin.tendermanagement.entities.S3ConfigEntity;
|
||||||
|
import net.gepafin.tendermanagement.model.request.S3ConfigReq;
|
||||||
|
import net.gepafin.tendermanagement.model.response.S3ConfigBean;
|
||||||
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Validated
|
||||||
|
public interface S3ConfigApi {
|
||||||
|
|
||||||
|
@Operation(summary = "Api to create S3Path structure.", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@PostMapping(value = "", produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<S3ConfigBean>> addS3Path(@Valid @RequestBody S3ConfigReq s3pathReq);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to get S3Path structure. by type", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@GetMapping(value = "", produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<Optional<S3ConfigEntity>>> getS3PathByType(@Valid @Param(value = "type") String type);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to delete S3Path structure. by id", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@DeleteMapping(value = "", produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<S3ConfigEntity>> deleteS3PathConfigById(@Valid @Param(value = "id") Long id);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to update S3Path structure. by id", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@PutMapping(value = "", produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<S3ConfigBean>> updateS3PathConfigById(@Valid @RequestBody S3ConfigReq s3PathConfigurationReq, @Param(value = "id") Long id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package net.gepafin.tendermanagement.web.rest.api;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
|
||||||
|
@Validated
|
||||||
|
public interface S3MigrationApi {
|
||||||
|
|
||||||
|
@Operation(summary = "Api to migrate S3 doc to db and update s3 files as per specified folder.", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@PutMapping(value = "/{key}", produces = { "application/json" })
|
||||||
|
String reUploadAndMigrateDocuments(@Parameter(description = "The secret key", required = true) @PathVariable("key") String key);
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package net.gepafin.tendermanagement.web.rest.api;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
|
@Validated
|
||||||
|
public interface UserSignedAndDelegationApi {
|
||||||
|
@Operation(summary = "Api to migrate S3 doc to db and user-delegated folder", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@GetMapping(value = "/{key}", produces = { "application/json" })
|
||||||
|
String migrateUserDelegatedDocuments(@Parameter(description = "The secret key", required = true) @PathVariable("key") String key);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to migrate S3 doc to user-signed.", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@PostMapping(value = "/{key}", produces = { "application/json" })
|
||||||
|
String migrateUserSignedDocuments(@Parameter(description = "The secret key", required = true) @PathVariable("key") String key);
|
||||||
|
}
|
||||||
@@ -31,7 +31,7 @@ DocumentApiController implements DocumentApi {
|
|||||||
public ResponseEntity<Response<List<DocumentResponseBean>>> uploadFile(HttpServletRequest httpServletRequest, Long sourceId, DocumentSourceTypeEnum sourceType,
|
public ResponseEntity<Response<List<DocumentResponseBean>>> uploadFile(HttpServletRequest httpServletRequest, Long sourceId, DocumentSourceTypeEnum sourceType,
|
||||||
List<MultipartFile> files, DocumentTypeEnum fileType) {
|
List<MultipartFile> files, DocumentTypeEnum fileType) {
|
||||||
try {
|
try {
|
||||||
List<DocumentResponseBean> responseBeans = documentService.uploadFile(files, sourceId,sourceType, fileType);
|
List<DocumentResponseBean> responseBeans = documentService.uploadFile(files, sourceId, sourceType, fileType);
|
||||||
return ResponseEntity.status(HttpStatus.CREATED)
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
.body(new Response<List<DocumentResponseBean>>(responseBeans, Status.SUCCESS, Translator.toLocale(GepafinConstant.FILES_UPLOADED_MSG)));
|
.body(new Response<List<DocumentResponseBean>>(responseBeans, Status.SUCCESS, Translator.toLocale(GepafinConstant.FILES_UPLOADED_MSG)));
|
||||||
} catch (CustomValidationException ex) {
|
} catch (CustomValidationException ex) {
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import net.gepafin.tendermanagement.entities.S3ConfigEntity;
|
||||||
|
import net.gepafin.tendermanagement.model.request.S3ConfigReq;
|
||||||
|
import net.gepafin.tendermanagement.model.response.S3ConfigBean;
|
||||||
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
|
import net.gepafin.tendermanagement.service.S3ConfigService;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.S3ConfigApi;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("${openapi.gepafin.base-path:/v1/s3-path-config}")
|
||||||
|
public class S3ConfigController implements S3ConfigApi {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(S3ConfigController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
S3ConfigService s3PathService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<S3ConfigBean>> addS3Path(S3ConfigReq s3pathReq) {
|
||||||
|
|
||||||
|
log.info("Request Body : {}, {}, {}", s3pathReq.getPath(), s3pathReq.getType(), s3pathReq.getBucketName());
|
||||||
|
S3ConfigBean s3Path = s3PathService.addS3Path(s3pathReq);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED).body(new Response<S3ConfigBean>(s3Path, Status.SUCCESS, Translator.toLocale(GepafinConstant.ADDED_S3_PATH_STRUCTURE)));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<Optional<S3ConfigEntity>>> getS3PathByType(String type) {
|
||||||
|
|
||||||
|
log.info("Request to get S3Path by type {}", type);
|
||||||
|
Optional<S3ConfigEntity> s3Path = s3PathService.getS3PathByType(type);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<Optional<S3ConfigEntity>>(s3Path, Status.SUCCESS, Translator.toLocale(GepafinConstant.S3_PATH_STRUCTURE_BY_TYPE)));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<S3ConfigEntity>> deleteS3PathConfigById(Long id) {
|
||||||
|
log.info("Request to delete S3Path by Id {}", id);
|
||||||
|
S3ConfigEntity deletedS3PathConfig = s3PathService.deleteS3PathById(id);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<S3ConfigEntity>(deletedS3PathConfig, Status.SUCCESS, Translator.toLocale(GepafinConstant.S3_PATH_DELETE_MSG)));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<S3ConfigBean>> updateS3PathConfigById(S3ConfigReq s3PathConfigurationReq, Long id) {
|
||||||
|
S3ConfigBean updatedS3PathConfiguration = s3PathService.updateS3PathConfiguration(s3PathConfigurationReq, id);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<S3ConfigBean>(updatedS3PathConfiguration, Status.SUCCESS, Translator.toLocale(GepafinConstant.S3_PATH_CONFIG_UPDATE_MSG)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.service.impl.S3ReUploadMigrationService;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.S3MigrationApi;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("${openapi.gepafin.base-path:/v1/s3-migration}")
|
||||||
|
public class S3MigrationApiController implements S3MigrationApi {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
S3ReUploadMigrationService s3MigrationService;
|
||||||
|
@Override
|
||||||
|
public String reUploadAndMigrateDocuments(String providedKey) {
|
||||||
|
return s3MigrationService.reUploadAndMigrateDocuments(providedKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.service.impl.UserSignedAndDelegationServiceImpl;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.UserSignedAndDelegationApi;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("${openapi.gepafin.base-path:/v1/s3-user-signed-and-delegation-migration}")
|
||||||
|
public class S3UserSignedAndDelegationMigrationController implements UserSignedAndDelegationApi {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
UserSignedAndDelegationServiceImpl userSignedAndDelegationService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String migrateUserDelegatedDocuments(String providedKey) {
|
||||||
|
return userSignedAndDelegationService.migrateUserDelegatedDocuments(providedKey);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String migrateUserSignedDocuments(String providedKey) {
|
||||||
|
return userSignedAndDelegationService.migrateUserSignedDocuments(providedKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -250,7 +250,8 @@
|
|||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
<constraints nullable="true"/></column>
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
</createTable>
|
</createTable>
|
||||||
|
|
||||||
<createTable tableName="lookup_data">
|
<createTable tableName="lookup_data">
|
||||||
@@ -270,7 +271,8 @@
|
|||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
<constraints nullable="true"/></column>
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
</createTable>
|
</createTable>
|
||||||
|
|
||||||
<createTable tableName="call_target_audience_checklist">
|
<createTable tableName="call_target_audience_checklist">
|
||||||
@@ -279,10 +281,12 @@
|
|||||||
primaryKeyName="call_target_audience_checklist_pkey"/>
|
primaryKeyName="call_target_audience_checklist_pkey"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="call_id" type="INTEGER">
|
<column name="call_id" type="INTEGER">
|
||||||
<constraints nullable="false" foreignKeyName="fk_call_call_target_audience_checklist" references="call(id)"/>
|
<constraints nullable="false" foreignKeyName="fk_call_call_target_audience_checklist"
|
||||||
|
references="call(id)"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="lookup_data_id" type="INTEGER">
|
<column name="lookup_data_id" type="INTEGER">
|
||||||
<constraints nullable="false" foreignKeyName="fk_lookup_data_call_target_audience_checklist" references="lookup_data(id)"/>
|
<constraints nullable="false" foreignKeyName="fk_lookup_data_call_target_audience_checklist"
|
||||||
|
references="lookup_data(id)"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="is_validated" type="BOOLEAN">
|
<column name="is_validated" type="BOOLEAN">
|
||||||
</column>
|
</column>
|
||||||
@@ -290,14 +294,16 @@
|
|||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
<constraints nullable="true"/></column>
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
</createTable>
|
</createTable>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
<changeSet id="22-08-2024_1" author="Harish Bagora">
|
<changeSet id="22-08-2024_1" author="Harish Bagora">
|
||||||
<insert tableName="region">
|
<insert tableName="region">
|
||||||
<column name="region_name" value="Italy"/>
|
<column name="region_name" value="Italy"/>
|
||||||
<column name="description" value="A beautiful country in Southern Europe known for its art, culture, and history."/>
|
<column name="description"
|
||||||
|
value="A beautiful country in Southern Europe known for its art, culture, and history."/>
|
||||||
<column name="created_date" value="2024-08-14 00:00:00"/>
|
<column name="created_date" value="2024-08-14 00:00:00"/>
|
||||||
<column name="updated_date" value="2024-08-14 00:00:00"/>
|
<column name="updated_date" value="2024-08-14 00:00:00"/>
|
||||||
<column name="country" value="Italy"/>
|
<column name="country" value="Italy"/>
|
||||||
@@ -318,7 +324,8 @@
|
|||||||
<insert tableName="role">
|
<insert tableName="role">
|
||||||
<column name="role_name" value="beneficiary"/>
|
<column name="role_name" value="beneficiary"/>
|
||||||
<column name="role_type" value="ROLE_BENEFICIARY"/>
|
<column name="role_type" value="ROLE_BENEFICIARY"/>
|
||||||
<column name="description" value="Companies or individuals looking for financing opportunities. They can view, search, and apply to available calls."/>
|
<column name="description"
|
||||||
|
value="Companies or individuals looking for financing opportunities. They can view, search, and apply to available calls."/>
|
||||||
<column name="created_date" value="2024-08-14 00:00:00"/>
|
<column name="created_date" value="2024-08-14 00:00:00"/>
|
||||||
<column name="updated_date" value="2024-08-14 00:00:00"/>
|
<column name="updated_date" value="2024-08-14 00:00:00"/>
|
||||||
<column name="permissions" value="VIEW_CALLS, APPLY_CALLS"/>
|
<column name="permissions" value="VIEW_CALLS, APPLY_CALLS"/>
|
||||||
@@ -329,7 +336,8 @@
|
|||||||
<insert tableName="role">
|
<insert tableName="role">
|
||||||
<column name="role_name" value="super admin"/>
|
<column name="role_name" value="super admin"/>
|
||||||
<column name="role_type" value="ROLE_SUPER_ADMIN"/>
|
<column name="role_type" value="ROLE_SUPER_ADMIN"/>
|
||||||
<column name="description" value="Manages the creation and publication of tenders and administers internal system users."/>
|
<column name="description"
|
||||||
|
value="Manages the creation and publication of tenders and administers internal system users."/>
|
||||||
<column name="created_date" value="2024-08-14 00:00:00"/>
|
<column name="created_date" value="2024-08-14 00:00:00"/>
|
||||||
<column name="updated_date" value="2024-08-14 00:00:00"/>
|
<column name="updated_date" value="2024-08-14 00:00:00"/>
|
||||||
<column name="permissions" value="MANAGE_TENDERS, MANAGE_USERS"/>
|
<column name="permissions" value="MANAGE_TENDERS, MANAGE_USERS"/>
|
||||||
@@ -340,7 +348,8 @@
|
|||||||
<insert tableName="role">
|
<insert tableName="role">
|
||||||
<column name="role_name" value="pre instructor"/>
|
<column name="role_name" value="pre instructor"/>
|
||||||
<column name="role_type" value="ROLE_PRE_INSTRUCTOR"/>
|
<column name="role_type" value="ROLE_PRE_INSTRUCTOR"/>
|
||||||
<column name="description" value="They evaluate the applications sent by beneficiaries and manage the preliminary relief process."/>
|
<column name="description"
|
||||||
|
value="They evaluate the applications sent by beneficiaries and manage the preliminary relief process."/>
|
||||||
<column name="created_date" value="2024-08-14 00:00:00"/>
|
<column name="created_date" value="2024-08-14 00:00:00"/>
|
||||||
<column name="updated_date" value="2024-08-14 00:00:00"/>
|
<column name="updated_date" value="2024-08-14 00:00:00"/>
|
||||||
<column name="permissions" value="EVALUATE_APPLICATIONS, MANAGE_PRELIMINARY_RELIEF"/>
|
<column name="permissions" value="EVALUATE_APPLICATIONS, MANAGE_PRELIMINARY_RELIEF"/>
|
||||||
@@ -351,7 +360,8 @@
|
|||||||
<insert tableName="role">
|
<insert tableName="role">
|
||||||
<column name="role_name" value="gepafin operator"/>
|
<column name="role_name" value="gepafin operator"/>
|
||||||
<column name="role_type" value="ROLE_GEPAFIN_OPERATOR"/>
|
<column name="role_type" value="ROLE_GEPAFIN_OPERATOR"/>
|
||||||
<column name="description" value="They manage the subsequent phases of the evaluation after the pre-investigation."/>
|
<column name="description"
|
||||||
|
value="They manage the subsequent phases of the evaluation after the pre-investigation."/>
|
||||||
<column name="created_date" value="2024-08-14 00:00:00"/>
|
<column name="created_date" value="2024-08-14 00:00:00"/>
|
||||||
<column name="updated_date" value="2024-08-14 00:00:00"/>
|
<column name="updated_date" value="2024-08-14 00:00:00"/>
|
||||||
<column name="permissions" value="MANAGE_SUBSEQUENT_PHASES"/>
|
<column name="permissions" value="MANAGE_SUBSEQUENT_PHASES"/>
|
||||||
@@ -416,7 +426,8 @@
|
|||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
<constraints nullable="true"/></column>
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
</createTable>
|
</createTable>
|
||||||
<createTable tableName="form_template">
|
<createTable tableName="form_template">
|
||||||
<column name="id" type="INTEGER" autoIncrement="true">
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
@@ -432,7 +443,8 @@
|
|||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
<constraints nullable="true"/></column>
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
</createTable>
|
</createTable>
|
||||||
<createTable tableName="form_field">
|
<createTable tableName="form_field">
|
||||||
<column name="id" type="INTEGER" autoIncrement="true">
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
@@ -454,22 +466,22 @@
|
|||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
<constraints nullable="true"/></column>
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
</createTable>
|
</createTable>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<changeSet id="27-08-2024_1" author="Rajesh Khore">
|
<changeSet id="27-08-2024_1" author="Rajesh Khore">
|
||||||
<dropColumn tableName="EVALUATION_CRITERIA"
|
<dropColumn tableName="EVALUATION_CRITERIA"
|
||||||
columnName="name" />
|
columnName="name"/>
|
||||||
<dropColumn tableName="EVALUATION_CRITERIA"
|
<dropColumn tableName="EVALUATION_CRITERIA"
|
||||||
columnName="description" />
|
columnName="description"/>
|
||||||
<addColumn tableName="EVALUATION_CRITERIA">
|
<addColumn tableName="EVALUATION_CRITERIA">
|
||||||
<column name="lookup_data_id" type="INTEGER">
|
<column name="lookup_data_id" type="INTEGER">
|
||||||
<constraints nullable="false"
|
<constraints nullable="false"
|
||||||
foreignKeyName="fk_lookup_data_evaluation_criteria"
|
foreignKeyName="fk_lookup_data_evaluation_criteria"
|
||||||
references="lookup_data(id)" />
|
references="lookup_data(id)"/>
|
||||||
</column>
|
</column>
|
||||||
</addColumn>
|
</addColumn>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
@@ -507,7 +519,7 @@
|
|||||||
</changeSet>
|
</changeSet>
|
||||||
<changeSet id="30-08-2024_1" author="Rajesh Khore">
|
<changeSet id="30-08-2024_1" author="Rajesh Khore">
|
||||||
<sqlFile dbms="postgresql"
|
<sqlFile dbms="postgresql"
|
||||||
path="db/dump/inserted_form_field_data_30_08_2024.sql" />
|
path="db/dump/inserted_form_field_data_30_08_2024.sql"/>
|
||||||
<sql dbms="postgresql">select
|
<sql dbms="postgresql">select
|
||||||
setval('gepafin_schema.form_field_id_seq', (select
|
setval('gepafin_schema.form_field_id_seq', (select
|
||||||
max(id)+1
|
max(id)+1
|
||||||
@@ -530,14 +542,14 @@
|
|||||||
<column name="lookup_data_id" type="INTEGER">
|
<column name="lookup_data_id" type="INTEGER">
|
||||||
<constraints nullable="false"
|
<constraints nullable="false"
|
||||||
foreignKeyName="fk_lookup_data_faq"
|
foreignKeyName="fk_lookup_data_faq"
|
||||||
references="lookup_data(id)" />
|
references="lookup_data(id)"/>
|
||||||
</column>
|
</column>
|
||||||
</addColumn>
|
</addColumn>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
<changeSet id="02-09-2024_1" author="Rajesh Khore">
|
<changeSet id="02-09-2024_1" author="Rajesh Khore">
|
||||||
<dropColumn tableName="FORM"
|
<dropColumn tableName="FORM"
|
||||||
columnName="order_no" />
|
columnName="order_no"/>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
<changeSet id="03-09-2024_1" author="Rajesh Khore">
|
<changeSet id="03-09-2024_1" author="Rajesh Khore">
|
||||||
@@ -545,14 +557,14 @@
|
|||||||
TRUNCATE TABLE FORM_FIELD RESTART IDENTITY;
|
TRUNCATE TABLE FORM_FIELD RESTART IDENTITY;
|
||||||
</sql>
|
</sql>
|
||||||
<sqlFile dbms="postgresql"
|
<sqlFile dbms="postgresql"
|
||||||
path="db/dump/update_form_field_data_04_09_2024.sql" />
|
path="db/dump/update_form_field_data_04_09_2024.sql"/>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
<changeSet id="04-09-2024_1" author="Rajesh Khore">
|
<changeSet id="04-09-2024_1" author="Rajesh Khore">
|
||||||
<dropColumn tableName="FAQ" columnName="question_short" />
|
<dropColumn tableName="FAQ" columnName="question_short"/>
|
||||||
<dropColumn tableName="FAQ" columnName="question" />
|
<dropColumn tableName="FAQ" columnName="question"/>
|
||||||
<dropColumn tableName="FAQ" columnName="response_short" />
|
<dropColumn tableName="FAQ" columnName="response_short"/>
|
||||||
<dropColumn tableName="FAQ" columnName="lookup_data_id" />
|
<dropColumn tableName="FAQ" columnName="lookup_data_id"/>
|
||||||
<addColumn tableName="FAQ">
|
<addColumn tableName="FAQ">
|
||||||
<column name="title" type="TEXT"/>
|
<column name="title" type="TEXT"/>
|
||||||
<column name="value" type="TEXT"/>
|
<column name="value" type="TEXT"/>
|
||||||
@@ -586,7 +598,8 @@
|
|||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
<constraints nullable="true"/></column>
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
</createTable>
|
</createTable>
|
||||||
|
|
||||||
<createTable tableName="application_form_field">
|
<createTable tableName="application_form_field">
|
||||||
@@ -594,15 +607,17 @@
|
|||||||
<constraints nullable="false" primaryKey="true" primaryKeyName="application_form_field_pkey"/>
|
<constraints nullable="false" primaryKey="true" primaryKeyName="application_form_field_pkey"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="application_form_id" type="INTEGER">
|
<column name="application_form_id" type="INTEGER">
|
||||||
<constraints nullable="false" foreignKeyName="fk_application_form_application_form_field" references="application_form(id)"/>
|
<constraints nullable="false" foreignKeyName="fk_application_form_application_form_field"
|
||||||
|
references="application_form(id)"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="field_id" type="VARCHAR(255)" ></column>
|
<column name="field_id" type="VARCHAR(255)"></column>
|
||||||
<column name="field_value" type="VARCHAR(255)"></column>
|
<column name="field_value" type="VARCHAR(255)"></column>
|
||||||
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
<constraints nullable="true"/></column>
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
</createTable>
|
</createTable>
|
||||||
|
|
||||||
<createTable tableName="flow_edges">
|
<createTable tableName="flow_edges">
|
||||||
@@ -618,7 +633,8 @@
|
|||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
<constraints nullable="true"/></column>
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
</createTable>
|
</createTable>
|
||||||
|
|
||||||
<createTable tableName="flow_data">
|
<createTable tableName="flow_data">
|
||||||
@@ -634,7 +650,8 @@
|
|||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
<constraints nullable="true"/></column>
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
</createTable>
|
</createTable>
|
||||||
|
|
||||||
<addColumn tableName="call">
|
<addColumn tableName="call">
|
||||||
@@ -664,12 +681,14 @@
|
|||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
<constraints nullable="true"/></column>
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
</createTable>
|
</createTable>
|
||||||
|
|
||||||
<addColumn tableName="application_form">
|
<addColumn tableName="application_form">
|
||||||
<column name="application_id" type="INTEGER">
|
<column name="application_id" type="INTEGER">
|
||||||
<constraints nullable="false" foreignKeyName="fk_application_application_form" references="application(id)"/>
|
<constraints nullable="false" foreignKeyName="fk_application_application_form"
|
||||||
|
references="application(id)"/>
|
||||||
</column>
|
</column>
|
||||||
</addColumn>
|
</addColumn>
|
||||||
|
|
||||||
@@ -693,7 +712,7 @@
|
|||||||
TRUNCATE TABLE FORM_FIELD RESTART IDENTITY;
|
TRUNCATE TABLE FORM_FIELD RESTART IDENTITY;
|
||||||
</sql>
|
</sql>
|
||||||
<sqlFile dbms="postgresql"
|
<sqlFile dbms="postgresql"
|
||||||
path="classpath:db/dump/inserted_form_field_data_13_09_2024.sql" />
|
path="classpath:db/dump/inserted_form_field_data_13_09_2024.sql"/>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
|
||||||
@@ -708,7 +727,7 @@
|
|||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sqlFile dbms="postgresql"
|
<sqlFile dbms="postgresql"
|
||||||
path="classpath:db/dump/updated_form_field_data_16-09-2024.sql" />
|
path="classpath:db/dump/updated_form_field_data_16-09-2024.sql"/>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
<changeSet id="23-09-2024_1" author="Harish Bagora" dbms="postgresql">
|
<changeSet id="23-09-2024_1" author="Harish Bagora" dbms="postgresql">
|
||||||
<!-- Procedure for automatically setting the updated_date -->
|
<!-- Procedure for automatically setting the updated_date -->
|
||||||
@@ -743,7 +762,7 @@
|
|||||||
<changeSet id="23-09-2024_1" author="Rajesh Khore">
|
<changeSet id="23-09-2024_1" author="Rajesh Khore">
|
||||||
<createTable tableName="saml_response">
|
<createTable tableName="saml_response">
|
||||||
<column name="id" type="INTEGER" autoIncrement="true"></column>
|
<column name="id" type="INTEGER" autoIncrement="true"></column>
|
||||||
<column name="authentication_object" type="TEXT"> </column>
|
<column name="authentication_object" type="TEXT"></column>
|
||||||
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"></column>
|
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"></column>
|
||||||
<column name="token" type="varchar(255)"></column>
|
<column name="token" type="varchar(255)"></column>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"></column>
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"></column>
|
||||||
@@ -818,7 +837,7 @@
|
|||||||
|
|
||||||
<changeSet id="25-09-2024_2" author="Nisha kashyap">
|
<changeSet id="25-09-2024_2" author="Nisha kashyap">
|
||||||
<update tableName="form_field">
|
<update tableName="form_field">
|
||||||
<column name="name" value="textinput" />
|
<column name="name" value="textinput"/>
|
||||||
<where>id = 13</where>
|
<where>id = 13</where>
|
||||||
</update>
|
</update>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
@@ -837,20 +856,20 @@
|
|||||||
<createTable tableName="beneficiary">
|
<createTable tableName="beneficiary">
|
||||||
<column name="id" type="INTEGER" autoIncrement="true">
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
<constraints nullable="false" primaryKey="true"
|
<constraints nullable="false" primaryKey="true"
|
||||||
primaryKeyName="beneficiary_pkey" />
|
primaryKeyName="beneficiary_pkey"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="EMAIL" type="VARCHAR(255)" />
|
<column name="EMAIL" type="VARCHAR(255)"/>
|
||||||
<column name="FIRST_NAME" type="VARCHAR(255)" />
|
<column name="FIRST_NAME" type="VARCHAR(255)"/>
|
||||||
<column name="LAST_NAME" type="VARCHAR(255)" />
|
<column name="LAST_NAME" type="VARCHAR(255)"/>
|
||||||
<column name="PHONE_NUMBER" type="VARCHAR(255)" />
|
<column name="PHONE_NUMBER" type="VARCHAR(255)"/>
|
||||||
<column name="ORGANIZATION" type="TEXT" />
|
<column name="ORGANIZATION" type="TEXT"/>
|
||||||
<column name="ADDRESS" type="TEXT" />
|
<column name="ADDRESS" type="TEXT"/>
|
||||||
<column name="CITY" type="TEXT" />
|
<column name="CITY" type="TEXT"/>
|
||||||
<column name="COUNTRY" type="TEXT" />
|
<column name="COUNTRY" type="TEXT"/>
|
||||||
<column name="CODICE_FISCALE" type="varchar(255)">
|
<column name="CODICE_FISCALE" type="varchar(255)">
|
||||||
<constraints nullable="true" unique="true"/>
|
<constraints nullable="true" unique="true"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="DATE_OF_BIRTH" type="TIMESTAMP" />
|
<column name="DATE_OF_BIRTH" type="TIMESTAMP"/>
|
||||||
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||||
</createTable>
|
</createTable>
|
||||||
@@ -869,7 +888,7 @@
|
|||||||
<createTable tableName="COMPANY">
|
<createTable tableName="COMPANY">
|
||||||
<column name="id" type="INTEGER" autoIncrement="true">
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
<constraints nullable="false" primaryKey="true"
|
<constraints nullable="false" primaryKey="true"
|
||||||
primaryKeyName="company_pkey" />
|
primaryKeyName="company_pkey"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="COMPANY_NAME" type="VARCHAR(255)">
|
<column name="COMPANY_NAME" type="VARCHAR(255)">
|
||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
@@ -899,7 +918,7 @@
|
|||||||
|
|
||||||
<column name="id" type="INTEGER" autoIncrement="true">
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
<constraints nullable="false" primaryKey="true"
|
<constraints nullable="false" primaryKey="true"
|
||||||
primaryKeyName="user_with_company_pkey" />
|
primaryKeyName="user_with_company_pkey"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="USER_ID" type="INTEGER"/>
|
<column name="USER_ID" type="INTEGER"/>
|
||||||
<column name="BENEFICIARY_ID" type="INTEGER"/>
|
<column name="BENEFICIARY_ID" type="INTEGER"/>
|
||||||
@@ -934,46 +953,46 @@
|
|||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sqlFile dbms="postgresql"
|
<sqlFile dbms="postgresql"
|
||||||
path="classpath:db/dump/updated_form_field_data_03-10-2024.sql" />
|
path="classpath:db/dump/updated_form_field_data_03-10-2024.sql"/>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
<changeSet id="08-10-2024_1" author="Rajesh Khore">
|
<changeSet id="08-10-2024_1" author="Rajesh Khore">
|
||||||
<createTable tableName="user_company_delegation">
|
<createTable tableName="user_company_delegation">
|
||||||
<column name="id" type="INTEGER" autoIncrement="true">
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
<constraints nullable="false" primaryKey="true"
|
<constraints nullable="false" primaryKey="true"
|
||||||
primaryKeyName="user_company_delegation_pkey" />
|
primaryKeyName="user_company_delegation_pkey"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="USER_ID" type="INTEGER" />
|
<column name="USER_ID" type="INTEGER"/>
|
||||||
<column name="COMPANY_ID" type="INTEGER" />
|
<column name="COMPANY_ID" type="INTEGER"/>
|
||||||
<column name="BENEFICIARY_ID" type="INTEGER" />
|
<column name="BENEFICIARY_ID" type="INTEGER"/>
|
||||||
<column name="FILE_NAME" type="VARCHAR(255)" />
|
<column name="FILE_NAME" type="VARCHAR(255)"/>
|
||||||
<column name="FILE_PATH" type="VARCHAR(255)" />
|
<column name="FILE_PATH" type="VARCHAR(255)"/>
|
||||||
<column name="STATUS" type="VARCHAR(50)" />
|
<column name="STATUS" type="VARCHAR(50)"/>
|
||||||
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE" />
|
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE" />
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||||
</createTable>
|
</createTable>
|
||||||
|
|
||||||
<!-- Optional: If you have any indexes, constraints, or foreign keys -->
|
<!-- Optional: If you have any indexes, constraints, or foreign keys -->
|
||||||
<addForeignKeyConstraint
|
<addForeignKeyConstraint
|
||||||
baseTableName="user_company_delegation" baseColumnNames="USER_ID"
|
baseTableName="user_company_delegation" baseColumnNames="USER_ID"
|
||||||
referencedTableName="gepafin_user" referencedColumnNames="ID"
|
referencedTableName="gepafin_user" referencedColumnNames="ID"
|
||||||
constraintName="fk_user_company_delegation_gepafin_user" />
|
constraintName="fk_user_company_delegation_gepafin_user"/>
|
||||||
|
|
||||||
<addForeignKeyConstraint
|
<addForeignKeyConstraint
|
||||||
baseTableName="user_company_delegation" baseColumnNames="COMPANY_ID"
|
baseTableName="user_company_delegation" baseColumnNames="COMPANY_ID"
|
||||||
referencedTableName="company" referencedColumnNames="ID"
|
referencedTableName="company" referencedColumnNames="ID"
|
||||||
constraintName="fk_user_company_delegation_company" />
|
constraintName="fk_user_company_delegation_company"/>
|
||||||
|
|
||||||
<addForeignKeyConstraint
|
<addForeignKeyConstraint
|
||||||
baseTableName="user_company_delegation"
|
baseTableName="user_company_delegation"
|
||||||
baseColumnNames="BENEFICIARY_ID" referencedTableName="beneficiary"
|
baseColumnNames="BENEFICIARY_ID" referencedTableName="beneficiary"
|
||||||
referencedColumnNames="ID"
|
referencedColumnNames="ID"
|
||||||
constraintName="fk_user_company_delegation_beneficiary" />
|
constraintName="fk_user_company_delegation_beneficiary"/>
|
||||||
|
|
||||||
</changeSet>
|
</changeSet>
|
||||||
<changeSet id="08-10-2024_2" author="Rajesh Khore">
|
<changeSet id="08-10-2024_2" author="Rajesh Khore">
|
||||||
<addColumn tableName="user_with_company">
|
<addColumn tableName="user_with_company">
|
||||||
<column name="IS_LEGAL_REPRESENTANT" type="BOOLEAN" />
|
<column name="IS_LEGAL_REPRESENTANT" type="BOOLEAN"/>
|
||||||
</addColumn>
|
</addColumn>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
@@ -983,7 +1002,7 @@
|
|||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sqlFile dbms="postgresql"
|
<sqlFile dbms="postgresql"
|
||||||
path="classpath:db/dump/updated_form_field_data_03-10-2024_1.sql" />
|
path="classpath:db/dump/updated_form_field_data_03-10-2024_1.sql"/>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
<changeSet id="07-10-2024_1" author="Harish Bagora">
|
<changeSet id="07-10-2024_1" author="Harish Bagora">
|
||||||
<addColumn tableName="beneficiary">
|
<addColumn tableName="beneficiary">
|
||||||
@@ -994,8 +1013,8 @@
|
|||||||
<column name="THIRD_PARTY" type="BOOLEAN"/>
|
<column name="THIRD_PARTY" type="BOOLEAN"/>
|
||||||
<column name="email_pec" type="VARCHAR(255)"/>
|
<column name="email_pec" type="VARCHAR(255)"/>
|
||||||
</addColumn>
|
</addColumn>
|
||||||
<addNotNullConstraint tableName="beneficiary" columnName="PRIVACY" />
|
<addNotNullConstraint tableName="beneficiary" columnName="PRIVACY"/>
|
||||||
<addNotNullConstraint tableName="beneficiary" columnName="TERMS" />
|
<addNotNullConstraint tableName="beneficiary" columnName="TERMS"/>
|
||||||
<addColumn tableName="COMPANY">
|
<addColumn tableName="COMPANY">
|
||||||
<column name="contact_name" type="VARCHAR(255)"/>
|
<column name="contact_name" type="VARCHAR(255)"/>
|
||||||
<column name="contact_email" type="VARCHAR(255)"/>
|
<column name="contact_email" type="VARCHAR(255)"/>
|
||||||
@@ -1012,7 +1031,7 @@
|
|||||||
<createTable tableName="protocol">
|
<createTable tableName="protocol">
|
||||||
<column name="id" type="INTEGER" autoIncrement="true">
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
<constraints nullable="false" primaryKey="true"
|
<constraints nullable="false" primaryKey="true"
|
||||||
primaryKeyName="protocol_pkey" />
|
primaryKeyName="protocol_pkey"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="protocol_number" type="INTEGER">
|
<column name="protocol_number" type="INTEGER">
|
||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
@@ -1063,7 +1082,7 @@
|
|||||||
<createTable tableName="system_email_template">
|
<createTable tableName="system_email_template">
|
||||||
<column name="id" type="INTEGER" autoIncrement="true">
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
<constraints nullable="false" primaryKey="true"
|
<constraints nullable="false" primaryKey="true"
|
||||||
primaryKeyName="system_email_template_pkey" />
|
primaryKeyName="system_email_template_pkey"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="TEMPLATE_NAME" type="VARCHAR(255)"/>
|
<column name="TEMPLATE_NAME" type="VARCHAR(255)"/>
|
||||||
<column name="TYPE" type="VARCHAR(255)"/>
|
<column name="TYPE" type="VARCHAR(255)"/>
|
||||||
@@ -1081,7 +1100,7 @@
|
|||||||
|
|
||||||
<changeSet id="10-10-2024_2" author="Rajesh Khore">
|
<changeSet id="10-10-2024_2" author="Rajesh Khore">
|
||||||
<sqlFile dbms="postgresql"
|
<sqlFile dbms="postgresql"
|
||||||
path="db/dump/insert_system_email_template_for_application_submission.sql" />
|
path="db/dump/insert_system_email_template_for_application_submission.sql"/>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
<changeSet id="12-10-2024_1" author="Rajesh Khore">
|
<changeSet id="12-10-2024_1" author="Rajesh Khore">
|
||||||
|
|
||||||
@@ -1108,43 +1127,43 @@
|
|||||||
</changeSet>
|
</changeSet>
|
||||||
<changeSet id="13-10-2024_1" author="Rajesh Khore">
|
<changeSet id="13-10-2024_1" author="Rajesh Khore">
|
||||||
<update tableName="form_field">
|
<update tableName="form_field">
|
||||||
<column name="validators" value='{"custom": "nonEmptyTables"}' />
|
<column name="validators" value='{"custom": "nonEmptyTables"}'/>
|
||||||
<where>name='table'</where>
|
<where>name='table'</where>
|
||||||
</update>
|
</update>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
<changeSet id="14-10-2024_1" author="Harish Bagora">
|
<changeSet id="14-10-2024_1" author="Harish Bagora">
|
||||||
<sqlFile dbms="postgresql"
|
<sqlFile dbms="postgresql"
|
||||||
path="db/dump/update_system_email_template_of_application_submission.sql" />
|
path="db/dump/update_system_email_template_of_application_submission.sql"/>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
<changeSet id="15-10-2024_2" author="Nisha Kashyap">
|
<changeSet id="15-10-2024_2" author="Nisha Kashyap">
|
||||||
<preConditions onFail="MARK_RAN">
|
<preConditions onFail="MARK_RAN">
|
||||||
<not>
|
<not>
|
||||||
<tableExists tableName="login_attempt" />
|
<tableExists tableName="login_attempt"/>
|
||||||
</not>
|
</not>
|
||||||
</preConditions>
|
</preConditions>
|
||||||
<createTable tableName="login_attempt">
|
<createTable tableName="login_attempt">
|
||||||
<column autoIncrement="true" name="id" type="INTEGER">
|
<column autoIncrement="true" name="id" type="INTEGER">
|
||||||
<constraints nullable="false" primaryKey="true"
|
<constraints nullable="false" primaryKey="true"
|
||||||
primaryKeyName="login_attempt_pkey" />
|
primaryKeyName="login_attempt_pkey"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="username" type="VARCHAR(255)">
|
<column name="username" type="VARCHAR(255)">
|
||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="user_id" type="INTEGER" />
|
<column name="user_id" type="INTEGER"/>
|
||||||
<column name="attempt_date" type="TIMESTAMP WITHOUT TIME ZONE" >
|
<column name="attempt_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="ip_address" type="VARCHAR(100)" />
|
<column name="ip_address" type="VARCHAR(100)"/>
|
||||||
<column name="user_agent" type="VARCHAR(255)" />
|
<column name="user_agent" type="VARCHAR(255)"/>
|
||||||
<column name="result" type="VARCHAR(100)">
|
<column name="result" type="VARCHAR(100)">
|
||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="attempt_type" type="VARCHAR(100)" defaultValue="LOGIN">
|
<column name="attempt_type" type="VARCHAR(100)" defaultValue="LOGIN">
|
||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="error_msg" type="VARCHAR(255)" />
|
<column name="error_msg" type="VARCHAR(255)"/>
|
||||||
</createTable>
|
</createTable>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
@@ -1173,17 +1192,17 @@
|
|||||||
<createTable tableName="criteria_form_field">
|
<createTable tableName="criteria_form_field">
|
||||||
<column autoIncrement="true" name="id" type="INTEGER">
|
<column autoIncrement="true" name="id" type="INTEGER">
|
||||||
<constraints nullable="false" primaryKey="true"
|
<constraints nullable="false" primaryKey="true"
|
||||||
primaryKeyName="criteria_form_field_pkey" />
|
primaryKeyName="criteria_form_field_pkey"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="call_id" type="INTEGER" />
|
<column name="call_id" type="INTEGER"/>
|
||||||
<column name="form_id" type="INTEGER" />
|
<column name="form_id" type="INTEGER"/>
|
||||||
<column name="form_field_id" type="varchar(255)" />
|
<column name="form_field_id" type="varchar(255)"/>
|
||||||
<column name="evaluation_criteria_id" type="INTEGER" />
|
<column name="evaluation_criteria_id" type="INTEGER"/>
|
||||||
<column name="IS_DELETED" type="BOOLEAN" defaultValueBoolean="true">
|
<column name="IS_DELETED" type="BOOLEAN" defaultValueBoolean="true">
|
||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE" />
|
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE" />
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||||
</createTable>
|
</createTable>
|
||||||
|
|
||||||
<addForeignKeyConstraint baseTableName="criteria_form_field"
|
<addForeignKeyConstraint baseTableName="criteria_form_field"
|
||||||
@@ -1226,9 +1245,10 @@
|
|||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="application_id" type="INTEGER">
|
<column name="application_id" type="INTEGER">
|
||||||
<constraints nullable="false" foreignKeyName="fk_application_assigned_applications" references="application(id)"/>
|
<constraints nullable="false" foreignKeyName="fk_application_assigned_applications"
|
||||||
|
references="application(id)"/>
|
||||||
</column>
|
</column>
|
||||||
<column name="STATUS" type="VARCHAR(50)" />
|
<column name="STATUS" type="VARCHAR(50)"/>
|
||||||
<column name="note" type="TEXT"></column>
|
<column name="note" type="TEXT"></column>
|
||||||
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
|
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
|
||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
@@ -1282,9 +1302,6 @@
|
|||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<changeSet id="19-10-2024_1" author="Harish Bagora">
|
<changeSet id="19-10-2024_1" author="Harish Bagora">
|
||||||
<addColumn tableName="saml_response">
|
<addColumn tableName="saml_response">
|
||||||
<column name="IN_RESPONSE_TO" type="TEXT"/>
|
<column name="IN_RESPONSE_TO" type="TEXT"/>
|
||||||
@@ -1328,4 +1345,77 @@
|
|||||||
referencedColumnNames="id"/>
|
referencedColumnNames="id"/>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="25-10-2024_1" author="Piyush">
|
||||||
|
<createTable tableName="s3_path_configuration">
|
||||||
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
|
<constraints nullable="false" primaryKey="true" primaryKeyName="s3_path_configuration_pkey"/>
|
||||||
|
</column>
|
||||||
|
<column name="type" type="VARCHAR(100)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="bucket_name" type="VARCHAR(500)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="parent_folder" type="VARCHAR(100)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="path" type="VARCHAR(500)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
</createTable>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="25-10-2024_2" author="Piyush">
|
||||||
|
<insert tableName="s3_path_configuration">
|
||||||
|
<column name="type" value="CALL"/>
|
||||||
|
<column name="path" value="call/{call_id}"/>
|
||||||
|
<column name="bucket_name" value="mementoresources"/>
|
||||||
|
<column name="created_date" value="2024-10-25 03:00:00"/>
|
||||||
|
<column name="updated_date" value="2024-10-25 03:00:00"/>
|
||||||
|
<column name="parent_folder" value="gepafin/staging"/>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert tableName="s3_path_configuration">
|
||||||
|
<column name="type" value="APPLICATION"/>
|
||||||
|
<column name="path" value="call/{call_id}/application/{application_id}"/>
|
||||||
|
<column name="bucket_name" value="mementoresources"/>
|
||||||
|
<column name="created_date" value="2024-10-25 03:00:00"/>
|
||||||
|
<column name="updated_date" value="2024-10-25 03:00:00"/>
|
||||||
|
<column name="parent_folder" value="gepafin/staging"/>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert tableName="s3_path_configuration">
|
||||||
|
<column name="type" value="USER_SIGNED_DOCUMENT"/>
|
||||||
|
<column name="path" value="call/{call_id}/application/{application_id}/user_signed_document"/>
|
||||||
|
<column name="bucket_name" value="mementoresources"/>
|
||||||
|
<column name="created_date" value="2024-10-25 03:00:00"/>
|
||||||
|
<column name="updated_date" value="2024-10-25 03:00:00"/>
|
||||||
|
<column name="parent_folder" value="gepafin/staging"/>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert tableName="s3_path_configuration">
|
||||||
|
<column name="type" value="TEMPLATE"/>
|
||||||
|
<column name="path" value="template"/>
|
||||||
|
<column name="bucket_name" value="mementoresources"/>
|
||||||
|
<column name="created_date" value="2024-10-25 03:00:00"/>
|
||||||
|
<column name="updated_date" value="2024-10-25 03:00:00"/>
|
||||||
|
<column name="parent_folder" value="gepafin/staging"/>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert tableName="s3_path_configuration">
|
||||||
|
<column name="type" value="USER_DELEGATION"/>
|
||||||
|
<column name="path" value="user_delegation"/>
|
||||||
|
<column name="bucket_name" value="mementoresources"/>
|
||||||
|
<column name="created_date" value="2024-10-25 03:00:00"/>
|
||||||
|
<column name="updated_date" value="2024-10-25 03:00:00"/>
|
||||||
|
<column name="parent_folder" value="gepafin/staging"/>
|
||||||
|
</insert>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
Reference in New Issue
Block a user