RED-8480: removed Nonnull annotation for legal basis when recategorizing; changed to empty String, if null is passed
This commit is contained in:
parent
307ae65080
commit
d5244846a9
@ -5,6 +5,7 @@ import static com.iqser.red.service.persistence.management.v1.processor.utils.Ty
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -156,7 +157,7 @@ public class ManualRedactionMapper {
|
|||||||
.value(entityLogEntry.getValue())
|
.value(entityLogEntry.getValue())
|
||||||
.typeToRemove(entityLogEntry.getType())
|
.typeToRemove(entityLogEntry.getType())
|
||||||
.dossierTemplateTypeId(toTypeId(recategorizationRequest.getType(), dossierTemplateId))
|
.dossierTemplateTypeId(toTypeId(recategorizationRequest.getType(), dossierTemplateId))
|
||||||
.legalBasis(recategorizationRequest.getLegalBasis())
|
.legalBasis(Optional.ofNullable(recategorizationRequest.getLegalBasis()).orElse(""))
|
||||||
.build();
|
.build();
|
||||||
requests.add(build);
|
requests.add(build);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,8 +169,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
manualRedactionClient.addRedactionBulk(dossier.getId(),
|
manualRedactionClient.addRedactionBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
Set.of(AddRedactionRequestModel.builder()
|
Set.of(AddRedactionRequestModel.builder()
|
||||||
.positions(List.of(Rectangle.builder().topLeftY(1).topLeftX(1).height(1).width(1)
|
.positions(List.of(Rectangle.builder().topLeftY(1).topLeftX(1).height(1).width(1).build()))
|
||||||
.build()))
|
|
||||||
.section("section test")
|
.section("section test")
|
||||||
.addToDictionary(true)
|
.addToDictionary(true)
|
||||||
.addToAllDossiers(true)
|
.addToAllDossiers(true)
|
||||||
@ -206,8 +205,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
manualRedactionClient.addRedactionBulk(dossier.getId(),
|
manualRedactionClient.addRedactionBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
Set.of(AddRedactionRequestModel.builder()
|
Set.of(AddRedactionRequestModel.builder()
|
||||||
.positions(List.of(Rectangle.builder().topLeftY(1).topLeftX(1).height(1).width(1)
|
.positions(List.of(Rectangle.builder().topLeftY(1).topLeftX(1).height(1).width(1).build()))
|
||||||
.build()))
|
|
||||||
.section("section test")
|
.section("section test")
|
||||||
.addToDictionary(true)
|
.addToDictionary(true)
|
||||||
.addToAllDossiers(true)
|
.addToAllDossiers(true)
|
||||||
@ -244,8 +242,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
manualRedactionClient.addRedactionBulk(dossier.getId(),
|
manualRedactionClient.addRedactionBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
Set.of(AddRedactionRequestModel.builder()
|
Set.of(AddRedactionRequestModel.builder()
|
||||||
.positions(List.of(Rectangle.builder().topLeftY(1).topLeftX(1).height(1).width(1)
|
.positions(List.of(Rectangle.builder().topLeftY(1).topLeftX(1).height(1).width(1).build()))
|
||||||
.build()))
|
|
||||||
.section("section test")
|
.section("section test")
|
||||||
.addToDictionary(true)
|
.addToDictionary(true)
|
||||||
.addToAllDossiers(false)
|
.addToAllDossiers(false)
|
||||||
@ -290,7 +287,8 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
var dossierDictionary = internalDictionaryClient.getDictionaryForType(toTypeId(type.getType(), dossierTemplate.getId(), dossier.getId()), null);
|
var dossierDictionary = internalDictionaryClient.getDictionaryForType(toTypeId(type.getType(), dossierTemplate.getId(), dossier.getId()), null);
|
||||||
assertThat(dossierDictionary.getEntries().size()).isEqualTo(1);
|
assertThat(dossierDictionary.getEntries().size()).isEqualTo(1);
|
||||||
assertEquals(dossierDictionary.getEntries().get(0).getValue(), "Luke Skywalker ");
|
assertEquals(dossierDictionary.getEntries()
|
||||||
|
.get(0).getValue(), "Luke Skywalker ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -337,7 +335,10 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
manualRedactionClient.removeRedactionBulk(dossier.getId(),
|
manualRedactionClient.removeRedactionBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
Set.of(RemoveRedactionRequestModel.builder().annotationId("AnnotationId").removeFromDictionary(true).removeFromAllDossiers(true)
|
Set.of(RemoveRedactionRequestModel.builder()
|
||||||
|
.annotationId("AnnotationId")
|
||||||
|
.removeFromDictionary(true)
|
||||||
|
.removeFromAllDossiers(true)
|
||||||
.build()),
|
.build()),
|
||||||
false);
|
false);
|
||||||
|
|
||||||
@ -394,8 +395,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
manualRedactionClient.removeRedactionBulk(dossier.getId(),
|
manualRedactionClient.removeRedactionBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
Set.of(RemoveRedactionRequestModel.builder().annotationId("AnnotationId").removeFromDictionary(true)
|
Set.of(RemoveRedactionRequestModel.builder().annotationId("AnnotationId").removeFromDictionary(true).build()),
|
||||||
.build()),
|
|
||||||
false)
|
false)
|
||||||
.get(0);
|
.get(0);
|
||||||
|
|
||||||
@ -450,7 +450,10 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
manualRedactionClient.removeRedactionBulk(dossier.getId(),
|
manualRedactionClient.removeRedactionBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
Set.of(RemoveRedactionRequestModel.builder().annotationId("AnnotationId").removeFromDictionary(true).removeFromAllDossiers(true)
|
Set.of(RemoveRedactionRequestModel.builder()
|
||||||
|
.annotationId("AnnotationId")
|
||||||
|
.removeFromDictionary(true)
|
||||||
|
.removeFromAllDossiers(true)
|
||||||
.build()),
|
.build()),
|
||||||
false)
|
false)
|
||||||
.get(0);
|
.get(0);
|
||||||
@ -483,8 +486,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
var userId = userProvider.getUserId();
|
var userId = userProvider.getUserId();
|
||||||
|
|
||||||
var redactionDos = AddRedactionRequestModel.builder()
|
var redactionDos = AddRedactionRequestModel.builder()
|
||||||
.positions(List.of(Rectangle.builder().page(1).topLeftY(1).topLeftX(1).height(1).width(1)
|
.positions(List.of(Rectangle.builder().page(1).topLeftY(1).topLeftX(1).height(1).width(1).build()))
|
||||||
.build()))
|
|
||||||
.section("section test")
|
.section("section test")
|
||||||
.addToDictionary(true)
|
.addToDictionary(true)
|
||||||
.addToAllDossiers(false)
|
.addToAllDossiers(false)
|
||||||
@ -498,8 +500,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
var redactionDosTempDict = AddRedactionRequestModel.builder()
|
var redactionDosTempDict = AddRedactionRequestModel.builder()
|
||||||
.positions(List.of(Rectangle.builder().page(1).topLeftY(1).topLeftX(1).height(1).width(1)
|
.positions(List.of(Rectangle.builder().page(1).topLeftY(1).topLeftX(1).height(1).width(1).build()))
|
||||||
.build()))
|
|
||||||
.section("section test")
|
.section("section test")
|
||||||
.addToDictionary(true)
|
.addToDictionary(true)
|
||||||
.addToAllDossiers(true)
|
.addToAllDossiers(true)
|
||||||
@ -539,8 +540,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
fileManagementStorageService.storeJSONObject(dossier1.getId(), file1.getId(), FileType.ENTITY_LOG, entityLog1);
|
fileManagementStorageService.storeJSONObject(dossier1.getId(), file1.getId(), FileType.ENTITY_LOG, entityLog1);
|
||||||
var redactionRequest1 = RedactionRequest.builder().dossierId(file1.getDossierId()).fileId(file1.getFileId()).dossierTemplateId(file1.getDossierTemplateId())
|
var redactionRequest1 = RedactionRequest.builder().dossierId(file1.getDossierId()).fileId(file1.getFileId()).dossierTemplateId(file1.getDossierTemplateId()).build();
|
||||||
.build();
|
|
||||||
when(entityLogService.getEntityLog(eq(file1.getDossierId()), eq(file1.getFileId()), any(), anyBoolean())).thenReturn(entityLog1);
|
when(entityLogService.getEntityLog(eq(file1.getDossierId()), eq(file1.getFileId()), any(), anyBoolean())).thenReturn(entityLog1);
|
||||||
|
|
||||||
var entityLog2 = new EntityLog(1,
|
var entityLog2 = new EntityLog(1,
|
||||||
@ -559,8 +559,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
fileManagementStorageService.storeJSONObject(dossier2.getId(), file2.getId(), FileType.ENTITY_LOG, entityLog2);
|
fileManagementStorageService.storeJSONObject(dossier2.getId(), file2.getId(), FileType.ENTITY_LOG, entityLog2);
|
||||||
var redactionRequest2 = RedactionRequest.builder().dossierId(file2.getDossierId()).fileId(file2.getFileId()).dossierTemplateId(file2.getDossierTemplateId())
|
var redactionRequest2 = RedactionRequest.builder().dossierId(file2.getDossierId()).fileId(file2.getFileId()).dossierTemplateId(file2.getDossierTemplateId()).build();
|
||||||
.build();
|
|
||||||
when(entityLogService.getEntityLog(eq(file2.getDossierId()), eq(file2.getFileId()), any(), anyBoolean())).thenReturn(entityLog2);
|
when(entityLogService.getEntityLog(eq(file2.getDossierId()), eq(file2.getFileId()), any(), anyBoolean())).thenReturn(entityLog2);
|
||||||
|
|
||||||
// resize redaction in dossier 1
|
// resize redaction in dossier 1
|
||||||
@ -652,8 +651,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
var userId = userProvider.getUserId();
|
var userId = userProvider.getUserId();
|
||||||
|
|
||||||
var redactionDos = AddRedactionRequestModel.builder()
|
var redactionDos = AddRedactionRequestModel.builder()
|
||||||
.positions(List.of(Rectangle.builder().page(1).topLeftY(1).topLeftX(1).height(1).width(1)
|
.positions(List.of(Rectangle.builder().page(1).topLeftY(1).topLeftX(1).height(1).width(1).build()))
|
||||||
.build()))
|
|
||||||
.section("section test")
|
.section("section test")
|
||||||
.addToDictionary(true)
|
.addToDictionary(true)
|
||||||
.addToAllDossiers(false)
|
.addToAllDossiers(false)
|
||||||
@ -667,8 +665,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
var redactionDosTempDict = AddRedactionRequestModel.builder()
|
var redactionDosTempDict = AddRedactionRequestModel.builder()
|
||||||
.positions(List.of(Rectangle.builder().page(1).topLeftY(1).topLeftX(1).height(1).width(1)
|
.positions(List.of(Rectangle.builder().page(1).topLeftY(1).topLeftX(1).height(1).width(1).build()))
|
||||||
.build()))
|
|
||||||
.section("section test")
|
.section("section test")
|
||||||
.addToDictionary(true)
|
.addToDictionary(true)
|
||||||
.addToAllDossiers(true)
|
.addToAllDossiers(true)
|
||||||
@ -708,8 +705,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
fileManagementStorageService.storeJSONObject(dossier1.getId(), file1.getId(), FileType.ENTITY_LOG, entityLog1);
|
fileManagementStorageService.storeJSONObject(dossier1.getId(), file1.getId(), FileType.ENTITY_LOG, entityLog1);
|
||||||
var redactionRequest1 = RedactionRequest.builder().dossierId(file1.getDossierId()).fileId(file1.getFileId()).dossierTemplateId(file1.getDossierTemplateId())
|
var redactionRequest1 = RedactionRequest.builder().dossierId(file1.getDossierId()).fileId(file1.getFileId()).dossierTemplateId(file1.getDossierTemplateId()).build();
|
||||||
.build();
|
|
||||||
when(entityLogService.getEntityLog(eq(file1.getDossierId()), eq(file1.getFileId()), any(), anyBoolean())).thenReturn(entityLog1);
|
when(entityLogService.getEntityLog(eq(file1.getDossierId()), eq(file1.getFileId()), any(), anyBoolean())).thenReturn(entityLog1);
|
||||||
|
|
||||||
var entityLog2 = new EntityLog(1,
|
var entityLog2 = new EntityLog(1,
|
||||||
@ -728,8 +724,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
fileManagementStorageService.storeJSONObject(dossier2.getId(), file2.getId(), FileType.ENTITY_LOG, entityLog2);
|
fileManagementStorageService.storeJSONObject(dossier2.getId(), file2.getId(), FileType.ENTITY_LOG, entityLog2);
|
||||||
var redactionRequest2 = RedactionRequest.builder().dossierId(file2.getDossierId()).fileId(file2.getFileId()).dossierTemplateId(file2.getDossierTemplateId())
|
var redactionRequest2 = RedactionRequest.builder().dossierId(file2.getDossierId()).fileId(file2.getFileId()).dossierTemplateId(file2.getDossierTemplateId()).build();
|
||||||
.build();
|
|
||||||
when(entityLogService.getEntityLog(eq(file2.getDossierId()), eq(file2.getFileId()), any(), anyBoolean())).thenReturn(entityLog2);
|
when(entityLogService.getEntityLog(eq(file2.getDossierId()), eq(file2.getFileId()), any(), anyBoolean())).thenReturn(entityLog2);
|
||||||
|
|
||||||
// resize redaction in dossier 1
|
// resize redaction in dossier 1
|
||||||
@ -826,8 +821,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
var userId = userProvider.getUserId();
|
var userId = userProvider.getUserId();
|
||||||
|
|
||||||
var redactionDos = AddRedactionRequestModel.builder()
|
var redactionDos = AddRedactionRequestModel.builder()
|
||||||
.positions(List.of(Rectangle.builder().page(1).topLeftY(1).topLeftX(1).height(1).width(1)
|
.positions(List.of(Rectangle.builder().page(1).topLeftY(1).topLeftX(1).height(1).width(1).build()))
|
||||||
.build()))
|
|
||||||
.section("section test")
|
.section("section test")
|
||||||
.addToDictionary(true)
|
.addToDictionary(true)
|
||||||
.addToAllDossiers(false)
|
.addToAllDossiers(false)
|
||||||
@ -841,8 +835,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
var redactionDosTempDict = AddRedactionRequestModel.builder()
|
var redactionDosTempDict = AddRedactionRequestModel.builder()
|
||||||
.positions(List.of(Rectangle.builder().page(1).topLeftY(1).topLeftX(1).height(1).width(1)
|
.positions(List.of(Rectangle.builder().page(1).topLeftY(1).topLeftX(1).height(1).width(1).build()))
|
||||||
.build()))
|
|
||||||
.section("section test")
|
.section("section test")
|
||||||
.addToDictionary(true)
|
.addToDictionary(true)
|
||||||
.addToAllDossiers(true)
|
.addToAllDossiers(true)
|
||||||
@ -881,8 +874,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
fileManagementStorageService.storeJSONObject(dossier1.getId(), file1.getId(), FileType.ENTITY_LOG, entityLog1);
|
fileManagementStorageService.storeJSONObject(dossier1.getId(), file1.getId(), FileType.ENTITY_LOG, entityLog1);
|
||||||
var redactionRequest1 = RedactionRequest.builder().dossierId(file1.getDossierId()).fileId(file1.getFileId()).dossierTemplateId(file1.getDossierTemplateId())
|
var redactionRequest1 = RedactionRequest.builder().dossierId(file1.getDossierId()).fileId(file1.getFileId()).dossierTemplateId(file1.getDossierTemplateId()).build();
|
||||||
.build();
|
|
||||||
when(entityLogService.getEntityLog(file1.getDossierId(), file1.getFileId())).thenReturn(entityLog1);
|
when(entityLogService.getEntityLog(file1.getDossierId(), file1.getFileId())).thenReturn(entityLog1);
|
||||||
|
|
||||||
var entityLog2 = new EntityLog(1,
|
var entityLog2 = new EntityLog(1,
|
||||||
@ -901,8 +893,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
fileManagementStorageService.storeJSONObject(dossier2.getId(), file2.getId(), FileType.ENTITY_LOG, entityLog2);
|
fileManagementStorageService.storeJSONObject(dossier2.getId(), file2.getId(), FileType.ENTITY_LOG, entityLog2);
|
||||||
var redactionRequest2 = RedactionRequest.builder().dossierId(file2.getDossierId()).fileId(file2.getFileId()).dossierTemplateId(file2.getDossierTemplateId())
|
var redactionRequest2 = RedactionRequest.builder().dossierId(file2.getDossierId()).fileId(file2.getFileId()).dossierTemplateId(file2.getDossierTemplateId()).build();
|
||||||
.build();
|
|
||||||
when(entityLogService.getEntityLog(eq(file2.getDossierId()), eq(file2.getFileId()), any(), anyBoolean())).thenReturn(entityLog2);
|
when(entityLogService.getEntityLog(eq(file2.getDossierId()), eq(file2.getFileId()), any(), anyBoolean())).thenReturn(entityLog2);
|
||||||
|
|
||||||
// resize redaction in dossier dict
|
// resize redaction in dossier dict
|
||||||
@ -996,8 +987,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
var userId = userProvider.getUserId();
|
var userId = userProvider.getUserId();
|
||||||
|
|
||||||
var redactionDos = AddRedactionRequestModel.builder()
|
var redactionDos = AddRedactionRequestModel.builder()
|
||||||
.positions(List.of(Rectangle.builder().page(1).topLeftY(1).topLeftX(1).height(1).width(1)
|
.positions(List.of(Rectangle.builder().page(1).topLeftY(1).topLeftX(1).height(1).width(1).build()))
|
||||||
.build()))
|
|
||||||
.section("section test")
|
.section("section test")
|
||||||
.addToDictionary(true)
|
.addToDictionary(true)
|
||||||
.addToAllDossiers(false)
|
.addToAllDossiers(false)
|
||||||
@ -1011,8 +1001,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
var redactionDosTempDict = AddRedactionRequestModel.builder()
|
var redactionDosTempDict = AddRedactionRequestModel.builder()
|
||||||
.positions(List.of(Rectangle.builder().page(1).topLeftY(1).topLeftX(1).height(1).width(1)
|
.positions(List.of(Rectangle.builder().page(1).topLeftY(1).topLeftX(1).height(1).width(1).build()))
|
||||||
.build()))
|
|
||||||
.section("section test")
|
.section("section test")
|
||||||
.addToDictionary(true)
|
.addToDictionary(true)
|
||||||
.addToAllDossiers(true)
|
.addToAllDossiers(true)
|
||||||
@ -1051,8 +1040,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
fileManagementStorageService.storeJSONObject(dossier1.getId(), file1.getId(), FileType.ENTITY_LOG, entityLog1);
|
fileManagementStorageService.storeJSONObject(dossier1.getId(), file1.getId(), FileType.ENTITY_LOG, entityLog1);
|
||||||
var redactionRequest1 = RedactionRequest.builder().dossierId(file1.getDossierId()).fileId(file1.getFileId()).dossierTemplateId(file1.getDossierTemplateId())
|
var redactionRequest1 = RedactionRequest.builder().dossierId(file1.getDossierId()).fileId(file1.getFileId()).dossierTemplateId(file1.getDossierTemplateId()).build();
|
||||||
.build();
|
|
||||||
when(entityLogService.getEntityLog(file1.getDossierId(), file1.getFileId())).thenReturn(entityLog1);
|
when(entityLogService.getEntityLog(file1.getDossierId(), file1.getFileId())).thenReturn(entityLog1);
|
||||||
|
|
||||||
var entityLog2 = new EntityLog(1,
|
var entityLog2 = new EntityLog(1,
|
||||||
@ -1071,8 +1059,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
fileManagementStorageService.storeJSONObject(dossier2.getId(), file2.getId(), FileType.ENTITY_LOG, entityLog2);
|
fileManagementStorageService.storeJSONObject(dossier2.getId(), file2.getId(), FileType.ENTITY_LOG, entityLog2);
|
||||||
var redactionRequest2 = RedactionRequest.builder().dossierId(file2.getDossierId()).fileId(file2.getFileId()).dossierTemplateId(file2.getDossierTemplateId())
|
var redactionRequest2 = RedactionRequest.builder().dossierId(file2.getDossierId()).fileId(file2.getFileId()).dossierTemplateId(file2.getDossierTemplateId()).build();
|
||||||
.build();
|
|
||||||
when(entityLogService.getEntityLog(eq(file2.getDossierId()), eq(file2.getFileId()), any(), anyBoolean())).thenReturn(entityLog2);
|
when(entityLogService.getEntityLog(eq(file2.getDossierId()), eq(file2.getFileId()), any(), anyBoolean())).thenReturn(entityLog2);
|
||||||
|
|
||||||
// resize redaction in dossier dict
|
// resize redaction in dossier dict
|
||||||
@ -1331,8 +1318,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
manualRedactionClient.addRedactionBulk(dossier.getId(),
|
manualRedactionClient.addRedactionBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
Set.of(AddRedactionRequestModel.builder()
|
Set.of(AddRedactionRequestModel.builder()
|
||||||
.positions(List.of(Rectangle.builder().topLeftY(1).topLeftX(1).height(1).width(1)
|
.positions(List.of(Rectangle.builder().topLeftY(1).topLeftX(1).height(1).width(1).build()))
|
||||||
.build()))
|
|
||||||
.section("section test")
|
.section("section test")
|
||||||
.addToDictionary(false)
|
.addToDictionary(false)
|
||||||
.addToAllDossiers(false)
|
.addToAllDossiers(false)
|
||||||
@ -1369,8 +1355,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
manualRedactionClient.addRedactionBulk(dossier.getId(),
|
manualRedactionClient.addRedactionBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
Set.of(AddRedactionRequestModel.builder()
|
Set.of(AddRedactionRequestModel.builder()
|
||||||
.positions(List.of(Rectangle.builder().topLeftY(2).topLeftX(2).height(2).width(2)
|
.positions(List.of(Rectangle.builder().topLeftY(2).topLeftX(2).height(2).width(2).build()))
|
||||||
.build()))
|
|
||||||
.section("section test")
|
.section("section test")
|
||||||
.addToDictionary(false)
|
.addToDictionary(false)
|
||||||
.addToAllDossiers(false)
|
.addToAllDossiers(false)
|
||||||
@ -1466,7 +1451,10 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
manualRedactionClient.removeRedactionBulk(dossier.getId(),
|
manualRedactionClient.removeRedactionBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
Set.of(RemoveRedactionRequestModel.builder().annotationId("AnnotationId").removeFromDictionary(true).removeFromAllDossiers(true)
|
Set.of(RemoveRedactionRequestModel.builder()
|
||||||
|
.annotationId("AnnotationId")
|
||||||
|
.removeFromDictionary(true)
|
||||||
|
.removeFromAllDossiers(true)
|
||||||
.build()),
|
.build()),
|
||||||
false);
|
false);
|
||||||
|
|
||||||
@ -1494,7 +1482,10 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
manualRedactionClient.removeRedactionBulk(dossier.getId(),
|
manualRedactionClient.removeRedactionBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
Set.of(RemoveRedactionRequestModel.builder().annotationId("AnnotationId2").removeFromDictionary(true).removeFromAllDossiers(true)
|
Set.of(RemoveRedactionRequestModel.builder()
|
||||||
|
.annotationId("AnnotationId2")
|
||||||
|
.removeFromDictionary(true)
|
||||||
|
.removeFromAllDossiers(true)
|
||||||
.build()),
|
.build()),
|
||||||
false);
|
false);
|
||||||
|
|
||||||
@ -1549,8 +1540,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
manualRedactionClient.forceRedactionBulk(dossier.getId(),
|
manualRedactionClient.forceRedactionBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
Set.of(ForceRedactionRequestModel.builder().annotationId("forceRedactionAnnotation").comment("comment").legalBasis("1")
|
Set.of(ForceRedactionRequestModel.builder().annotationId("forceRedactionAnnotation").comment("comment").legalBasis("1").build()));
|
||||||
.build()));
|
|
||||||
|
|
||||||
var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
||||||
assertEquals(allManualRedactions.getForceRedactions().size(), 1);
|
assertEquals(allManualRedactions.getForceRedactions().size(), 1);
|
||||||
@ -1576,8 +1566,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
manualRedactionClient.forceRedactionBulk(dossier.getId(),
|
manualRedactionClient.forceRedactionBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
Set.of(ForceRedactionRequestModel.builder().annotationId("forceRedactionAnnotation2").comment("comment").legalBasis("1")
|
Set.of(ForceRedactionRequestModel.builder().annotationId("forceRedactionAnnotation2").comment("comment").legalBasis("1").build()));
|
||||||
.build()));
|
|
||||||
|
|
||||||
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
||||||
assertEquals(allManualRedactions.getForceRedactions().size(), 2);
|
assertEquals(allManualRedactions.getForceRedactions().size(), 2);
|
||||||
@ -1659,11 +1648,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
when(entityLogService.getEntityLog(Mockito.any(), Mockito.any(), any(), anyBoolean())).thenReturn(entityLog);
|
when(entityLogService.getEntityLog(Mockito.any(), Mockito.any(), any(), anyBoolean())).thenReturn(entityLog);
|
||||||
|
|
||||||
manualRedactionClient.recategorizeBulk(dossier.getId(),
|
manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(RecategorizationRequestModel.builder().annotationId("dv").legalBasis("").build()), false);
|
||||||
file.getId(),
|
|
||||||
Set.of(RecategorizationRequestModel.builder().annotationId("dv").legalBasis("")
|
|
||||||
.build()),
|
|
||||||
false);
|
|
||||||
|
|
||||||
var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
||||||
assertEquals(allManualRedactions.getRecategorizations().size(), 1);
|
assertEquals(allManualRedactions.getRecategorizations().size(), 1);
|
||||||
@ -1687,11 +1672,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
.dossierId(dossier.getId())
|
.dossierId(dossier.getId())
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
manualRedactionClient.recategorizeBulk(dossier.getId(),
|
manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(RecategorizationRequestModel.builder().annotationId("dv2").legalBasis("").build()), false);
|
||||||
file.getId(),
|
|
||||||
Set.of(RecategorizationRequestModel.builder().annotationId("dv2").legalBasis("")
|
|
||||||
.build()),
|
|
||||||
false);
|
|
||||||
|
|
||||||
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
||||||
assertEquals(allManualRedactions.getRecategorizations().size(), 2);
|
assertEquals(allManualRedactions.getRecategorizations().size(), 2);
|
||||||
@ -1775,8 +1756,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
manualRedactionClient.legalBasisChangeBulk(dossier.getId(),
|
manualRedactionClient.legalBasisChangeBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
Set.of(LegalBasisChangeRequestModel.builder().legalBasis("legalBasis").annotationId("AnnotationId")
|
Set.of(LegalBasisChangeRequestModel.builder().legalBasis("legalBasis").annotationId("AnnotationId").build()));
|
||||||
.build()));
|
|
||||||
|
|
||||||
var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
||||||
assertEquals(allManualRedactions.getLegalBasisChanges().size(), 1);
|
assertEquals(allManualRedactions.getLegalBasisChanges().size(), 1);
|
||||||
@ -1802,8 +1782,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
manualRedactionClient.legalBasisChangeBulk(dossier.getId(),
|
manualRedactionClient.legalBasisChangeBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
Set.of(LegalBasisChangeRequestModel.builder().legalBasis("legalBasis2").annotationId("AnnotationId2")
|
Set.of(LegalBasisChangeRequestModel.builder().legalBasis("legalBasis2").annotationId("AnnotationId2").build()));
|
||||||
.build()));
|
|
||||||
|
|
||||||
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
||||||
assertEquals(allManualRedactions.getLegalBasisChanges().size(), 2);
|
assertEquals(allManualRedactions.getLegalBasisChanges().size(), 2);
|
||||||
@ -1891,29 +1870,37 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
fileManagementStorageService.storeJSONObject(dossier.getId(), file.getId(), FileType.ENTITY_LOG, entityLog);
|
fileManagementStorageService.storeJSONObject(dossier.getId(), file.getId(), FileType.ENTITY_LOG, entityLog);
|
||||||
when(entityLogService.getEntityLog(Mockito.any(), Mockito.any(), any(), anyBoolean())).thenReturn(entityLog);
|
when(entityLogService.getEntityLog(Mockito.any(), Mockito.any(), any(), anyBoolean())).thenReturn(entityLog);
|
||||||
|
|
||||||
var recatModel = RecategorizationRequestModel.builder().type(type.getType()).annotationId("annotationId").addToDictionary(true).addToAllDossiers(true).legalBasis("")
|
var recatModel = RecategorizationRequestModel.builder()
|
||||||
|
.type(type.getType())
|
||||||
|
.annotationId("annotationId")
|
||||||
|
.addToDictionary(true)
|
||||||
|
.addToAllDossiers(true)
|
||||||
|
.legalBasis("")
|
||||||
.build();
|
.build();
|
||||||
var recatModelLongLegalBasis = RecategorizationRequestModel.builder()
|
var recatModelLongLegalBasis = RecategorizationRequestModel.builder()
|
||||||
.type(type.getType())
|
.type(type.getType())
|
||||||
.annotationId("annotationId2")
|
.annotationId("annotationId2")
|
||||||
.addToDictionary(true)
|
.addToDictionary(true)
|
||||||
.addToAllDossiers(true)
|
.addToAllDossiers(true)
|
||||||
.legalBasis(
|
.legalBasis(RandomStringUtils.randomAlphanumeric(4001))
|
||||||
RandomStringUtils.randomAlphanumeric(4001))
|
|
||||||
.build();
|
.build();
|
||||||
|
var recatModelNoLegalBasis = RecategorizationRequestModel.builder().type(type.getType()).annotationId("annotationId3").addToDictionary(true).addToAllDossiers(true).build();
|
||||||
|
|
||||||
manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recatModel), false);
|
manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recatModel, recatModelNoLegalBasis), false);
|
||||||
|
|
||||||
var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
||||||
assertEquals(1, allManualRedactions.getRecategorizations().size());
|
assertEquals(2, allManualRedactions.getRecategorizations().size());
|
||||||
assertTrue(allManualRedactions.getRecategorizations()
|
assertTrue(allManualRedactions.getRecategorizations()
|
||||||
.stream()
|
.stream()
|
||||||
.anyMatch(entry -> entry.getAnnotationId().equals("annotationId")));
|
.anyMatch(entry -> entry.getAnnotationId().equals("annotationId")));
|
||||||
|
|
||||||
assertThatThrownBy(() -> manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recatModelLongLegalBasis), false)
|
assertThatThrownBy(() -> manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recatModelLongLegalBasis), false)
|
||||||
.get(0)).isInstanceOf(FeignException.class).hasMessageContaining("The legal basis is too long");
|
.get(0)).isInstanceOf(FeignException.class).hasMessageContaining("The legal basis is too long");
|
||||||
assertThatThrownBy(() -> RecategorizationRequestModel.builder().type(type.getType()).annotationId("annotationId3").addToDictionary(true).addToAllDossiers(true)
|
|
||||||
.build()).isInstanceOf(NullPointerException.class);
|
assertEquals("", allManualRedactions.getRecategorizations()
|
||||||
|
.stream()
|
||||||
|
.filter(manualRecategorization -> manualRecategorization.getAnnotationId().equals("annotationId3"))
|
||||||
|
.findFirst().get().getLegalBasis());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.NonNull;
|
|
||||||
import lombok.experimental.FieldDefaults;
|
import lombok.experimental.FieldDefaults;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -20,7 +19,6 @@ public class RecategorizationRequestModel {
|
|||||||
String comment;
|
String comment;
|
||||||
boolean addToDictionary;
|
boolean addToDictionary;
|
||||||
boolean addToAllDossiers;
|
boolean addToAllDossiers;
|
||||||
@NonNull
|
|
||||||
String legalBasis;
|
String legalBasis;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user