RED-3749-Remove digital signatures on upload
- add add new field removeDigitalSignaturesOnUpload to application config - update junit tests
This commit is contained in:
parent
839deec6aa
commit
3dc62f986c
@ -14,4 +14,5 @@ public class ApplicationConfig {
|
||||
private int downloadCleanupDownloadFilesHours;
|
||||
private int downloadCleanupNotDownloadFilesHours;
|
||||
private int softDeleteCleanupTime;
|
||||
private boolean removeDigitalSignaturesOnUpload;
|
||||
}
|
||||
|
||||
@ -31,4 +31,7 @@ public class ApplicationConfigurationEntity {
|
||||
|
||||
@Column
|
||||
private int softDeleteCleanupTime = 96;
|
||||
|
||||
@Column
|
||||
private boolean removeDigitalSignaturesOnUpload;
|
||||
}
|
||||
|
||||
@ -4,6 +4,8 @@ import com.iqser.red.service.pdftron.redaction.v1.api.model.ProcessUntouchedDocu
|
||||
import com.iqser.red.service.peristence.v1.server.migration.Migration;
|
||||
import com.iqser.red.service.peristence.v1.server.service.FileManagementStorageService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.client.PDFTronRedactionClient;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.configuration.ApplicationConfigurationEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.ApplicationConfigService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.DossierPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.FileStatusPersistenceService;
|
||||
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.file.FileType;
|
||||
@ -32,6 +34,9 @@ public class MigrateHighlights3 extends Migration {
|
||||
@Autowired
|
||||
private FileManagementStorageService fileManagementStorageService;
|
||||
|
||||
@Autowired
|
||||
private ApplicationConfigService applicationConfigService;
|
||||
|
||||
public MigrateHighlights3() {
|
||||
|
||||
super(NAME, VERSION);
|
||||
@ -63,8 +68,10 @@ public class MigrateHighlights3 extends Migration {
|
||||
fileManagementStorageService.getStoredObjectBytes(dossier.getId(), file.getId(), FileType.ORIGIN));
|
||||
|
||||
}
|
||||
ApplicationConfigurationEntity applicationConfigurationEntity = applicationConfigService.getApplicationConfig();
|
||||
var response = pdfTronRedactionClient.processUntouchedDocument(ProcessUntouchedDocumentRequest.builder()
|
||||
.fileName(file.getFilename()).fileId(file.getId()).dossierId(file.getDossierId()).build());
|
||||
.fileName(file.getFilename()).fileId(file.getId()).dossierId(file.getDossierId())
|
||||
.removeDigitalSignaturesOnUpload(applicationConfigurationEntity.isRemoveDigitalSignaturesOnUpload()).build());
|
||||
|
||||
fileStatusPersistenceService.updateHasHighlights(file.getId(), response.isHasHighlights());
|
||||
} else {
|
||||
|
||||
@ -5,9 +5,11 @@ import com.google.common.hash.Hashing;
|
||||
import com.iqser.red.service.pdftron.redaction.v1.api.model.ProcessUntouchedDocumentRequest;
|
||||
import com.iqser.red.service.pdftron.redaction.v1.api.model.UntouchedDocumentResponse;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.client.PDFTronRedactionClient;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.entity.configuration.ApplicationConfigurationEntity;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.BadRequestException;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.ConflictException;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.NotFoundException;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.ApplicationConfigService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.DossierPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.ViewedPagesPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.annotations.*;
|
||||
@ -47,6 +49,7 @@ public class FileService {
|
||||
private final LegalBasisChangePersistenceService legalBasisChangePersistenceService;
|
||||
private final ResizeRedactionPersistenceService resizeRedactionPersistenceService;
|
||||
private final IndexingService indexingService;
|
||||
private final ApplicationConfigService applicationConfigService;
|
||||
|
||||
|
||||
public JSONPrimitive<String> upload(AddFileRequest request) {
|
||||
@ -67,9 +70,12 @@ public class FileService {
|
||||
}
|
||||
|
||||
UntouchedDocumentResponse untouchedDocumentResponse;
|
||||
ApplicationConfigurationEntity applicationConfigurationEntity = applicationConfigService.getApplicationConfig();
|
||||
try {
|
||||
untouchedDocumentResponse = pdfTronRedactionClient.processUntouchedDocument(ProcessUntouchedDocumentRequest.builder().dossierId(request.getDossierId())
|
||||
.fileId(request.getFileId()).fileName(request.getFilename()).build());
|
||||
untouchedDocumentResponse = pdfTronRedactionClient.processUntouchedDocument(ProcessUntouchedDocumentRequest.builder()
|
||||
.dossierId(request.getDossierId())
|
||||
.fileId(request.getFileId()).fileName(request.getFilename())
|
||||
.removeDigitalSignaturesOnUpload(applicationConfigurationEntity.isRemoveDigitalSignaturesOnUpload()).build());
|
||||
|
||||
} catch (FeignException e) {
|
||||
log.warn("Failed to optimize file: {}", request.getFilename(), e);
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
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
|
||||
@ -67,3 +67,5 @@ databaseChangeLog:
|
||||
file: db/changelog/sql/26-initiliaze-application-configuration-table.sql
|
||||
- include:
|
||||
file: db/changelog/sql/27-update-soft-delete-date.sql
|
||||
- include:
|
||||
file: db/changelog/28-add-remove-digital-signatures-on-upload.changelog.yaml
|
||||
|
||||
@ -16,16 +16,18 @@ public class ApplicationConfigTest extends AbstractPersistenceServerServiceTest
|
||||
@Test
|
||||
public void testAppConfig() {
|
||||
ApplicationConfig appConfig = new ApplicationConfig().builder()
|
||||
.downloadCleanupDownloadFilesHours(8).downloadCleanupNotDownloadFilesHours(72).softDeleteCleanupTime(96).build();
|
||||
.downloadCleanupDownloadFilesHours(8).downloadCleanupNotDownloadFilesHours(72).softDeleteCleanupTime(96).removeDigitalSignaturesOnUpload(true).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);
|
||||
@ -36,5 +38,6 @@ 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());
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,9 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import com.iqser.red.service.pdftron.redaction.v1.api.model.ByteContentDocument;
|
||||
import com.iqser.red.service.pdftron.redaction.v1.api.model.UntouchedDocumentResponse;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.client.ApplicationConfigClient;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository.*;
|
||||
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.configuration.ApplicationConfig;
|
||||
import org.assertj.core.util.Lists;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
@ -66,6 +68,8 @@ public abstract class AbstractPersistenceServerServiceTest {
|
||||
@MockBean
|
||||
protected PDFTronRedactionClient pdfTronRedactionClient;
|
||||
@Autowired
|
||||
protected ApplicationConfigClient appConfigClient;
|
||||
@Autowired
|
||||
protected StorageService storageService;
|
||||
@Autowired
|
||||
protected DossierTemplateRepository dossierTemplateRepository;
|
||||
@ -138,7 +142,15 @@ public abstract class AbstractPersistenceServerServiceTest {
|
||||
|
||||
@Before
|
||||
public void setupOptimize() {
|
||||
ApplicationConfig appConfig = new ApplicationConfig().builder()
|
||||
.downloadCleanupDownloadFilesHours(8).downloadCleanupNotDownloadFilesHours(72).softDeleteCleanupTime(96).removeDigitalSignaturesOnUpload(true).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);
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
<properties>
|
||||
<redaction-service.version>3.114.0</redaction-service.version>
|
||||
<search-service.version>2.36.0</search-service.version>
|
||||
<pdftron-redaction-service.version>3.80.0</pdftron-redaction-service.version>
|
||||
<pdftron-redaction-service.version>3.83.0</pdftron-redaction-service.version>
|
||||
<redaction-report-service.version>3.45.0</redaction-report-service.version>
|
||||
</properties>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user