Pull request #143: Bugfix/RED-2772

Merge in RED/persistence-service from bugfix/RED-2772 to master

* commit '733cdd4f76f672b6d0723e3cc2a72132cf78bb34':
  RED-2772
This commit is contained in:
Timo Bejan 2021-12-06 13:30:02 +01:00
commit e9366d904d
2 changed files with 10 additions and 6 deletions

View File

@ -138,6 +138,7 @@ public class UploadController implements UploadResource {
var request = PdfTronRedactionRequest.builder()
.dossierTemplateId(dossier.getDossierTemplateId())
.applyWatermark(dossier.isWatermarkEnabled())
.document(fileManagementStorageService.getStoredObjectBytes(dossierId, fileId, FileType.ORIGIN))
.redactionLog(fileManagementStorageService.getRedactionLog(dossierId, fileId))
.build();
@ -156,6 +157,7 @@ public class UploadController implements UploadResource {
PdfTronRedactionResult pdfTronRedactionResult = pdfTronRedactionClient.redactionPreview(PdfTronRedactionRequest.builder()
.dossierTemplateId(dossier.getDossierTemplateId())
.applyWatermark(dossier.isWatermarkPreviewEnabled())
.document(fileManagementStorageService.getStoredObjectBytes(dossierId, fileId, FileType.ORIGIN))
.redactionLog(fileManagementStorageService.getRedactionLog(dossierId, fileId))
.build());

View File

@ -51,7 +51,7 @@ public class DownloadPreparationService {
try (FileSystemBackedArchiver fileSystemBackedArchiver = new FileSystemBackedArchiver()) {
generateAndAddFiles(downloadStatus, fileSystemBackedArchiver, dossier.isWatermarkEnabled());
generateAndAddFiles(downloadStatus, fileSystemBackedArchiver);
addReports(reportResultMessage, fileSystemBackedArchiver);
storeZipFile(downloadStatus, fileSystemBackedArchiver);
@ -67,8 +67,7 @@ public class DownloadPreparationService {
}
private void generateAndAddFiles(DownloadStatusEntity downloadStatus, FileSystemBackedArchiver fileSystemBackedArchiver,
boolean watermarkEnabled) {
private void generateAndAddFiles(DownloadStatusEntity downloadStatus, FileSystemBackedArchiver fileSystemBackedArchiver) {
int i = 1;
long fileGenerationStart = System.currentTimeMillis();
@ -89,13 +88,16 @@ public class DownloadPreparationService {
fileSystemBackedArchiver.addEntry(new FileSystemBackedArchiver.ArchiveModel("Original", fileStatus.getFilename(), original));
}
if (downloadFileType.name().equals(DownloadFileType.ANNOTATED.name())) {
fileSystemBackedArchiver.addEntry(new FileSystemBackedArchiver.ArchiveModel("Annotated", addSuffix(fileStatus.getFilename(), "annotated"), getAnnotated(dossier.getDossierTemplateId(), fileStatus.getDossierId(), fileId)));
fileSystemBackedArchiver.addEntry(new FileSystemBackedArchiver.ArchiveModel("Annotated", addSuffix(fileStatus.getFilename(), "annotated"),
getAnnotated(dossier.getDossierTemplateId(), fileStatus.getDossierId(), fileId)));
}
if (downloadFileType.name().equals(DownloadFileType.PREVIEW.name())) {
fileSystemBackedArchiver.addEntry(new FileSystemBackedArchiver.ArchiveModel("Preview", addSuffix(fileStatus.getFilename(), "highlighted"), getPreview(original, redactionLog, dossier.getDossierTemplateId(), watermarkEnabled)));
fileSystemBackedArchiver.addEntry(new FileSystemBackedArchiver.ArchiveModel("Preview", addSuffix(fileStatus.getFilename(), "highlighted"),
getPreview(original, redactionLog, dossier.getDossierTemplateId(), dossier.isWatermarkPreviewEnabled())));
}
if (downloadFileType.name().equals(DownloadFileType.REDACTED.name())) {
fileSystemBackedArchiver.addEntry(new FileSystemBackedArchiver.ArchiveModel("Redacted", addSuffix(fileStatus.getFilename(), "redacted"), getRedacted(original, redactionLog, dossier.getDossierTemplateId(), watermarkEnabled)));
fileSystemBackedArchiver.addEntry(new FileSystemBackedArchiver.ArchiveModel("Redacted", addSuffix(fileStatus.getFilename(), "redacted"),
getRedacted(original, redactionLog, dossier.getDossierTemplateId(), dossier.isWatermarkEnabled())));
}
}
log.info("Successfully added file {}/{} for downloadId {}, took {}", i, fileIds