diff --git a/persistence-service-v1/persistence-service-external-api-impl-v1/src/main/java/com/iqser/red/persistence/service/v1/external/api/impl/controller/ManualRedactionController.java b/persistence-service-v1/persistence-service-external-api-impl-v1/src/main/java/com/iqser/red/persistence/service/v1/external/api/impl/controller/ManualRedactionController.java index 93baa6b1f..ad08adc72 100644 --- a/persistence-service-v1/persistence-service-external-api-impl-v1/src/main/java/com/iqser/red/persistence/service/v1/external/api/impl/controller/ManualRedactionController.java +++ b/persistence-service-v1/persistence-service-external-api-impl-v1/src/main/java/com/iqser/red/persistence/service/v1/external/api/impl/controller/ManualRedactionController.java @@ -252,8 +252,7 @@ public class ManualRedactionController implements ManualRedactionResource { @PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')") public ManualRedactionResponse removeRedactionBulk(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, - @RequestBody Set removeRedactionRequests, - @RequestParam(value = "includeUnprocessed", required = false, defaultValue = FALSE) boolean includeUnprocessed) { + @RequestBody Set removeRedactionRequests) { var dossier = dossierManagementService.getDossierById(dossierId, false, false); verifyAccessForDossier(dossierId, @@ -265,7 +264,7 @@ public class ManualRedactionController implements ManualRedactionResource { fileId, removeRedactionRequests, dossier.getDossierTemplateId(), - includeUnprocessed); + true); responseList.forEach(response -> auditPersistenceService.audit(AuditRequest.builder() .userId(KeycloakSecurity.getUserId()) @@ -282,8 +281,7 @@ public class ManualRedactionController implements ManualRedactionResource { @PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')") public ManualRedactionResponse removeRedactionBulkLocal(String dossierId, String fileId, - RemoveRedactionBulkLocalRequestModel removeRedactionRequest, - boolean includeUnprocessed) { + RemoveRedactionBulkLocalRequestModel removeRedactionRequest) { verifyAccess(dossierId, fileId); verifyRequest(removeRedactionRequest.isRectangle(), removeRedactionRequest.getPosition(), removeRedactionRequest.getValue()); @@ -309,7 +307,7 @@ public class ManualRedactionController implements ManualRedactionResource { List filteredEntityLogResponses = getFilteredEntityLogResponses(dossierId, fileId, - includeUnprocessed, + true, removeRedactionRequest.isRectangle(), removeRedactionRequest.getValue(), removeRedactionRequest.isCaseSensitive(), @@ -322,7 +320,7 @@ public class ManualRedactionController implements ManualRedactionResource { .map(entityLogEntry -> RemoveRedactionRequestModel.builder().annotationId(entityLogEntry.getId()).comment(removeRedactionRequest.getComment()).build()) .collect(Collectors.toSet()); } - return removeRedactionBulk(dossierId, fileId, removeRedactionRequestModels, includeUnprocessed); + return removeRedactionBulk(dossierId, fileId, removeRedactionRequestModels); } @@ -371,13 +369,12 @@ public class ManualRedactionController implements ManualRedactionResource { @PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')") public ManualRedactionResponse recategorizeBulk(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, - @RequestBody Set recategorizationRequests, - @RequestParam(value = "includeUnprocessed", required = false, defaultValue = FALSE) boolean includeUnprocessed) { + @RequestBody Set recategorizationRequests) { var dossier = dossierManagementService.getDossierById(dossierId, false, false); verifyAccess(dossierId, fileId); - List responseList = manualRedactionService.addRecategorization(dossierId, fileId, dossier, recategorizationRequests, includeUnprocessed); + List responseList = manualRedactionService.addRecategorization(dossierId, fileId, dossier, recategorizationRequests, true); responseList.forEach(response -> auditPersistenceService.audit(AuditRequest.builder() .userId(KeycloakSecurity.getUserId()) @@ -394,8 +391,7 @@ public class ManualRedactionController implements ManualRedactionResource { @PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')") public ManualRedactionResponse recategorizeBulkLocal(String dossierId, String fileId, - RecategorizationBulkLocalRequestModel recategorizationRequest, - boolean includeUnprocessed) { + RecategorizationBulkLocalRequestModel recategorizationRequest) { verifyAccess(dossierId, fileId); verifyRequest(recategorizationRequest.isRectangle(), recategorizationRequest.getPosition(), recategorizationRequest.getValue()); @@ -428,7 +424,7 @@ public class ManualRedactionController implements ManualRedactionResource { List filteredEntityLogResponses = getFilteredEntityLogResponses(dossierId, fileId, - includeUnprocessed, + true, recategorizationRequest.isRectangle(), recategorizationRequest.getValue(), recategorizationRequest.isCaseSensitive(), @@ -449,19 +445,18 @@ public class ManualRedactionController implements ManualRedactionResource { .collect(Collectors.toSet()); } - return recategorizeBulk(dossierId, fileId, recategorizationRequestModels, includeUnprocessed); + return recategorizeBulk(dossierId, fileId, recategorizationRequestModels); } @PreAuthorize("hasAuthority('" + DO_MANUAL_REDACTION + "')") public ManualRedactionResponse resizeRedactionBulk(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, - @RequestBody Set resizeRedactionRequests, - @RequestParam(value = "includeUnprocessed", required = false, defaultValue = FALSE) boolean includeUnprocessed) { + @RequestBody Set resizeRedactionRequests) { verifyAccessAndDossierExistence(dossierId, fileId); - List responseList = manualRedactionService.addResizeRedaction(dossierId, fileId, resizeRedactionRequests, includeUnprocessed); + List responseList = manualRedactionService.addResizeRedaction(dossierId, fileId, resizeRedactionRequests, true); responseList.forEach(response -> auditPersistenceService.audit(AuditRequest.builder() .userId(KeycloakSecurity.getUserId()) diff --git a/persistence-service-v1/persistence-service-external-api-v1/src/main/java/com/iqser/red/service/persistence/service/v1/api/external/resource/ManualRedactionResource.java b/persistence-service-v1/persistence-service-external-api-v1/src/main/java/com/iqser/red/service/persistence/service/v1/api/external/resource/ManualRedactionResource.java index 4814b8c20..829ddaad2 100644 --- a/persistence-service-v1/persistence-service-external-api-v1/src/main/java/com/iqser/red/service/persistence/service/v1/api/external/resource/ManualRedactionResource.java +++ b/persistence-service-v1/persistence-service-external-api-v1/src/main/java/com/iqser/red/service/persistence/service/v1/api/external/resource/ManualRedactionResource.java @@ -119,8 +119,7 @@ public interface ManualRedactionResource { @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "Dossier or file not found"), @ApiResponse(responseCode = "403", description = "Forbidden")}) ManualRedactionResponse removeRedactionBulkLocal(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, - @RequestBody RemoveRedactionBulkLocalRequestModel removeRedactionRequest, - @RequestParam(value = "includeUnprocessed", required = false, defaultValue = FALSE) boolean includeUnprocessed); + @RequestBody RemoveRedactionBulkLocalRequestModel removeRedactionRequest); @ResponseStatus(value = HttpStatus.OK) @@ -132,8 +131,7 @@ public interface ManualRedactionResource { @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "Dossier or file not found"), @ApiResponse(responseCode = "403", description = "Forbidden")}) ManualRedactionResponse removeRedactionBulk(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, - @RequestBody Set removeRedactionRequests, - @RequestParam(value = "includeUnprocessed", required = false, defaultValue = FALSE) boolean includeUnprocessed); + @RequestBody Set removeRedactionRequests); @ResponseStatus(value = HttpStatus.OK) @@ -170,8 +168,7 @@ public interface ManualRedactionResource { @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "Dossier or file not found"), @ApiResponse(responseCode = "403", description = "Forbidden")}) ManualRedactionResponse recategorizeBulk(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, - @RequestBody Set recategorizationRequests, - @RequestParam(value = "includeUnprocessed", required = false, defaultValue = FALSE) boolean includeUnprocessed); + @RequestBody Set recategorizationRequests); @ResponseStatus(value = HttpStatus.OK) @@ -183,8 +180,7 @@ public interface ManualRedactionResource { @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "Dossier or file not found"), @ApiResponse(responseCode = "403", description = "Forbidden")}) ManualRedactionResponse recategorizeBulkLocal(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, - @RequestBody RecategorizationBulkLocalRequestModel recategorizationRequest, - @RequestParam(value = "includeUnprocessed", required = false, defaultValue = FALSE) boolean includeUnprocessed); + @RequestBody RecategorizationBulkLocalRequestModel recategorizationRequest); @ResponseStatus(value = HttpStatus.OK) @@ -196,8 +192,7 @@ public interface ManualRedactionResource { @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Dossier or file not found"), @ApiResponse(responseCode = "403", description = "Forbidden")}) ManualRedactionResponse resizeRedactionBulk(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, - @RequestBody Set resizeRedactionRequests, - @RequestParam(value = "includeUnprocessed", required = false, defaultValue = FALSE) boolean includeUnprocessed); + @RequestBody Set resizeRedactionRequests); @ResponseStatus(value = HttpStatus.OK) diff --git a/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/service/manualredactions/ManualRedactionMapper.java b/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/service/manualredactions/ManualRedactionMapper.java index fe7d93be2..3d6e5cce8 100644 --- a/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/service/manualredactions/ManualRedactionMapper.java +++ b/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/service/manualredactions/ManualRedactionMapper.java @@ -108,7 +108,7 @@ public class ManualRedactionMapper { for (EntityLogEntry entityLogEntry : entityLogEntriesWithId) { - if (invalidDictionaryRequest(removeRedactionRequest, entityLogEntry) || invalidLocalRequest(removeRedactionRequest, entityLogEntry)) { + if (entityLogEntry.getState().equals(EntryState.PENDING) || entityLogEntry.getState().equals(EntryState.REMOVED)) { continue; } @@ -135,24 +135,6 @@ public class ManualRedactionMapper { } - private static boolean invalidLocalRequest(RemoveRedactionRequestModel removeRedactionRequest, EntityLogEntry entityLogEntry) { - - return !isDictionaryRequest(removeRedactionRequest) && entityLogEntry.getState().equals(EntryState.REMOVED); - } - - - private static boolean isDictionaryRequest(RemoveRedactionRequestModel removeRedactionRequest) { - - return removeRedactionRequest.isRemoveFromDictionary() || removeRedactionRequest.isRemoveFromAllDossiers(); - } - - - private static boolean invalidDictionaryRequest(RemoveRedactionRequestModel removeRedactionRequest, EntityLogEntry entityLogEntry) { - - return isDictionaryRequest(removeRedactionRequest) && entityLogEntry.getState().equals(EntryState.PENDING); - } - - public List> toForceRedactionRequestList(String dossierId, String fileId, Set forceRedactionRequests, @@ -247,7 +229,7 @@ public class ManualRedactionMapper { for (EntityLogEntry entityLogEntry : entityLogEntriesById) { - if (invalidDictionaryRequest(recategorizationRequest, entityLogEntry) || invalidLocalRequest(recategorizationRequest, entityLogEntry)) { + if (entityLogEntry.getState().equals(EntryState.PENDING) || entityLogEntry.getState().equals(EntryState.REMOVED)) { continue; } @@ -305,24 +287,6 @@ public class ManualRedactionMapper { } - private static boolean invalidLocalRequest(RecategorizationRequestModel removeRedactionRequest, EntityLogEntry entityLogEntry) { - - return !isDictionaryRequest(removeRedactionRequest) && entityLogEntry.getState().equals(EntryState.REMOVED); - } - - - private static boolean isDictionaryRequest(RecategorizationRequestModel removeRedactionRequest) { - - return removeRedactionRequest.isAddToDictionary() || removeRedactionRequest.isAddToAllDossiers(); - } - - - private static boolean invalidDictionaryRequest(RecategorizationRequestModel removeRedactionRequest, EntityLogEntry entityLogEntry) { - - return isDictionaryRequest(removeRedactionRequest) && entityLogEntry.getState().equals(EntryState.PENDING); - } - - private void checkSectionLength(String changedSection) { if (changedSection == null) { @@ -366,8 +330,11 @@ public class ManualRedactionMapper { List> requests = new ArrayList<>(); for (ResizeRedactionRequestModel resizeRedactionRequest : resizeRedactionRequests) { + for (EntityLogEntry entityLogEntry : entityLogEntries) { - entityLogEntries.forEach(entityLogEntry -> { + if (entityLogEntry.getState().equals(EntryState.PENDING) || entityLogEntry.getState().equals(EntryState.REMOVED)) { + continue; + } String uuid = UUID.randomUUID().toString(); ResizeRedactionRequest request = ResizeRedactionRequest.builder() @@ -392,7 +359,7 @@ public class ManualRedactionMapper { } requests.add(RequestEntryPair.builder().request(request).entityLogEntry(entityLogEntry).build()); - }); + } } diff --git a/persistence-service-v1/persistence-service-server-v1/src/test/java/com/iqser/red/service/peristence/v1/server/integration/tests/FileTest.java b/persistence-service-v1/persistence-service-server-v1/src/test/java/com/iqser/red/service/peristence/v1/server/integration/tests/FileTest.java index 02d9947ed..00232e782 100644 --- a/persistence-service-v1/persistence-service-server-v1/src/test/java/com/iqser/red/service/peristence/v1/server/integration/tests/FileTest.java +++ b/persistence-service-v1/persistence-service-server-v1/src/test/java/com/iqser/red/service/peristence/v1/server/integration/tests/FileTest.java @@ -28,7 +28,6 @@ import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.InputStreamResource; import org.springframework.mock.web.MockMultipartFile; import com.github.dockerjava.zerodep.shaded.org.apache.commons.codec.binary.Base64; @@ -465,28 +464,26 @@ public class FileTest extends AbstractPersistenceServerServiceTest { manualRedactionClient.removeRedactionBulk(dossierId, fileId, - Set.of(RemoveRedactionRequestModel.builder().annotationId(annotationId).comment("comment").removeFromDictionary(false).build()), - false); + Set.of(RemoveRedactionRequestModel.builder().annotationId(annotationId).comment("removeComment").removeFromDictionary(false).build())); manualRedactionClient.forceRedactionBulk(dossierId, fileId, - Set.of(ForceRedactionRequestModel.builder().annotationId("forceRedactionAnnotation").comment("comment").legalBasis("1").build())); + Set.of(ForceRedactionRequestModel.builder().annotationId("forceRedactionAnnotation").comment("forceComment").legalBasis("1").build())); manualRedactionClient.legalBasisChangeBulk(dossierId, fileId, Set.of(LegalBasisChangeRequestModel.builder() .annotationId("legalBasisChangeAnnotation") - .comment("comment") + .comment("legalBasisComment") .legalBasis("1") .build())); manualRedactionClient.recategorizeBulk(dossierId, fileId, Set.of(RecategorizationRequestModel.builder() .annotationId(annotationId) - .comment("comment") + .comment("recategorizationComment") .type("new-type") .legalBasis(null) .section("section") - .build()), - false); + .build())); manualRedactionClient.addComment(dossierId, fileId, commentId, AddCommentRequestModel.builder().text("comment added via text fileId").build()); @@ -496,7 +493,7 @@ public class FileTest extends AbstractPersistenceServerServiceTest { AnnotationComments annotationComments = manualRedactionClient.getComments(dossierId, fileId, commentId); assertThat(annotationComments.getComments()).hasSize(1); AnnotationComments annotationCommentsForManualRedactions = manualRedactionClient.getComments(dossierId, fileId, annotationId); - assertThat(annotationCommentsForManualRedactions.getComments()).hasSize(1); + assertThat(annotationCommentsForManualRedactions.getComments()).hasSize(2); fileManagementClient.deleteFile(dossier.getId(), file.getId()); var softDeletedFiles = fileClient.getSoftDeletedDossierStatus(dossier.getId()); @@ -520,7 +517,7 @@ public class FileTest extends AbstractPersistenceServerServiceTest { annotationComments = manualRedactionClient.getComments(dossierId, fileId, commentId); assertThat(annotationComments.getComments()).hasSize(1); annotationCommentsForManualRedactions = manualRedactionClient.getComments(dossierId, fileId, annotationId); - assertThat(annotationCommentsForManualRedactions.getComments()).hasSize(1); + assertThat(annotationCommentsForManualRedactions.getComments()).hasSize(2); fileManagementClient.hardDeleteFiles(dossier.getId(), List.of(file.getId())); softDeletedFiles = fileClient.getSoftDeletedDossierStatus(dossier.getId()); @@ -812,8 +809,7 @@ public class FileTest extends AbstractPersistenceServerServiceTest { .legalBasis("") .section("section") .value("value entry 3") - .build()), - false); + .build())); var loadedFile = fileClient.getFileStatus(dossierId, fileId); diff --git a/persistence-service-v1/persistence-service-server-v1/src/test/java/com/iqser/red/service/peristence/v1/server/integration/tests/ManualRedactionTest.java b/persistence-service-v1/persistence-service-server-v1/src/test/java/com/iqser/red/service/peristence/v1/server/integration/tests/ManualRedactionTest.java index e7af44201..afc7b39a7 100644 --- a/persistence-service-v1/persistence-service-server-v1/src/test/java/com/iqser/red/service/peristence/v1/server/integration/tests/ManualRedactionTest.java +++ b/persistence-service-v1/persistence-service-server-v1/src/test/java/com/iqser/red/service/peristence/v1/server/integration/tests/ManualRedactionTest.java @@ -196,8 +196,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .annotationId("AnnotationId") .removeFromDictionary(true) .removeFromAllDossiers(true) - .build()), - false));//.get(0); + .build())));//.get(0); var dossierTemplateDictionary = internalDictionaryClient.getDictionaryForType(toTypeId(type.getType(), dossierTemplate.getId()), null); assertThat(dossierTemplateDictionary.getEntries().size()).isZero(); @@ -389,8 +388,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .annotationId("AnnotationId") .removeFromDictionary(true) .removeFromAllDossiers(true) - .build()), - false); + .build())); dossierTemplateDictionary = dictionaryClient.getDictionaryForType(type.getType(), type.getDossierTemplateId(), null); assertThat(dossierTemplateDictionary.getEntries()).containsExactlyInAnyOrder("Darth Vader"); @@ -445,8 +443,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { manualRedactionClient.removeRedactionBulk(dossier.getId(), file.getId(), - Set.of(RemoveRedactionRequestModel.builder().annotationId("AnnotationId").removeFromDictionary(true).build()), - false).getManualAnnotationResponses() + Set.of(RemoveRedactionRequestModel.builder().annotationId("AnnotationId").removeFromDictionary(true).build())).getManualAnnotationResponses() .get(0); var dossierDictionary = internalDictionaryClient.getDictionaryForType(toTypeId(type.getType(), dossierTemplate.getId(), dossier.getId()), null); @@ -504,8 +501,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .annotationId("AnnotationId") .removeFromDictionary(true) .removeFromAllDossiers(true) - .build()), - false).getManualAnnotationResponses() + .build())).getManualAnnotationResponses() .get(0); var dossierDictionary = internalDictionaryClient.getDictionaryForType(toTypeId(type.getType(), dossierTemplate.getId(), dossier.getId()), null); @@ -625,7 +621,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .addToAllDossiers(true) .build(); - manualRedactionClient.resizeRedactionBulk(dossier1.getId(), file1.getFileId(), Set.of(resizeRedactionDosAndAddToAllDos), false); + manualRedactionClient.resizeRedactionBulk(dossier1.getId(), file1.getFileId(), Set.of(resizeRedactionDosAndAddToAllDos)); loadedRedactionsFile1 = manualRedactionClient.getManualRedactions(file1.getDossierId(), file1.getFileId(), false, true); @@ -794,7 +790,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .addToAllDossiers(true) .build(); - manualRedactionClient.resizeRedactionBulk(dossier1.getId(), file1.getFileId(), Set.of(resizeRedactionDosAndAddToAllDos), false); + manualRedactionClient.resizeRedactionBulk(dossier1.getId(), file1.getFileId(), Set.of(resizeRedactionDosAndAddToAllDos)); loadedRedactionsFile1 = manualRedactionClient.getManualRedactions(file1.getDossierId(), file1.getFileId(), false, true); @@ -967,7 +963,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .addToAllDossiers(true) .build(); - var resizeRedactions = manualRedactionClient.resizeRedactionBulk(dossier2.getId(), file2.getFileId(), Set.of(resizeRedactionDosTemp), false); + var resizeRedactions = manualRedactionClient.resizeRedactionBulk(dossier2.getId(), file2.getFileId(), Set.of(resizeRedactionDosTemp)); var loadedRedactionsFile2 = manualRedactionClient.getManualRedactions(file2.getDossierId(), file2.getFileId(), false, true); @@ -1137,7 +1133,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .addToAllDossiers(true) .build(); - var resizeRedactions = manualRedactionClient.resizeRedactionBulk(dossier2.getId(), file2.getFileId(), Set.of(resizeRedactionDosTemp), false); + var resizeRedactions = manualRedactionClient.resizeRedactionBulk(dossier2.getId(), file2.getFileId(), Set.of(resizeRedactionDosTemp)); var loadedRedactionsFile2 = manualRedactionClient.getManualRedactions(file2.getDossierId(), file2.getFileId(), false, true); @@ -1262,8 +1258,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .legalBasis("") .section("section") .value(lukeSkywalker) - .build()), - false); + .build())); dossierTemplateDictionary = dictionaryClient.getDictionaryForType(type.getType(), type.getDossierTemplateId(), null); assertThat(dossierTemplateDictionary.getEntries()).containsExactlyInAnyOrder(darthVader); @@ -1349,8 +1344,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .legalBasis("") .section("section") .value(lukeSkywalker) - .build()), - false); + .build())); dossierTemplateDictionary = dictionaryClient.getDictionaryForType(type.getType(), type.getDossierTemplateId(), null); assertThat(dossierTemplateDictionary.getEntries()).containsExactlyInAnyOrder(darthVader); @@ -1385,7 +1379,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .positions(List.of(Rectangle.builder().page(1).height(1).width(2).topLeftX(1).topLeftY(1).build())) .build(); - ManualRedactionResponse response = manualRedactionClient.resizeRedactionBulk(dossier.getId(), file.getId(), Set.of(resizeRedactionRequestModel), false); + ManualRedactionResponse response = manualRedactionClient.resizeRedactionBulk(dossier.getId(), file.getId(), Set.of(resizeRedactionRequestModel)); var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), true, true); @@ -1473,8 +1467,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .legalBasis("") .section("section") .value(lukeSkywalker) - .build()), - false); + .build())); dossierTemplateDictionary = dictionaryClient.getDictionaryForType(type.getType(), type.getDossierTemplateId(), null); assertThat(dossierTemplateDictionary.getEntries()).isEmpty(); @@ -1650,8 +1643,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .annotationId("AnnotationId") .removeFromDictionary(true) .removeFromAllDossiers(true) - .build()), - false); + .build())); var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false, true); assertEquals(allManualRedactions.getIdsToRemove().size(), 1); @@ -1681,8 +1673,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .annotationId("AnnotationId2") .removeFromDictionary(true) .removeFromAllDossiers(true) - .build()), - false); + .build())); allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false, true); assertEquals(allManualRedactions.getIdsToRemove().size(), 2); @@ -1923,8 +1914,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .legalBasis("") .section("section") .type(type.getType()) - .build()), - false); + .build())); var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false, true); assertEquals(allManualRedactions.getRecategorizations().size(), 1); @@ -1959,8 +1949,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .legalBasis("") .section("section") .type(type.getType()) - .build()), - false); + .build())); allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false, true); assertEquals(allManualRedactions.getRecategorizations().size(), 2); @@ -2272,7 +2261,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .addToAllDossiers(true) .build(); - manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recatModel, recatModelNoLegalBasis), false); + manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recatModel, recatModelNoLegalBasis)); var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false, true); assertEquals(2, allManualRedactions.getRecategorizations().size()); @@ -2280,7 +2269,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .stream() .anyMatch(entry -> entry.getAnnotationId().equals("annotationId"))); - assertThatThrownBy(() -> manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recatModelLongLegalBasis), false).getManualAnnotationResponses() + assertThatThrownBy(() -> manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recatModelLongLegalBasis)).getManualAnnotationResponses() .get(0)).isInstanceOf(FeignException.class).hasMessageContaining("The legal basis is too long"); assertNull(allManualRedactions.getRecategorizations() @@ -2346,7 +2335,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .section("overriddenSection") .build(); - ManualRedactionResponse response = manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recatModel), false); + ManualRedactionResponse response = manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recatModel)); var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false, true); assertEquals(1, allManualRedactions.getRecategorizations().size()); @@ -2397,7 +2386,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .legalBasis("") .build(); - manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recategorizationRequestModel), false); + manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recategorizationRequestModel)); var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false, true); @@ -2493,7 +2482,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .positions(List.of(Rectangle.builder().page(1).height(1).width(2).topLeftX(1).topLeftY(1).build())) .build(); - manualRedactionClient.resizeRedactionBulk(dossier.getId(), file.getId(), Set.of(resizeRedactionRequestModel), false); + manualRedactionClient.resizeRedactionBulk(dossier.getId(), file.getId(), Set.of(resizeRedactionRequestModel)); var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false, true); @@ -2650,7 +2639,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .value("Image:Other") .build(); - manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recategorizationRequestModel), false); + manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recategorizationRequestModel)); var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false, true); @@ -2722,7 +2711,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .value("Ranya Eikenboom") .build(); - manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recategorizationRequestModel), false); + manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recategorizationRequestModel)); var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false, true); @@ -2924,8 +2913,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .addToAllDossiers(false) .value("Luke") .positions(List.of(new Rectangle(5f, 5f, 5f, 5f, 1))) - .build()), - false).getManualAnnotationResponses() + .build())).getManualAnnotationResponses() .get(0); assertNotEquals(response.getEntityLogEntry().getId(), "AnnotationId"); @@ -2983,8 +2971,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .legalBasis("") .section("section") .value("Luke Skywalker") - .build()), - false).getManualAnnotationResponses() + .build())).getManualAnnotationResponses() .get(0); assertNotEquals(response.getEntityLogEntry().getId(), "AnnotationId"); @@ -3029,8 +3016,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .annotationId("AnnotationId") .removeFromDictionary(false) .removeFromAllDossiers(false) - .build()), - false).getManualAnnotationResponses() + .build())).getManualAnnotationResponses() .get(0); assertEquals(response.getEntityLogEntry().getId(), "AnnotationId"); @@ -3086,8 +3072,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .legalBasis("Article legal basis") .section("section") .value("Luke Skywalker") - .build()), - false).getManualAnnotationResponses() + .build())).getManualAnnotationResponses() .get(0); assertNotEquals(response.getEntityLogEntry().getId(), "AnnotationId"); @@ -3133,7 +3118,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { when(entityLogService.getEntityLog(any(), any(), anyBoolean())).thenReturn(entityLog); - ManualRedactionResponse manualRedactionResponse = manualRedactionClient.removeRedactionBulk(dossier.getId(), file.getId(), removeRedactionRequestModels, false); + ManualRedactionResponse manualRedactionResponse = manualRedactionClient.removeRedactionBulk(dossier.getId(), file.getId(), removeRedactionRequestModels); assertEquals(manualRedactionResponse.getManualAnnotationResponses().size(), 600); } @@ -3207,7 +3192,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { when(entityLogService.getEntityLog(any(), any(), anyBoolean())).thenReturn(entityLog); - ManualRedactionResponse manualRedactionResponse = manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), recategorizationRequestModels, false); + ManualRedactionResponse manualRedactionResponse = manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), recategorizationRequestModels); assertEquals(manualRedactionResponse.getManualAnnotationResponses().size(), 600); } @@ -3239,7 +3224,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { when(entityLogService.getEntityLog(any(), any(), anyBoolean())).thenReturn(entityLog); - var result = assertThrows(FeignException.class, () -> manualRedactionClient.removeRedactionBulk(dossier.getId(), file.getId(), removeRedactionRequestModels, false)); + var result = assertThrows(FeignException.class, () -> manualRedactionClient.removeRedactionBulk(dossier.getId(), file.getId(), removeRedactionRequestModels)); assertTrue(result.getMessage().contains("Maximum number of remove from dictionary requests is 100.")); } @@ -3351,8 +3336,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .section(otherSection) .value("Luke Skywalker37") .comment(comment1) - .build(), - false); + .build()); assertEquals(1, manualRedactionResponse.getManualAnnotationResponses().size()); assertEquals(newType.getType(), manualRedactionResponse.getManualAnnotationResponses() @@ -3381,8 +3365,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .value(darthVader) .originLegalBases(Set.of(legal3)) .comment(comment2) - .build(), - false); + .build()); assertEquals(101, manualRedactionResponse.getManualAnnotationResponses().size()); assertEquals(newType.getType(), manualRedactionResponse.getManualAnnotationResponses() @@ -3411,8 +3394,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .value(darthVader) .originTypes(Set.of(type2.getType())) .comment(comment3) - .build(), - false); + .build()); assertEquals(101, manualRedactionResponse.getManualAnnotationResponses().size()); assertEquals(newType.getType(), manualRedactionResponse.getManualAnnotationResponses() @@ -3437,8 +3419,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .rectangle(false) .value(darthVader) .comment(comment4) - .build(), - false); + .build()); assertEquals(202, manualRedactionResponse.getManualAnnotationResponses().size()); Long commentId4 = manualRedactionResponse.getManualAnnotationResponses() .get(0).getCommentId(); @@ -3496,7 +3477,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .position(filterPosition) .build(); - ManualRedactionResponse manualRedactionResponse = manualRedactionClient.recategorizeBulkLocal(dossier.getId(), file.getId(), recategorizationRequest, false); + ManualRedactionResponse manualRedactionResponse = manualRedactionClient.recategorizeBulkLocal(dossier.getId(), file.getId(), recategorizationRequest); assertNotNull(manualRedactionResponse); assertEquals(3, manualRedactionResponse.getManualAnnotationResponses().size()); @@ -3516,7 +3497,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { RecategorizationBulkLocalRequestModel finalRecategorizationRequest = recategorizationRequest; FeignException feignException = assertThrows(FeignException.class, - () -> manualRedactionClient.recategorizeBulkLocal(dossier.getId(), file.getId(), finalRecategorizationRequest, false)); + () -> manualRedactionClient.recategorizeBulkLocal(dossier.getId(), file.getId(), finalRecategorizationRequest)); assertEquals(feignException.status(), 400); @@ -3528,12 +3509,12 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .position(filterPosition) .build(); - feignException = assertThrows(FeignException.class, () -> manualRedactionClient.recategorizeBulkLocal(dossier.getId(), file.getId(), finalRecategorizationRequest, false)); + feignException = assertThrows(FeignException.class, () -> manualRedactionClient.recategorizeBulkLocal(dossier.getId(), file.getId(), finalRecategorizationRequest)); assertEquals(feignException.status(), 400); RemoveRedactionBulkLocalRequestModel removeRequest = RemoveRedactionBulkLocalRequestModel.builder().rectangle(true).position(filterPosition).build(); - manualRedactionResponse = manualRedactionClient.removeRedactionBulkLocal(dossier.getId(), file.getId(), removeRequest, false); + manualRedactionResponse = manualRedactionClient.removeRedactionBulkLocal(dossier.getId(), file.getId(), removeRequest); assertNotNull(manualRedactionResponse); assertEquals(3, manualRedactionResponse.getManualAnnotationResponses().size()); @@ -3548,7 +3529,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { removeRequest = RemoveRedactionBulkLocalRequestModel.builder().rectangle(false).position(filterPosition).build(); RemoveRedactionBulkLocalRequestModel finalRemoveRequest = removeRequest; - assertThrows(FeignException.class, () -> manualRedactionClient.removeRedactionBulkLocal(dossier.getId(), file.getId(), finalRemoveRequest, false)); + assertThrows(FeignException.class, () -> manualRedactionClient.removeRedactionBulkLocal(dossier.getId(), file.getId(), finalRemoveRequest)); assertEquals(feignException.status(), 400); } @@ -3640,8 +3621,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .section(newSection) .value(valueMixedCase) .caseSensitive(true) - .build(), - false); + .build()); assertEquals(10, responseCaseSensitive.getManualAnnotationResponses().size()); for (ManualAnnotationResponse response : responseCaseSensitive.getManualAnnotationResponses()) { @@ -3660,8 +3640,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .section(newSection) .value(valueMixedCase) .caseSensitive(false) - .build(), - false); + .build()); assertEquals(30, responseCaseInsensitive.getManualAnnotationResponses().size()); for (ManualAnnotationResponse response : responseCaseInsensitive.getManualAnnotationResponses()) { @@ -3677,8 +3656,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .rectangle(false) .value(valueMixedCase) .caseSensitive(true) - .build(), - false); + .build()); assertEquals(10, removalResponseCaseSensitive.getManualAnnotationResponses().size()); @@ -3688,10 +3666,9 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .rectangle(false) .value(valueMixedCase) .caseSensitive(false) - .build(), - false); + .build()); - assertEquals(30, removalResponseCaseInsensitive.getManualAnnotationResponses().size()); + assertEquals(20, removalResponseCaseInsensitive.getManualAnnotationResponses().size()); // 10 have already been removed by the previous bulk remove } @@ -3751,7 +3728,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { RemoveRedactionBulkLocalRequestModel removeValueRequest = RemoveRedactionBulkLocalRequestModel.builder().rectangle(false).value(value).build(); - ManualRedactionResponse removeValueResponse = manualRedactionClient.removeRedactionBulkLocal(dossier.getId(), file.getId(), removeValueRequest, false); + ManualRedactionResponse removeValueResponse = manualRedactionClient.removeRedactionBulkLocal(dossier.getId(), file.getId(), removeValueRequest); assertEquals(1, removeValueResponse.getManualAnnotationResponses().size()); EntityLog currentEntityLog = entityLogService.getEntityLog(dossier.getId(), file.getId()); @@ -3809,7 +3786,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { assertEquals(commentEntities.get(0).getText(), awesomeComment); assertEquals(commentEntities.get(0).getUser(), myUser); - removeValueResponse = manualRedactionClient.removeRedactionBulkLocal(dossier.getId(), file.getId(), removeValueRequest, true); + removeValueResponse = manualRedactionClient.removeRedactionBulkLocal(dossier.getId(), file.getId(), removeValueRequest); assertEquals(1, removeValueResponse.getManualAnnotationResponses().size()); currentEntityLog = entityLogService.getEntityLog(dossier.getId(), file.getId()); @@ -3859,7 +3836,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .comment(totallyDifferentComment) .build(); - ManualRedactionResponse removeRectangleResponse = manualRedactionClient.removeRedactionBulkLocal(dossier.getId(), file.getId(), removeRectangleRequest, false); + ManualRedactionResponse removeRectangleResponse = manualRedactionClient.removeRedactionBulkLocal(dossier.getId(), file.getId(), removeRectangleRequest); assertEquals(1, removeRectangleResponse.getManualAnnotationResponses().size()); Long commentId = removeRectangleResponse.getManualAnnotationResponses() @@ -3907,7 +3884,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest { .orElse(null); assertNotNull(newRectangleAnnotation); - removeRectangleResponse = manualRedactionClient.removeRedactionBulkLocal(dossier.getId(), file.getId(), removeRectangleRequest, true); + removeRectangleResponse = manualRedactionClient.removeRedactionBulkLocal(dossier.getId(), file.getId(), removeRectangleRequest); assertEquals(1, removeRectangleResponse.getManualAnnotationResponses().size()); currentEntityLog = entityLogService.getEntityLog(dossier.getId(), file.getId());