updated code
This commit is contained in:
@@ -207,5 +207,6 @@ public class GepafinConstant {
|
|||||||
public static final String SIGNED_DOCUMENT_FILE_UPLOAD_SUCCESS = "signed.document.file.upload.success";
|
public static final String SIGNED_DOCUMENT_FILE_UPLOAD_SUCCESS = "signed.document.file.upload.success";
|
||||||
public static final String GET_SIGNED_DOCUMENT_FILE_SUCCESS = "get.signed.document.file.success";
|
public static final String GET_SIGNED_DOCUMENT_FILE_SUCCESS = "get.signed.document.file.success";
|
||||||
public static final String APPLICATION_SIGNED_DOCUMENT_NOT_FOUND = "application.signed.document.not.found";
|
public static final String APPLICATION_SIGNED_DOCUMENT_NOT_FOUND = "application.signed.document.not.found";
|
||||||
|
public static final String DELETE_SIGNED_DOCUMENT_FILE_SUCCESS = "delete.signed.document.file.success";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -740,4 +740,18 @@ public class ApplicationDao {
|
|||||||
}
|
}
|
||||||
return convertApplicationSignedDocumentToApplicationSignedDocumentResponse(applicationSignedDocument);
|
return convertApplicationSignedDocumentToApplicationSignedDocumentResponse(applicationSignedDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteSignedDocument(HttpServletRequest request, Long applicationId) {
|
||||||
|
ApplicationEntity applicationEntity = validateApplication(applicationId);
|
||||||
|
validator.validateUserWithCompany(request, applicationEntity.getCompany().getId());
|
||||||
|
|
||||||
|
ApplicationSignedDocumentEntity applicationSignedDocument = applicationSignedDocumentRepository
|
||||||
|
.findByApplicationIdAndStatus(applicationId, ApplicationSignedDocumentStatusEnum.ACTIVE.getValue());
|
||||||
|
if(applicationSignedDocument == null) {
|
||||||
|
throw new ResourceNotFoundException(Status.NOT_FOUND,
|
||||||
|
Translator.toLocale(GepafinConstant.APPLICATION_SIGNED_DOCUMENT_NOT_FOUND));
|
||||||
|
}
|
||||||
|
applicationSignedDocument.setStatus(ApplicationSignedDocumentStatusEnum.INACTIVE.getValue());
|
||||||
|
applicationSignedDocumentRepository.save(applicationSignedDocument);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,4 +38,6 @@ public interface ApplicationService {
|
|||||||
|
|
||||||
public ApplicationSignedDocumentResponse getSignedDocument(HttpServletRequest request, Long applicationId);
|
public ApplicationSignedDocumentResponse getSignedDocument(HttpServletRequest request, Long applicationId);
|
||||||
|
|
||||||
|
public void deleteSignedDocument(HttpServletRequest request, Long applicationId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,15 @@ public class ApplicationServiceImpl implements ApplicationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(readOnly = true)
|
||||||
public ApplicationSignedDocumentResponse getSignedDocument(HttpServletRequest request, Long applicationId) {
|
public ApplicationSignedDocumentResponse getSignedDocument(HttpServletRequest request, Long applicationId) {
|
||||||
return applicationDao.getSignedDocument(request, applicationId);
|
return applicationDao.getSignedDocument(request, applicationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void deleteSignedDocument(HttpServletRequest request, Long applicationId) {
|
||||||
|
applicationDao.deleteSignedDocument(request, applicationId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,6 +157,17 @@ public interface ApplicationApi {
|
|||||||
@GetMapping(value = "{applicationId}/signedDocument", produces = "application/json")
|
@GetMapping(value = "{applicationId}/signedDocument", produces = "application/json")
|
||||||
ResponseEntity<Response<ApplicationSignedDocumentResponse>> getSignedDocument(HttpServletRequest request,
|
ResponseEntity<Response<ApplicationSignedDocumentResponse>> getSignedDocument(HttpServletRequest request,
|
||||||
@Parameter(description = "The applicationId id", required = true) @PathVariable("applicationId") Long applicationId);
|
@Parameter(description = "The applicationId id", required = true) @PathVariable("applicationId") Long applicationId);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to delete signed document", 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 = "{applicationId}/signedDocument", produces = "application/json")
|
||||||
|
ResponseEntity<Response<Void>> deleteSignedDocument(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The applicationId id", required = true) @PathVariable("applicationId") Long applicationId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,5 +110,14 @@ public class ApplicationApiController implements ApplicationApi {
|
|||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_SIGNED_DOCUMENT_FILE_SUCCESS)));
|
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.GET_SIGNED_DOCUMENT_FILE_SUCCESS)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<Void>> deleteSignedDocument(HttpServletRequest request,
|
||||||
|
Long applicationId) {
|
||||||
|
applicationService.deleteSignedDocument(request, applicationId);
|
||||||
|
log.info("delete signed document applicationId: {}", applicationId);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.DELETE_SIGNED_DOCUMENT_FILE_SUCCESS)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -233,5 +233,6 @@ permission.denied=You are not authorized to access this data.
|
|||||||
signed.document.file.upload.success=Signed document file uploaded successfully.
|
signed.document.file.upload.success=Signed document file uploaded successfully.
|
||||||
get.signed.document.file.success=Signed document file retrieved successfully.
|
get.signed.document.file.success=Signed document file retrieved successfully.
|
||||||
application.signed.document.not.found=Signed document for the application not found.
|
application.signed.document.not.found=Signed document for the application not found.
|
||||||
|
delete.signed.document.file.success=Signed document deleted successfully.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -229,5 +229,6 @@ permission.denied=Non sei autorizzato ad accedere a questi dati.
|
|||||||
signed.document.file.upload.success=File del documento firmato caricato con successo.
|
signed.document.file.upload.success=File del documento firmato caricato con successo.
|
||||||
get.signed.document.file.success=File del documento firmato recuperato con successo.
|
get.signed.document.file.success=File del documento firmato recuperato con successo.
|
||||||
application.signed.document.not.found=Documento firmato per l'applicazione non trovato.
|
application.signed.document.not.found=Documento firmato per l'applicazione non trovato.
|
||||||
|
delete.signed.document.file.success=Documento firmato eliminato con successo.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user