Merge branch 'master' into RED-7918

This commit is contained in:
Corina Olariu 2023-11-16 15:08:29 +02:00
commit c455bdf5ce
6 changed files with 18 additions and 11 deletions

View File

@ -86,6 +86,10 @@ public class DownloadController implements DownloadResource {
@PreAuthorize("hasAuthority('" + PROCESS_DOWNLOAD + "')")
public DownloadResponse prepareDownload(@RequestBody PrepareDownloadRequest request) {
if (request.getIncludeUnprocessed() == null) {
request.setIncludeUnprocessed(true);
}
// check the user is non-member or reviewer
accessControlService.verifyUserIsDossierOwnerOrApprover(request.getDossierId());
var response = downloadService.prepareDownload(convert(request));

View File

@ -71,7 +71,7 @@ public class DownloadPreparationService {
downloadStatus.getFiles().forEach(fileEntity -> {
RedactionMessage message = messageBuilder.fileId(fileEntity.getId()).unapprovedFile(fileEntity.getWorkflowStatus() != WorkflowStatus.APPROVED).includeUnprocessed(reportResultMessage.isIncludeUnprocessed()).build();
RedactionMessage message = messageBuilder.fileId(fileEntity.getId()).unapprovedFile(fileEntity.getWorkflowStatus() != WorkflowStatus.APPROVED).includeUnprocessed(reportResultMessage.getIncludeUnprocessed()).build();
log.info("Sending redaction request for downloadId:{} fileId:{} to pdftron-redaction-queue", downloadId, fileEntity.getId());
rabbitTemplate.convertAndSend(MessagingConfiguration.PDFTRON_QUEUE, message);
});

View File

@ -117,7 +117,7 @@ public class ManualRedactionService {
log.info("add removeRedaction for file {} and annotation {}", fileId, removeRedactionRequest.getAnnotationId());
removeRedactionPersistenceService.insert(fileId, removeRedactionRequest);
if (manualAddRedactionsContains(manualRedactions, removeRedactionRequest.getAnnotationId())) {
if (manualAddToDictionaryRedactionsContains(manualRedactions, removeRedactionRequest.getAnnotationId())) {
log.info("hard delete ManualRedactions for file {} and annotation {}", fileId, removeRedactionRequest.getAnnotationId());
manualRedactionProviderService.hardDeleteManualRedactions(fileId, removeRedactionRequest.getAnnotationId());
continue;
@ -288,9 +288,9 @@ public class ManualRedactionService {
}
private boolean manualAddRedactionsContains(ManualRedactions manualRedactions, String annotationId) {
private boolean manualAddToDictionaryRedactionsContains(ManualRedactions manualRedactions, String annotationId) {
return manualRedactions.getEntriesToAdd().stream().anyMatch(m -> annotationId.equals(m.getAnnotationId()));
return manualRedactions.getEntriesToAdd().stream().anyMatch(m -> annotationId.equals(m.getAnnotationId()) && (m.isAddToDictionary() || m.isAddToDossierDictionary()));
}

View File

@ -140,6 +140,7 @@ public class DownloadPreparationTest extends AbstractPersistenceServerServiceTes
ReportResultMessage reportResultMessage = new ReportResultMessage();
reportResultMessage.setUserId(USER_ID);
reportResultMessage.setDownloadId(downloadId);
reportResultMessage.setIncludeUnprocessed(true);
downloadReportMessageReceiver.receive(reportResultMessage);
redactionResultMessageReceiver.receive(RedactionResultMessage.builder()

View File

@ -1617,7 +1617,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
@Test
public void testRemoveManualRedactionEntityRemovesAllManualRedactions() {
public void testNonDictionaryRemoveManualRedactionEntityDoesNotRemoveAllManualRedactions() {
var dossierTemplate = dossierTemplateTesterAndProvider.provideTestTemplate();
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate);
@ -1662,11 +1662,13 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.positions(List.of(new Rectangle(new Point(10, 10), 100, 100, 1)))
.build()));
manualRedactionClient.removeRedactionBulk(dossier.getId(), file.getId(), Set.of(RemoveRedactionRequestModel.builder().annotationId(annotationId).build()));
assertTrue(manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getEntriesToAdd().isEmpty());
assertTrue(manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getLegalBasisChanges().isEmpty());
assertTrue(manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getForceRedactions().isEmpty());
assertTrue(manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getRecategorizations().isEmpty());
assertTrue(manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getResizeRedactions().isEmpty());
// Only AddToDictionaries will remove all manual redactions.
assertEquals(1, manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getEntriesToAdd().size());
assertEquals(1, manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getLegalBasisChanges().size());
assertEquals(1, manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getForceRedactions().size());
assertEquals(1, manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getRecategorizations().size());
assertEquals(1, manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getResizeRedactions().size());
assertEquals(1, manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getIdsToRemove().size());
}

View File

@ -34,7 +34,7 @@
<redaction-service.version>4.165.0</redaction-service.version>
<search-service.version>2.71.0</search-service.version>
<pdftron-redaction-service.version>4.38.0</pdftron-redaction-service.version>
<redaction-report-service.version>4.31.0</redaction-report-service.version>
<redaction-report-service.version>4.33.0</redaction-report-service.version>
<ocr-service.version>3.10.0</ocr-service.version>
<storage.commons.version>2.45.0</storage.commons.version>
</properties>