This commit is contained in:
Timo Bejan 2021-12-06 11:03:15 +02:00
parent a65a916338
commit 733cdd4f76
2 changed files with 10 additions and 6 deletions

View File

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

View File

@ -51,7 +51,7 @@ public class DownloadPreparationService {
try (FileSystemBackedArchiver fileSystemBackedArchiver = new FileSystemBackedArchiver()) { try (FileSystemBackedArchiver fileSystemBackedArchiver = new FileSystemBackedArchiver()) {
generateAndAddFiles(downloadStatus, fileSystemBackedArchiver, dossier.isWatermarkEnabled()); generateAndAddFiles(downloadStatus, fileSystemBackedArchiver);
addReports(reportResultMessage, fileSystemBackedArchiver); addReports(reportResultMessage, fileSystemBackedArchiver);
storeZipFile(downloadStatus, fileSystemBackedArchiver); storeZipFile(downloadStatus, fileSystemBackedArchiver);
@ -67,8 +67,7 @@ public class DownloadPreparationService {
} }
private void generateAndAddFiles(DownloadStatusEntity downloadStatus, FileSystemBackedArchiver fileSystemBackedArchiver, private void generateAndAddFiles(DownloadStatusEntity downloadStatus, FileSystemBackedArchiver fileSystemBackedArchiver) {
boolean watermarkEnabled) {
int i = 1; int i = 1;
long fileGenerationStart = System.currentTimeMillis(); long fileGenerationStart = System.currentTimeMillis();
@ -89,13 +88,16 @@ public class DownloadPreparationService {
fileSystemBackedArchiver.addEntry(new FileSystemBackedArchiver.ArchiveModel("Original", fileStatus.getFilename(), original)); fileSystemBackedArchiver.addEntry(new FileSystemBackedArchiver.ArchiveModel("Original", fileStatus.getFilename(), original));
} }
if (downloadFileType.name().equals(DownloadFileType.ANNOTATED.name())) { 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())) { 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())) { 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 log.info("Successfully added file {}/{} for downloadId {}, took {}", i, fileIds