RED-3749 Revert digital signature removal
This commit is contained in:
parent
568e59bb0d
commit
c8cfa82715
@ -14,5 +14,5 @@ public class ApplicationConfig {
|
||||
private int downloadCleanupDownloadFilesHours;
|
||||
private int downloadCleanupNotDownloadFilesHours;
|
||||
private int softDeleteCleanupTime;
|
||||
private boolean removeDigitalSignaturesOnUpload;
|
||||
|
||||
}
|
||||
|
||||
@ -32,6 +32,4 @@ public class ApplicationConfigurationEntity {
|
||||
@Column
|
||||
private int softDeleteCleanupTime = 96;
|
||||
|
||||
@Column
|
||||
private boolean removeDigitalSignaturesOnUpload;
|
||||
}
|
||||
|
||||
@ -70,8 +70,7 @@ public class MigrateHighlights3 extends Migration {
|
||||
}
|
||||
ApplicationConfigurationEntity applicationConfigurationEntity = applicationConfigService.getApplicationConfig();
|
||||
var response = pdfTronRedactionClient.processUntouchedDocument(ProcessUntouchedDocumentRequest.builder()
|
||||
.fileName(file.getFilename()).fileId(file.getId()).dossierId(file.getDossierId())
|
||||
.removeDigitalSignaturesOnUpload(applicationConfigurationEntity.isRemoveDigitalSignaturesOnUpload()).build());
|
||||
.fileName(file.getFilename()).fileId(file.getId()).dossierId(file.getDossierId()).build());
|
||||
|
||||
fileStatusPersistenceService.updateHasHighlights(file.getId(), response.isHasHighlights());
|
||||
} else {
|
||||
|
||||
@ -73,11 +73,11 @@ public class FileService {
|
||||
if (existingStatus != null) {
|
||||
// the file is already uploaded, just reanalyse it.
|
||||
|
||||
fileStatusService.overwriteFile(request.getDossierId(), request.getFileId(), request.getUploader(), request.getFilename(), keepManualRedactions, applicationConfigurationEntity.isRemoveDigitalSignaturesOnUpload());
|
||||
fileStatusService.overwriteFile(request.getDossierId(), request.getFileId(), request.getUploader(), request.getFilename(), keepManualRedactions);
|
||||
} else {
|
||||
// the file is new, should create a new status for it.
|
||||
log.info("File {} has no status yet, creating one and setting to unprocessed.", request.getFilename());
|
||||
fileStatusService.createStatus(request.getDossierId(), request.getFileId(), request.getUploader(), request.getFilename(), applicationConfigurationEntity.isRemoveDigitalSignaturesOnUpload());
|
||||
fileStatusService.createStatus(request.getDossierId(), request.getFileId(), request.getUploader(), request.getFilename());
|
||||
}
|
||||
|
||||
return new JSONPrimitive<>(request.getFileId());
|
||||
|
||||
@ -1,19 +1,5 @@
|
||||
package com.iqser.red.service.peristence.v1.server.service;
|
||||
|
||||
import static com.iqser.red.service.persistence.management.v1.processor.utils.MagicConverter.convert;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.Sets;
|
||||
@ -34,13 +20,7 @@ import com.iqser.red.service.persistence.management.v1.processor.service.persist
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.FileAttributeConfigPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.FileStatusPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.ViewedPagesPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.annotations.AddRedactionPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.annotations.CommentPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.annotations.ForceRedactionPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.annotations.ImageRecategorizationPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.annotations.LegalBasisChangePersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.annotations.RemoveRedactionPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.annotations.ResizeRedactionPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.annotations.*;
|
||||
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.file.FileModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.file.FileType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.file.ProcessingStatus;
|
||||
@ -48,10 +28,21 @@ import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.do
|
||||
import com.iqser.red.service.redaction.v1.model.AnalyzeRequest;
|
||||
import com.iqser.red.service.redaction.v1.model.AnalyzeResult;
|
||||
import com.iqser.red.service.redaction.v1.model.MessageType;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.iqser.red.service.persistence.management.v1.processor.utils.MagicConverter.convert;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@ -145,7 +136,7 @@ public class FileStatusService {
|
||||
fileStatusPersistenceService.updateProcessingStatusPreprocessingFailed(fileId);
|
||||
ApplicationConfigurationEntity applicationConfigurationEntity = applicationConfigService.getApplicationConfig();
|
||||
var fileEntity = fileStatusPersistenceService.getStatus(fileId);
|
||||
addToPreprocessingQueue(dossierId, fileId, fileEntity.getFilename(), applicationConfigurationEntity.isRemoveDigitalSignaturesOnUpload());
|
||||
addToPreprocessingQueue(dossierId, fileId, fileEntity.getFilename());
|
||||
}
|
||||
|
||||
|
||||
@ -248,14 +239,12 @@ public class FileStatusService {
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
public void addToPreprocessingQueue(String dossierId, String fileId, String filename,
|
||||
boolean removeDigitalSignatures) {
|
||||
public void addToPreprocessingQueue(String dossierId, String fileId, String filename) {
|
||||
|
||||
var processUntouchedDocumentRequest = ProcessUntouchedDocumentRequest.builder()
|
||||
.dossierId(dossierId)
|
||||
.fileId(fileId)
|
||||
.fileName(filename)
|
||||
.removeDigitalSignaturesOnUpload(removeDigitalSignatures)
|
||||
.build();
|
||||
|
||||
setStatusPreProcessing(fileId);
|
||||
@ -365,11 +354,10 @@ public class FileStatusService {
|
||||
|
||||
|
||||
@Transactional
|
||||
public void createStatus(String dossierId, String fileId, String uploader, String filename,
|
||||
boolean removeDigitalSignatures) {
|
||||
public void createStatus(String dossierId, String fileId, String uploader, String filename) {
|
||||
|
||||
fileStatusPersistenceService.createStatus(dossierId, fileId, filename, uploader);
|
||||
addToPreprocessingQueue(dossierId, fileId, filename, removeDigitalSignatures);
|
||||
addToPreprocessingQueue(dossierId, fileId, filename);
|
||||
}
|
||||
|
||||
|
||||
@ -525,8 +513,7 @@ public class FileStatusService {
|
||||
}
|
||||
|
||||
|
||||
public void overwriteFile(String dossierId, String fileId, String uploader, String filename,
|
||||
boolean keepManualRedactions, boolean removeDigitalSignatures) {
|
||||
public void overwriteFile(String dossierId, String fileId, String uploader, String filename, boolean keepManualRedactions) {
|
||||
|
||||
fileManagementStorageService.deleteObject(dossierId, fileId, FileType.REDACTION_LOG);
|
||||
fileManagementStorageService.deleteObject(dossierId, fileId, FileType.SECTION_GRID);
|
||||
@ -543,7 +530,7 @@ public class FileStatusService {
|
||||
|
||||
viewedPagesPersistenceService.deleteForFile(fileId);
|
||||
|
||||
addToPreprocessingQueue(dossierId, fileId, filename, removeDigitalSignatures);
|
||||
addToPreprocessingQueue(dossierId, fileId, filename);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
databaseChangeLog:
|
||||
- changeSet:
|
||||
id: add-remove-digital-signatures-on-upload
|
||||
author: corina
|
||||
changes:
|
||||
- addColumn:
|
||||
columns:
|
||||
- column:
|
||||
name: remove_digital_signatures_on_upload
|
||||
type: BOOLEAN
|
||||
defaultValue: false
|
||||
tableName: application_configuration
|
||||
@ -69,7 +69,5 @@ databaseChangeLog:
|
||||
file: db/changelog/sql/27-update-soft-delete-date.sql
|
||||
- include:
|
||||
file: db/changelog/28-add-update-dictionary-to-manual-resize-redactions.yaml
|
||||
- include:
|
||||
file: db/changelog/29-add-remove-digital-signatures-on-upload.changelog.yaml
|
||||
- include:
|
||||
file: db/changelog/sql/30-change-bigint-to-serial.sql
|
||||
|
||||
@ -16,18 +16,16 @@ public class ApplicationConfigTest extends AbstractPersistenceServerServiceTest
|
||||
@Test
|
||||
public void testAppConfig() {
|
||||
ApplicationConfig appConfig = new ApplicationConfig().builder()
|
||||
.downloadCleanupDownloadFilesHours(8).downloadCleanupNotDownloadFilesHours(72).softDeleteCleanupTime(96).removeDigitalSignaturesOnUpload(true).build();
|
||||
.downloadCleanupDownloadFilesHours(8).downloadCleanupNotDownloadFilesHours(72).softDeleteCleanupTime(96).build();
|
||||
var result = appConfigClient.createOrUpdateAppConfig(appConfig);
|
||||
|
||||
assertThat(result.getSoftDeleteCleanupTime()).isEqualTo(appConfig.getSoftDeleteCleanupTime());
|
||||
assertThat(result.getDownloadCleanupDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupDownloadFilesHours());
|
||||
assertThat(result.getDownloadCleanupNotDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupNotDownloadFilesHours());
|
||||
assertThat(result.isRemoveDigitalSignaturesOnUpload()).isEqualTo(appConfig.isRemoveDigitalSignaturesOnUpload());
|
||||
var getResult = appConfigClient.getCurrentApplicationConfig();
|
||||
assertThat(getResult.getSoftDeleteCleanupTime()).isEqualTo(appConfig.getSoftDeleteCleanupTime());
|
||||
assertThat(getResult.getDownloadCleanupDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupDownloadFilesHours());
|
||||
assertThat(getResult.getDownloadCleanupNotDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupNotDownloadFilesHours());
|
||||
assertThat(result.isRemoveDigitalSignaturesOnUpload()).isEqualTo(appConfig.isRemoveDigitalSignaturesOnUpload());
|
||||
|
||||
appConfig.setDownloadCleanupDownloadFilesHours(16);
|
||||
appConfig.setDownloadCleanupNotDownloadFilesHours(80);
|
||||
@ -38,6 +36,5 @@ public class ApplicationConfigTest extends AbstractPersistenceServerServiceTest
|
||||
assertThat(getResult.getSoftDeleteCleanupTime()).isEqualTo(appConfig.getSoftDeleteCleanupTime());
|
||||
assertThat(getResult.getDownloadCleanupDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupDownloadFilesHours());
|
||||
assertThat(getResult.getDownloadCleanupNotDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupNotDownloadFilesHours());
|
||||
assertThat(result.isRemoveDigitalSignaturesOnUpload()).isEqualTo(appConfig.isRemoveDigitalSignaturesOnUpload());
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,14 +136,14 @@ public abstract class AbstractPersistenceServerServiceTest {
|
||||
@Before
|
||||
public void setupOptimize() {
|
||||
ApplicationConfig appConfig = new ApplicationConfig().builder()
|
||||
.downloadCleanupDownloadFilesHours(8).downloadCleanupNotDownloadFilesHours(72).softDeleteCleanupTime(96).removeDigitalSignaturesOnUpload(true).build();
|
||||
.downloadCleanupDownloadFilesHours(8).downloadCleanupNotDownloadFilesHours(72).softDeleteCleanupTime(96).build();
|
||||
appConfigClient.createOrUpdateAppConfig(appConfig);
|
||||
|
||||
// when(appConfigClient.getCurrentApplicationConfig()).thenReturn(ApplicationConfig.builder()
|
||||
// .downloadCleanupDownloadFilesHours(8)
|
||||
// .downloadCleanupNotDownloadFilesHours(72)
|
||||
// .softDeleteCleanupTime(96)
|
||||
// .removeDigitalSignaturesOnUpload(true).build());
|
||||
|
||||
doNothing().when(pdfTronRedactionClient).testDigitalCurrentSignature(Mockito.any());
|
||||
|
||||
when(amqpAdmin.getQueueInfo(Mockito.any())).thenReturn(null);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user