RED-6725: integrate layout parser
* fixed error messages * extracted common zip file response entity function * added content length header * removed unused identifier
This commit is contained in:
parent
8d881a5597
commit
dedaa4fd29
@ -75,49 +75,39 @@ public class RedactionLogController implements RedactionLogResource {
|
|||||||
public ResponseEntity<?> getSectionText(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId) {
|
public ResponseEntity<?> getSectionText(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
return buildZipFileResponseEntity(fileId, dossierId, FileType.TEXT);
|
||||||
HttpHeaders httpHeaders = new HttpHeaders();
|
|
||||||
httpHeaders.setContentType(MediaType.parseMediaType("application/zip"));
|
|
||||||
|
|
||||||
var fileStatus = fileStatusService.getStatus(fileId);
|
|
||||||
String filename = fileStatus.getFilename();
|
|
||||||
if (filename != null) {
|
|
||||||
var index = filename.lastIndexOf(".");
|
|
||||||
String prefix = filename.substring(0, index);
|
|
||||||
filename = prefix + ".json";
|
|
||||||
httpHeaders.add("Content-Disposition", "attachment; filename=" + prefix + ".zip");
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] zipBytes = getZippedBytes(dossierId, fileId, filename, FileType.TEXT);
|
|
||||||
return new ResponseEntity<>(zipBytes, httpHeaders, HttpStatus.OK);
|
|
||||||
|
|
||||||
} catch (FeignException e) {
|
} catch (FeignException e) {
|
||||||
throw processFeignException(e);
|
throw processFeignException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private ResponseEntity<byte[]> buildZipFileResponseEntity(String fileId, String dossierId, FileType fileType) throws IOException {
|
||||||
|
|
||||||
|
HttpHeaders httpHeaders = new HttpHeaders();
|
||||||
|
httpHeaders.setContentType(MediaType.parseMediaType("application/zip"));
|
||||||
|
|
||||||
|
var fileStatus = fileStatusService.getStatus(fileId);
|
||||||
|
String filename = fileStatus.getFilename();
|
||||||
|
if (filename != null) {
|
||||||
|
var index = filename.lastIndexOf(".");
|
||||||
|
String prefix = filename.substring(0, index);
|
||||||
|
filename = prefix + ".json";
|
||||||
|
httpHeaders.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=utf-8''" + StringEncodingUtils.urlEncode(prefix) + ".zip");
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] zipBytes = getZippedBytes(dossierId, fileId, filename, fileType);
|
||||||
|
httpHeaders.setContentLength(zipBytes.length);
|
||||||
|
return new ResponseEntity<>(zipBytes, httpHeaders, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@PreAuthorize("hasAuthority('" + READ_REDACTION_LOG + "')")
|
@PreAuthorize("hasAuthority('" + READ_REDACTION_LOG + "')")
|
||||||
public ResponseEntity<?> getDocumentText(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId) {
|
public ResponseEntity<?> getDocumentText(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
return buildZipFileResponseEntity(fileId, dossierId, FileType.DOCUMENT_TEXT);
|
||||||
HttpHeaders httpHeaders = new HttpHeaders();
|
|
||||||
httpHeaders.setContentType(MediaType.parseMediaType("application/zip"));
|
|
||||||
|
|
||||||
var fileStatus = fileStatusService.getStatus(fileId);
|
|
||||||
String filename = fileStatus.getFilename();
|
|
||||||
if (filename != null) {
|
|
||||||
var index = filename.lastIndexOf(".");
|
|
||||||
String prefix = filename.substring(0, index);
|
|
||||||
filename = prefix + ".json";
|
|
||||||
httpHeaders.add("Content-Disposition", "attachment; filename=" + prefix + ".zip");
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] zipBytes = getZippedBytes(dossierId, fileId, filename, FileType.DOCUMENT_TEXT);
|
|
||||||
return new ResponseEntity<>(zipBytes, httpHeaders, HttpStatus.OK);
|
|
||||||
|
|
||||||
} catch (FeignException e) {
|
} catch (FeignException e) {
|
||||||
throw processFeignException(e);
|
throw processFeignException(e);
|
||||||
}
|
}
|
||||||
@ -129,22 +119,7 @@ public class RedactionLogController implements RedactionLogResource {
|
|||||||
public ResponseEntity<?> getDocumentPositions(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId) {
|
public ResponseEntity<?> getDocumentPositions(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
return buildZipFileResponseEntity(fileId, dossierId, FileType.DOCUMENT_POSITION);
|
||||||
HttpHeaders httpHeaders = new HttpHeaders();
|
|
||||||
httpHeaders.setContentType(MediaType.parseMediaType("application/zip"));
|
|
||||||
|
|
||||||
var fileStatus = fileStatusService.getStatus(fileId);
|
|
||||||
String filename = fileStatus.getFilename();
|
|
||||||
if (filename != null) {
|
|
||||||
var index = filename.lastIndexOf(".");
|
|
||||||
String prefix = filename.substring(0, index);
|
|
||||||
filename = prefix + ".json";
|
|
||||||
httpHeaders.add("Content-Disposition", "attachment; filename=" + prefix + ".zip");
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] zipBytes = getZippedBytes(dossierId, fileId, filename, FileType.DOCUMENT_POSITION);
|
|
||||||
return new ResponseEntity<>(zipBytes, httpHeaders, HttpStatus.OK);
|
|
||||||
|
|
||||||
} catch (FeignException e) {
|
} catch (FeignException e) {
|
||||||
throw processFeignException(e);
|
throw processFeignException(e);
|
||||||
}
|
}
|
||||||
@ -156,22 +131,7 @@ public class RedactionLogController implements RedactionLogResource {
|
|||||||
public ResponseEntity<?> getDocumentStructure(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId) {
|
public ResponseEntity<?> getDocumentStructure(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
return buildZipFileResponseEntity(fileId, dossierId, FileType.DOCUMENT_STRUCTURE);
|
||||||
HttpHeaders httpHeaders = new HttpHeaders();
|
|
||||||
httpHeaders.setContentType(MediaType.parseMediaType("application/zip"));
|
|
||||||
|
|
||||||
var fileStatus = fileStatusService.getStatus(fileId);
|
|
||||||
String filename = fileStatus.getFilename();
|
|
||||||
if (filename != null) {
|
|
||||||
var index = filename.lastIndexOf(".");
|
|
||||||
String prefix = filename.substring(0, index);
|
|
||||||
filename = prefix + ".json";
|
|
||||||
httpHeaders.add("Content-Disposition", "attachment; filename=" + prefix + ".zip");
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] zipBytes = getZippedBytes(dossierId, fileId, filename, FileType.DOCUMENT_STRUCTURE);
|
|
||||||
return new ResponseEntity<>(zipBytes, httpHeaders, HttpStatus.OK);
|
|
||||||
|
|
||||||
} catch (FeignException e) {
|
} catch (FeignException e) {
|
||||||
throw processFeignException(e);
|
throw processFeignException(e);
|
||||||
}
|
}
|
||||||
@ -183,22 +143,7 @@ public class RedactionLogController implements RedactionLogResource {
|
|||||||
public ResponseEntity<?> getDocumentPages(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId) {
|
public ResponseEntity<?> getDocumentPages(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
return buildZipFileResponseEntity(fileId, dossierId, FileType.DOCUMENT_PAGES);
|
||||||
HttpHeaders httpHeaders = new HttpHeaders();
|
|
||||||
httpHeaders.setContentType(MediaType.parseMediaType("application/zip"));
|
|
||||||
|
|
||||||
var fileStatus = fileStatusService.getStatus(fileId);
|
|
||||||
String filename = fileStatus.getFilename();
|
|
||||||
if (filename != null) {
|
|
||||||
var index = filename.lastIndexOf(".");
|
|
||||||
String prefix = filename.substring(0, index);
|
|
||||||
filename = prefix + ".json";
|
|
||||||
httpHeaders.add("Content-Disposition", "attachment; filename=" + prefix + ".zip");
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] zipBytes = getZippedBytes(dossierId, fileId, filename, FileType.DOCUMENT_PAGES);
|
|
||||||
return new ResponseEntity<>(zipBytes, httpHeaders, HttpStatus.OK);
|
|
||||||
|
|
||||||
} catch (FeignException e) {
|
} catch (FeignException e) {
|
||||||
throw processFeignException(e);
|
throw processFeignException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ public interface RedactionLogResource {
|
|||||||
|
|
||||||
@GetMapping(value = REDACTION_LOG_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(value = REDACTION_LOG_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@Operation(summary = "Gets the redaction log for a fileId", description = "None")
|
@Operation(summary = "Gets the redaction log for a fileId", description = "None")
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request " + "contains error."), @ApiResponse(responseCode = "404", description = "The redaction log is not found.")})
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The redaction log is not found.")})
|
||||||
RedactionLog getRedactionLog(@PathVariable(DOSSIER_ID) String dossierId,
|
RedactionLog getRedactionLog(@PathVariable(DOSSIER_ID) String dossierId,
|
||||||
@PathVariable(FILE_ID) String fileId,
|
@PathVariable(FILE_ID) String fileId,
|
||||||
@RequestParam(value = "excludedType", required = false) List<String> excludedTypes,
|
@RequestParam(value = "excludedType", required = false) List<String> excludedTypes,
|
||||||
@ -51,50 +51,50 @@ public interface RedactionLogResource {
|
|||||||
|
|
||||||
@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.")})
|
||||||
SectionGrid getSectionGrid(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
SectionGrid getSectionGrid(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
||||||
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@GetMapping(value = SECTION_TEXT_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE)
|
@GetMapping(value = SECTION_TEXT_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE)
|
||||||
@Operation(summary = "Gets the text blocks of a document for a fileId", description = "None")
|
@Operation(summary = "Gets the text blocks of a document 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 text is not found.")})
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The section text is not found.")})
|
||||||
ResponseEntity<?> getSectionText(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
ResponseEntity<?> getSectionText(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = DOCUMENT_TEXT_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE)
|
@GetMapping(value = DOCUMENT_TEXT_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE)
|
||||||
@Operation(summary = "Gets the text blocks of a document for a fileId", description = "None")
|
@Operation(summary = "Gets the text blocks of a document 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 text is not found.")})
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The document text is not found.")})
|
||||||
ResponseEntity<?> getDocumentText(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
ResponseEntity<?> getDocumentText(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = DOCUMENT_POSITIONS_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE)
|
@GetMapping(value = DOCUMENT_POSITIONS_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE)
|
||||||
@Operation(summary = "Gets the positions of the text blocks of a document for a fileId", description = "None")
|
@Operation(summary = "Gets the positions of the text blocks of a document 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 text is not found.")})
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The document positions is not found.")})
|
||||||
ResponseEntity<?> getDocumentPositions(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
ResponseEntity<?> getDocumentPositions(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = DOCUMENT_STRUCTURE_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE)
|
@GetMapping(value = DOCUMENT_STRUCTURE_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE)
|
||||||
@Operation(summary = "Gets the document structure for a fileId", description = "None")
|
@Operation(summary = "Gets the document structure 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 text is not found.")})
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The document structure is not found.")})
|
||||||
ResponseEntity<?> getDocumentStructure(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
ResponseEntity<?> getDocumentStructure(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = DOCUMENT_PAGES_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE)
|
@GetMapping(value = DOCUMENT_PAGES_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE)
|
||||||
@Operation(summary = "Gets the page information of a document for a fileId", description = "None")
|
@Operation(summary = "Gets the page information of a document 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 text is not found.")})
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The page information is not found.")})
|
||||||
ResponseEntity<?> getDocumentPages(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
ResponseEntity<?> getDocumentPages(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = SIMPLIFIED_SECTION_TEXT_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE)
|
@GetMapping(value = SIMPLIFIED_SECTION_TEXT_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE)
|
||||||
@Operation(summary = "Gets the simplified section text for a fileId", description = "None")
|
@Operation(summary = "Gets the simplified section text for a fileId", description = "None")
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request " + "contains error."), @ApiResponse(responseCode = "404", description = "The simplified section text is not found.")})
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The simplified section text is not found.")})
|
||||||
ResponseEntity<?> getSimplifiedSectionText(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
ResponseEntity<?> getSimplifiedSectionText(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
||||||
|
|
||||||
|
|
||||||
@PostMapping(value = REDACTION_LOG_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE + "/filtered", produces = MediaType.APPLICATION_JSON_VALUE)
|
@PostMapping(value = REDACTION_LOG_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE + "/filtered", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@Operation(summary = "Gets the redaction log for a fileId grater than the specified date", description = "None")
|
@Operation(summary = "Gets the redaction log for a fileId grater than the specified date", description = "None")
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request " + "contains error."), @ApiResponse(responseCode = "404", description = "The redaction log is not found.")})
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The redaction log is not found.")})
|
||||||
RedactionLog getFilteredRedactionLog(@PathVariable(DOSSIER_ID) String dossierId,
|
RedactionLog getFilteredRedactionLog(@PathVariable(DOSSIER_ID) String dossierId,
|
||||||
@PathVariable(FILE_ID) String fileId,
|
@PathVariable(FILE_ID) String fileId,
|
||||||
@RequestBody FilteredRedactionLogRequest filteredRedactionLogRequest);
|
@RequestBody FilteredRedactionLogRequest filteredRedactionLogRequest);
|
||||||
|
|||||||
@ -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.4.0</version>
|
<version>RED-6725-2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@ -61,7 +61,6 @@ public class FileStatusService {
|
|||||||
private final FileStatusPersistenceService fileStatusPersistenceService;
|
private final FileStatusPersistenceService fileStatusPersistenceService;
|
||||||
private final DossierPersistenceService dossierPersistenceService;
|
private final DossierPersistenceService dossierPersistenceService;
|
||||||
private final RabbitTemplate rabbitTemplate;
|
private final RabbitTemplate rabbitTemplate;
|
||||||
private final ObjectMapper objectMapper;
|
|
||||||
private final ManualRedactionProviderService manualRedactionProviderService;
|
private final ManualRedactionProviderService manualRedactionProviderService;
|
||||||
private final FileManagementStorageService fileManagementStorageService;
|
private final FileManagementStorageService fileManagementStorageService;
|
||||||
private final LegalBasisChangePersistenceService legalBasisChangePersistenceService;
|
private final LegalBasisChangePersistenceService legalBasisChangePersistenceService;
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public class LayoutParsingRequestFactory {
|
|||||||
|
|
||||||
return LayoutParsingRequest.builder()
|
return LayoutParsingRequest.builder()
|
||||||
.layoutParsingType(type)
|
.layoutParsingType(type)
|
||||||
.identifier(layoutParsingRequestIdentifierService.buildIdentifier(dossierId, fileId, priority, dossier.getDossierTemplateId()))
|
.identifier(layoutParsingRequestIdentifierService.buildIdentifier(dossierId, fileId, priority))
|
||||||
.originFileStorageId(StorageIdUtils.getStorageId(dossierId, fileId, FileType.ORIGIN))
|
.originFileStorageId(StorageIdUtils.getStorageId(dossierId, fileId, FileType.ORIGIN))
|
||||||
.imagesFileStorageId(optionalImageFileId)
|
.imagesFileStorageId(optionalImageFileId)
|
||||||
.tablesFileStorageId(optionalTableFileId)
|
.tablesFileStorageId(optionalTableFileId)
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.
|
|||||||
@Service
|
@Service
|
||||||
public class LayoutParsingRequestIdentifierService {
|
public class LayoutParsingRequestIdentifierService {
|
||||||
|
|
||||||
|
|
||||||
private enum IdentifierNames {
|
private enum IdentifierNames {
|
||||||
DOSSIER_ID,
|
DOSSIER_ID,
|
||||||
FILE_ID,
|
FILE_ID,
|
||||||
@ -18,12 +17,6 @@ public class LayoutParsingRequestIdentifierService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String parseDossierTemplateId(Map<String, String> identifiers) {
|
|
||||||
|
|
||||||
return identifiers.get(IdentifierNames.DOSSIER_TEMPLATE_ID.name());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String parseDossierId(Map<String, String> identifiers) {
|
public String parseDossierId(Map<String, String> identifiers) {
|
||||||
|
|
||||||
return identifiers.get(IdentifierNames.DOSSIER_ID.name());
|
return identifiers.get(IdentifierNames.DOSSIER_ID.name());
|
||||||
@ -42,16 +35,9 @@ public class LayoutParsingRequestIdentifierService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Map<String, String> buildIdentifier(String dossierId, String fileId, boolean priority, String dossierTemplateId) {
|
public Map<String, String> buildIdentifier(String dossierId, String fileId, boolean priority) {
|
||||||
|
|
||||||
return Map.of(IdentifierNames.DOSSIER_TEMPLATE_ID.name(),
|
return Map.of(IdentifierNames.DOSSIER_ID.name(), dossierId, IdentifierNames.FILE_ID.name(), fileId, IdentifierNames.PRIORITY.name(), String.valueOf(priority));
|
||||||
dossierTemplateId,
|
|
||||||
IdentifierNames.DOSSIER_ID.name(),
|
|
||||||
dossierId,
|
|
||||||
IdentifierNames.FILE_ID.name(),
|
|
||||||
fileId,
|
|
||||||
IdentifierNames.PRIORITY.name(),
|
|
||||||
String.valueOf(priority));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user