RED-7158: custom release
This commit is contained in:
parent
df0c344af2
commit
44a066e204
@ -116,11 +116,26 @@ public class FileManagementController implements FileManagementResource {
|
|||||||
@PathVariable(FILE_ID) String fileId,
|
@PathVariable(FILE_ID) String fileId,
|
||||||
@RequestParam(value = "inline", required = false, defaultValue = FALSE) boolean inline) {
|
@RequestParam(value = "inline", required = false, defaultValue = FALSE) boolean inline) {
|
||||||
|
|
||||||
try {
|
return getResponseEntityForPDFDocument(fileId, dossierId, FileType.ORIGIN, inline);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Timed
|
||||||
|
@Override
|
||||||
|
@PreAuthorize("hasAuthority('" + DOWNLOAD_ORIGINAL_FILE + "')")
|
||||||
|
public ResponseEntity<?> downloadViewerDocument(@PathVariable(DOSSIER_ID) String dossierId,
|
||||||
|
@PathVariable(FILE_ID) String fileId,
|
||||||
|
@RequestParam(value = "inline", required = false, defaultValue = FALSE) boolean inline) {
|
||||||
|
|
||||||
|
return getResponseEntityForPDFDocument(fileId, dossierId, FileType.VIEWER_DOCUMENT, inline);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private ResponseEntity<?> getResponseEntityForPDFDocument(String fileId, String dossierId, FileType viewerDocument, boolean inline) {
|
||||||
|
|
||||||
|
try {
|
||||||
var file = fileStatusManagementService.getFileStatus(fileId);
|
var file = fileStatusManagementService.getFileStatus(fileId);
|
||||||
var untouchedFileStream = storageService.getObject(TenantContext.getTenantId(), StorageIdUtils.getStorageId(dossierId, fileId, FileType.ORIGIN));
|
var viewerDocumentFileStream = storageService.getObject(TenantContext.getTenantId(), StorageIdUtils.getStorageId(dossierId, fileId, viewerDocument));
|
||||||
return getResponseEntity(inline, untouchedFileStream, file.getFilename(), MediaType.APPLICATION_PDF);
|
return getResponseEntity(inline, viewerDocumentFileStream, file.getFilename(), MediaType.APPLICATION_PDF);
|
||||||
} catch (FeignException e) {
|
} catch (FeignException e) {
|
||||||
if (e.status() == HttpStatus.NOT_FOUND.value()) {
|
if (e.status() == HttpStatus.NOT_FOUND.value()) {
|
||||||
return new ResponseEntity<>(e.getMessage(), HttpStatus.NOT_FOUND);
|
return new ResponseEntity<>(e.getMessage(), HttpStatus.NOT_FOUND);
|
||||||
|
|||||||
@ -25,6 +25,7 @@ public interface FileManagementResource {
|
|||||||
|
|
||||||
String DELETE_PATH = ExternalApi.BASE_PATH + "/delete";
|
String DELETE_PATH = ExternalApi.BASE_PATH + "/delete";
|
||||||
String DOWNLOAD_ORIGINAL_PATH = ExternalApi.BASE_PATH + "/download/original";
|
String DOWNLOAD_ORIGINAL_PATH = ExternalApi.BASE_PATH + "/download/original";
|
||||||
|
String DOWNLOAD_VIEWER_DOCUMENT_PATH = ExternalApi.BASE_PATH + "/download/viewer_doc";
|
||||||
String ROTATION_PATH = ExternalApi.BASE_PATH + "/rotate";
|
String ROTATION_PATH = ExternalApi.BASE_PATH + "/rotate";
|
||||||
|
|
||||||
String DOSSIER_ID = "dossierId";
|
String DOSSIER_ID = "dossierId";
|
||||||
@ -55,14 +56,24 @@ public interface FileManagementResource {
|
|||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
@ResponseStatus(value = HttpStatus.OK)
|
||||||
@Operation(summary = "Returns a downloadable byte stream of the original file with the specified fileId", description = "Use the optional \"inline\" request parameter to select, if " + "this downloadAnnotated will be opened in the browser.")
|
@Operation(summary = "Returns a downloadable byte stream of the original file with the specified fileId", description = "Use the optional \"inline\" request parameter to select, if this downloadAnnotated will be opened in the browser.")
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Could not " + "prepare file download.")})
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Could not prepare file download.")})
|
||||||
@GetMapping(value = DOWNLOAD_ORIGINAL_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE)
|
@GetMapping(value = DOWNLOAD_ORIGINAL_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE)
|
||||||
ResponseEntity<?> downloadOriginal(@PathVariable(DOSSIER_ID) String dossierId,
|
ResponseEntity<?> downloadOriginal(@PathVariable(DOSSIER_ID) String dossierId,
|
||||||
@PathVariable(FILE_ID) String fileId,
|
@PathVariable(FILE_ID) String fileId,
|
||||||
@RequestParam(value = "inline", required = false, defaultValue = FALSE) boolean inline);
|
@RequestParam(value = "inline", required = false, defaultValue = FALSE) boolean inline);
|
||||||
|
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@ResponseStatus(value = HttpStatus.OK)
|
||||||
|
@Operation(summary = "Returns a downloadable byte stream of the viewer document file with the specified fileId", description = "Use the optional \"inline\" request parameter to select, if this downloadAnnotated will be opened in the browser.")
|
||||||
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Could not prepare file download.")})
|
||||||
|
@GetMapping(value = DOWNLOAD_VIEWER_DOCUMENT_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE)
|
||||||
|
ResponseEntity<?> downloadViewerDocument(@PathVariable(DOSSIER_ID) String dossierId,
|
||||||
|
@PathVariable(FILE_ID) String fileId,
|
||||||
|
@RequestParam(value = "inline", required = false, defaultValue = FALSE) boolean inline);
|
||||||
|
|
||||||
|
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
@DeleteMapping(value = HARD_DELETE_PATH + DOSSIER_ID_PATH_VARIABLE)
|
@DeleteMapping(value = HARD_DELETE_PATH + DOSSIER_ID_PATH_VARIABLE)
|
||||||
@Operation(summary = "Hard deletes an uploaded file.", description = "None")
|
@Operation(summary = "Hard deletes an uploaded file.", description = "None")
|
||||||
|
|||||||
@ -49,6 +49,7 @@ public interface RedactionLogResource {
|
|||||||
@RequestParam(value = "includeFalsePositives", required = false, defaultValue = "false") boolean includeFalsePositives);
|
@RequestParam(value = "includeFalsePositives", required = false, defaultValue = "false") boolean includeFalsePositives);
|
||||||
|
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@GetMapping(value = SECTION_GRID_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(value = SECTION_GRID_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@Operation(summary = "Gets the section grid for a fileId", description = "None")
|
@Operation(summary = "Gets the section grid for a fileId", description = "None")
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The section grid is not found.")})
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The section grid is not found.")})
|
||||||
|
|||||||
@ -91,7 +91,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.knecon.fforesight</groupId>
|
<groupId>com.knecon.fforesight</groupId>
|
||||||
<artifactId>layoutparser-service-internal-api</artifactId>
|
<artifactId>layoutparser-service-internal-api</artifactId>
|
||||||
<version>0.19.0</version>
|
<version>0.37.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@ -52,6 +52,7 @@ public class LayoutParsingRequestFactory {
|
|||||||
.positionBlockFileStorageId(StorageIdUtils.getStorageId(dossierId, fileId, FileType.DOCUMENT_POSITION))
|
.positionBlockFileStorageId(StorageIdUtils.getStorageId(dossierId, fileId, FileType.DOCUMENT_POSITION))
|
||||||
.simplifiedTextStorageId(StorageIdUtils.getStorageId(dossierId, fileId, FileType.SIMPLIFIED_TEXT))
|
.simplifiedTextStorageId(StorageIdUtils.getStorageId(dossierId, fileId, FileType.SIMPLIFIED_TEXT))
|
||||||
.sectionGridStorageId(StorageIdUtils.getStorageId(dossierId, fileId, FileType.SECTION_GRID))
|
.sectionGridStorageId(StorageIdUtils.getStorageId(dossierId, fileId, FileType.SECTION_GRID))
|
||||||
|
.viewerDocumentStorageId(StorageIdUtils.getStorageId(dossierId, fileId, FileType.VIEWER_DOCUMENT))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,7 @@ public class LayoutParsingFinishedMessageReceiver {
|
|||||||
log.info("Failed to process layout parsing request, errorCause: {}, timestamp: {}", errorCause, timestamp);
|
log.info("Failed to process layout parsing request, errorCause: {}, timestamp: {}", errorCause, timestamp);
|
||||||
fileStatusProcessingUpdateService.analysisFailed(layoutParsingRequestIdentifierService.parseDossierId(analyzeRequest.identifier()),
|
fileStatusProcessingUpdateService.analysisFailed(layoutParsingRequestIdentifierService.parseDossierId(analyzeRequest.identifier()),
|
||||||
layoutParsingRequestIdentifierService.parseFileId(analyzeRequest.identifier()),
|
layoutParsingRequestIdentifierService.parseFileId(analyzeRequest.identifier()),
|
||||||
new FileErrorInfo(errorCause, LayoutParsingQueueNames.LAYOUT_PARSING_DLQ, "redaction-service", timestamp));
|
new FileErrorInfo(errorCause, LayoutParsingQueueNames.LAYOUT_PARSING_DLQ, "layoutparser-service", timestamp));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@ public enum FileType {
|
|||||||
|
|
||||||
UNTOUCHED(".pdf"),
|
UNTOUCHED(".pdf"),
|
||||||
ORIGIN(".pdf"),
|
ORIGIN(".pdf"),
|
||||||
|
VIEWER_DOCUMENT(".pdf"),
|
||||||
REDACTION_LOG(".json"),
|
REDACTION_LOG(".json"),
|
||||||
SIMPLIFIED_TEXT(".json"),
|
SIMPLIFIED_TEXT(".json"),
|
||||||
SECTION_GRID(".json"),
|
SECTION_GRID(".json"),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user