Pull request #415: RED-3749-Remove digital signatures on upload
Merge in RED/persistence-service from feature/RED-3749 to master * commit 'd0b465e0e7c959cf5767d8269d900796e53a96b9': RED-3749-Remove digital signatures on upload
This commit is contained in:
commit
5912517849
@ -14,4 +14,5 @@ public class ApplicationConfig {
|
|||||||
private int downloadCleanupDownloadFilesHours;
|
private int downloadCleanupDownloadFilesHours;
|
||||||
private int downloadCleanupNotDownloadFilesHours;
|
private int downloadCleanupNotDownloadFilesHours;
|
||||||
private int softDeleteCleanupTime;
|
private int softDeleteCleanupTime;
|
||||||
|
private boolean removeDigitalSignaturesOnUpload;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,4 +31,7 @@ public class ApplicationConfigurationEntity {
|
|||||||
|
|
||||||
@Column
|
@Column
|
||||||
private int softDeleteCleanupTime = 96;
|
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.migration.Migration;
|
||||||
import com.iqser.red.service.peristence.v1.server.service.FileManagementStorageService;
|
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.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.DossierPersistenceService;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.FileStatusPersistenceService;
|
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;
|
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.file.FileType;
|
||||||
@ -32,6 +34,9 @@ public class MigrateHighlights3 extends Migration {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private FileManagementStorageService fileManagementStorageService;
|
private FileManagementStorageService fileManagementStorageService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationConfigService applicationConfigService;
|
||||||
|
|
||||||
public MigrateHighlights3() {
|
public MigrateHighlights3() {
|
||||||
|
|
||||||
super(NAME, VERSION);
|
super(NAME, VERSION);
|
||||||
@ -63,8 +68,10 @@ public class MigrateHighlights3 extends Migration {
|
|||||||
fileManagementStorageService.getStoredObjectBytes(dossier.getId(), file.getId(), FileType.ORIGIN));
|
fileManagementStorageService.getStoredObjectBytes(dossier.getId(), file.getId(), FileType.ORIGIN));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
ApplicationConfigurationEntity applicationConfigurationEntity = applicationConfigService.getApplicationConfig();
|
||||||
var response = pdfTronRedactionClient.processUntouchedDocument(ProcessUntouchedDocumentRequest.builder()
|
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());
|
fileStatusPersistenceService.updateHasHighlights(file.getId(), response.isHasHighlights());
|
||||||
} else {
|
} 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.ProcessUntouchedDocumentRequest;
|
||||||
import com.iqser.red.service.pdftron.redaction.v1.api.model.UntouchedDocumentResponse;
|
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.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.BadRequestException;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.exception.ConflictException;
|
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.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.DossierPersistenceService;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.ViewedPagesPersistenceService;
|
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.ViewedPagesPersistenceService;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.annotations.*;
|
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 LegalBasisChangePersistenceService legalBasisChangePersistenceService;
|
||||||
private final ResizeRedactionPersistenceService resizeRedactionPersistenceService;
|
private final ResizeRedactionPersistenceService resizeRedactionPersistenceService;
|
||||||
private final IndexingService indexingService;
|
private final IndexingService indexingService;
|
||||||
|
private final ApplicationConfigService applicationConfigService;
|
||||||
|
|
||||||
|
|
||||||
public JSONPrimitive<String> upload(AddFileRequest request, boolean keepManualRedactions) {
|
public JSONPrimitive<String> upload(AddFileRequest request, boolean keepManualRedactions) {
|
||||||
@ -67,9 +70,12 @@ public class FileService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
UntouchedDocumentResponse untouchedDocumentResponse;
|
UntouchedDocumentResponse untouchedDocumentResponse;
|
||||||
|
ApplicationConfigurationEntity applicationConfigurationEntity = applicationConfigService.getApplicationConfig();
|
||||||
try {
|
try {
|
||||||
untouchedDocumentResponse = pdfTronRedactionClient.processUntouchedDocument(ProcessUntouchedDocumentRequest.builder().dossierId(request.getDossierId())
|
untouchedDocumentResponse = pdfTronRedactionClient.processUntouchedDocument(ProcessUntouchedDocumentRequest.builder()
|
||||||
.fileId(request.getFileId()).fileName(request.getFilename()).build());
|
.dossierId(request.getDossierId())
|
||||||
|
.fileId(request.getFileId()).fileName(request.getFilename())
|
||||||
|
.removeDigitalSignaturesOnUpload(applicationConfigurationEntity.isRemoveDigitalSignaturesOnUpload()).build());
|
||||||
|
|
||||||
} catch (FeignException e) {
|
} catch (FeignException e) {
|
||||||
log.warn("Failed to optimize file: {}", request.getFilename(), 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
|
||||||
@ -69,3 +69,5 @@ databaseChangeLog:
|
|||||||
file: db/changelog/sql/27-update-soft-delete-date.sql
|
file: db/changelog/sql/27-update-soft-delete-date.sql
|
||||||
- include:
|
- include:
|
||||||
file: db/changelog/28-add-update-dictionary-to-manual-resize-redactions.yaml
|
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
|
||||||
|
|||||||
@ -16,16 +16,18 @@ public class ApplicationConfigTest extends AbstractPersistenceServerServiceTest
|
|||||||
@Test
|
@Test
|
||||||
public void testAppConfig() {
|
public void testAppConfig() {
|
||||||
ApplicationConfig appConfig = new ApplicationConfig().builder()
|
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);
|
var result = appConfigClient.createOrUpdateAppConfig(appConfig);
|
||||||
|
|
||||||
assertThat(result.getSoftDeleteCleanupTime()).isEqualTo(appConfig.getSoftDeleteCleanupTime());
|
assertThat(result.getSoftDeleteCleanupTime()).isEqualTo(appConfig.getSoftDeleteCleanupTime());
|
||||||
assertThat(result.getDownloadCleanupDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupDownloadFilesHours());
|
assertThat(result.getDownloadCleanupDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupDownloadFilesHours());
|
||||||
assertThat(result.getDownloadCleanupNotDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupNotDownloadFilesHours());
|
assertThat(result.getDownloadCleanupNotDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupNotDownloadFilesHours());
|
||||||
|
assertThat(result.isRemoveDigitalSignaturesOnUpload()).isEqualTo(appConfig.isRemoveDigitalSignaturesOnUpload());
|
||||||
var getResult = appConfigClient.getCurrentApplicationConfig();
|
var getResult = appConfigClient.getCurrentApplicationConfig();
|
||||||
assertThat(getResult.getSoftDeleteCleanupTime()).isEqualTo(appConfig.getSoftDeleteCleanupTime());
|
assertThat(getResult.getSoftDeleteCleanupTime()).isEqualTo(appConfig.getSoftDeleteCleanupTime());
|
||||||
assertThat(getResult.getDownloadCleanupDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupDownloadFilesHours());
|
assertThat(getResult.getDownloadCleanupDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupDownloadFilesHours());
|
||||||
assertThat(getResult.getDownloadCleanupNotDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupNotDownloadFilesHours());
|
assertThat(getResult.getDownloadCleanupNotDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupNotDownloadFilesHours());
|
||||||
|
assertThat(result.isRemoveDigitalSignaturesOnUpload()).isEqualTo(appConfig.isRemoveDigitalSignaturesOnUpload());
|
||||||
|
|
||||||
appConfig.setDownloadCleanupDownloadFilesHours(16);
|
appConfig.setDownloadCleanupDownloadFilesHours(16);
|
||||||
appConfig.setDownloadCleanupNotDownloadFilesHours(80);
|
appConfig.setDownloadCleanupNotDownloadFilesHours(80);
|
||||||
@ -36,5 +38,6 @@ public class ApplicationConfigTest extends AbstractPersistenceServerServiceTest
|
|||||||
assertThat(getResult.getSoftDeleteCleanupTime()).isEqualTo(appConfig.getSoftDeleteCleanupTime());
|
assertThat(getResult.getSoftDeleteCleanupTime()).isEqualTo(appConfig.getSoftDeleteCleanupTime());
|
||||||
assertThat(getResult.getDownloadCleanupDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupDownloadFilesHours());
|
assertThat(getResult.getDownloadCleanupDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupDownloadFilesHours());
|
||||||
assertThat(getResult.getDownloadCleanupNotDownloadFilesHours()).isEqualTo(appConfig.getDownloadCleanupNotDownloadFilesHours());
|
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.ByteContentDocument;
|
||||||
import com.iqser.red.service.pdftron.redaction.v1.api.model.UntouchedDocumentResponse;
|
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.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.assertj.core.util.Lists;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@ -66,6 +68,8 @@ public abstract class AbstractPersistenceServerServiceTest {
|
|||||||
@MockBean
|
@MockBean
|
||||||
protected PDFTronRedactionClient pdfTronRedactionClient;
|
protected PDFTronRedactionClient pdfTronRedactionClient;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
protected ApplicationConfigClient appConfigClient;
|
||||||
|
@Autowired
|
||||||
protected StorageService storageService;
|
protected StorageService storageService;
|
||||||
@Autowired
|
@Autowired
|
||||||
protected DossierTemplateRepository dossierTemplateRepository;
|
protected DossierTemplateRepository dossierTemplateRepository;
|
||||||
@ -138,7 +142,15 @@ public abstract class AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setupOptimize() {
|
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());
|
doNothing().when(pdfTronRedactionClient).testDigitalCurrentSignature(Mockito.any());
|
||||||
|
|
||||||
when(amqpAdmin.getQueueInfo(Mockito.any())).thenReturn(null);
|
when(amqpAdmin.getQueueInfo(Mockito.any())).thenReturn(null);
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<redaction-service.version>3.114.0</redaction-service.version>
|
<redaction-service.version>3.114.0</redaction-service.version>
|
||||||
<search-service.version>2.36.0</search-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>
|
<redaction-report-service.version>3.45.0</redaction-report-service.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user