RED-10104: add comments when automatic analysis enabled
This commit is contained in:
parent
7a13b6adc2
commit
44419f2c6c
@ -278,7 +278,7 @@ public class ManualRedactionController implements ManualRedactionResource {
|
|||||||
removeRedactionRequest.getPageNumbers(),
|
removeRedactionRequest.getPageNumbers(),
|
||||||
removeRedactionRequest.getPosition());
|
removeRedactionRequest.getPosition());
|
||||||
removeRedactionRequestModels = entries.stream()
|
removeRedactionRequestModels = entries.stream()
|
||||||
.map(entry -> RemoveRedactionRequestModel.builder().annotationId(entry.getId()).build())
|
.map(entry -> RemoveRedactionRequestModel.builder().annotationId(entry.getId()).comment(removeRedactionRequest.getComment()).build())
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -396,6 +396,7 @@ public class ManualRedactionController implements ManualRedactionResource {
|
|||||||
.legalBasis(recategorizationRequest.getLegalBasis())
|
.legalBasis(recategorizationRequest.getLegalBasis())
|
||||||
.section(recategorizationRequest.getSection())
|
.section(recategorizationRequest.getSection())
|
||||||
.value(entry.getValue())
|
.value(entry.getValue())
|
||||||
|
.comment(recategorizationRequest.getComment())
|
||||||
.build())
|
.build())
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
|||||||
@ -3292,7 +3292,6 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
testRectangleRedactionsBulkLocal(dossierTemplate, dossier, file);
|
testRectangleRedactionsBulkLocal(dossierTemplate, dossier, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void testBulkLocal(DossierTemplateModel dossierTemplate, Dossier dossier, FileStatus file) {
|
private void testBulkLocal(DossierTemplateModel dossierTemplate, Dossier dossier, FileStatus file) {
|
||||||
|
|
||||||
whenGetEntityLogInvocation();
|
whenGetEntityLogInvocation();
|
||||||
@ -3342,7 +3341,9 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
String newLegal = "new Legal";
|
String newLegal = "new Legal";
|
||||||
String otherSection = "other section";
|
String otherSection = "other section";
|
||||||
ManualRedactionResponse manualRedactionResponse = manualRedactionClient.recategorizeBulkLocal(dossier.getId(),
|
String comment1 = "Recategorizing Luke Skywalker37";
|
||||||
|
ManualRedactionResponse manualRedactionResponse = manualRedactionClient.recategorizeBulkLocal(
|
||||||
|
dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
RecategorizationBulkLocalRequestModel.builder()
|
RecategorizationBulkLocalRequestModel.builder()
|
||||||
.rectangle(false)
|
.rectangle(false)
|
||||||
@ -3350,17 +3351,26 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
.legalBasis(newLegal)
|
.legalBasis(newLegal)
|
||||||
.section(otherSection)
|
.section(otherSection)
|
||||||
.value("Luke Skywalker37")
|
.value("Luke Skywalker37")
|
||||||
|
.comment(comment1)
|
||||||
.build(),
|
.build(),
|
||||||
false);
|
false);
|
||||||
assertEquals(manualRedactionResponse.getManualAnnotationResponses().size(), 1);
|
assertEquals(1, manualRedactionResponse.getManualAnnotationResponses().size());
|
||||||
assertEquals(manualRedactionResponse.getManualAnnotationResponses()
|
assertEquals(newType.getType(), manualRedactionResponse.getManualAnnotationResponses()
|
||||||
.get(0).getEntityLogEntry().getType(), newType.getType());
|
.get(0).getEntityLogEntry().getType());
|
||||||
assertEquals(manualRedactionResponse.getManualAnnotationResponses()
|
assertEquals(newLegal, manualRedactionResponse.getManualAnnotationResponses()
|
||||||
.get(0).getEntityLogEntry().getLegalBasis(), newLegal);
|
.get(0).getEntityLogEntry().getLegalBasis());
|
||||||
assertEquals(manualRedactionResponse.getManualAnnotationResponses()
|
assertEquals(otherSection, manualRedactionResponse.getManualAnnotationResponses()
|
||||||
.get(0).getEntityLogEntry().getSection(), otherSection);
|
.get(0).getEntityLogEntry().getSection());
|
||||||
|
Long commentId1 = manualRedactionResponse.getManualAnnotationResponses()
|
||||||
|
.get(0).getCommentId();
|
||||||
|
assertNotNull(commentId1);
|
||||||
|
Optional<CommentEntity> commentEntity1 = commentRepository.findById(commentId1);
|
||||||
|
assertTrue(commentEntity1.isPresent());
|
||||||
|
assertEquals(comment1, commentEntity1.get().getText());
|
||||||
|
|
||||||
manualRedactionResponse = manualRedactionClient.recategorizeBulkLocal(dossier.getId(),
|
String comment2 = "Recategorizing Darth Vader with Legal 3";
|
||||||
|
manualRedactionResponse = manualRedactionClient.recategorizeBulkLocal(
|
||||||
|
dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
RecategorizationBulkLocalRequestModel.builder()
|
RecategorizationBulkLocalRequestModel.builder()
|
||||||
.rectangle(false)
|
.rectangle(false)
|
||||||
@ -3369,17 +3379,26 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
.section(otherSection)
|
.section(otherSection)
|
||||||
.value(darthVader)
|
.value(darthVader)
|
||||||
.originLegalBases(Set.of(legal3))
|
.originLegalBases(Set.of(legal3))
|
||||||
|
.comment(comment2)
|
||||||
.build(),
|
.build(),
|
||||||
false);
|
false);
|
||||||
assertEquals(manualRedactionResponse.getManualAnnotationResponses().size(), 101);
|
assertEquals(101, manualRedactionResponse.getManualAnnotationResponses().size());
|
||||||
assertEquals(manualRedactionResponse.getManualAnnotationResponses()
|
assertEquals(newType.getType(), manualRedactionResponse.getManualAnnotationResponses()
|
||||||
.get(1).getEntityLogEntry().getType(), newType.getType());
|
.get(1).getEntityLogEntry().getType());
|
||||||
assertEquals(manualRedactionResponse.getManualAnnotationResponses()
|
assertEquals(newLegal, manualRedactionResponse.getManualAnnotationResponses()
|
||||||
.get(29).getEntityLogEntry().getLegalBasis(), newLegal);
|
.get(29).getEntityLogEntry().getLegalBasis());
|
||||||
assertEquals(manualRedactionResponse.getManualAnnotationResponses()
|
assertEquals(otherSection, manualRedactionResponse.getManualAnnotationResponses()
|
||||||
.get(79).getEntityLogEntry().getSection(), otherSection);
|
.get(79).getEntityLogEntry().getSection());
|
||||||
|
Long commentId2 = manualRedactionResponse.getManualAnnotationResponses()
|
||||||
|
.get(0).getCommentId();
|
||||||
|
assertNotNull(commentId2);
|
||||||
|
Optional<CommentEntity> commentEntity2 = commentRepository.findById(commentId2);
|
||||||
|
assertTrue(commentEntity2.isPresent());
|
||||||
|
assertEquals(comment2, commentEntity2.get().getText());
|
||||||
|
|
||||||
manualRedactionResponse = manualRedactionClient.recategorizeBulkLocal(dossier.getId(),
|
String comment3 = "Recategorizing Darth Vader with type2";
|
||||||
|
manualRedactionResponse = manualRedactionClient.recategorizeBulkLocal(
|
||||||
|
dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
RecategorizationBulkLocalRequestModel.builder()
|
RecategorizationBulkLocalRequestModel.builder()
|
||||||
.rectangle(false)
|
.rectangle(false)
|
||||||
@ -3388,24 +3407,44 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
.section(otherSection)
|
.section(otherSection)
|
||||||
.value(darthVader)
|
.value(darthVader)
|
||||||
.originTypes(Set.of(type2.getType()))
|
.originTypes(Set.of(type2.getType()))
|
||||||
|
.comment(comment3)
|
||||||
.build(),
|
.build(),
|
||||||
false);
|
false);
|
||||||
assertEquals(manualRedactionResponse.getManualAnnotationResponses().size(), 101);
|
assertEquals(101, manualRedactionResponse.getManualAnnotationResponses().size());
|
||||||
assertEquals(manualRedactionResponse.getManualAnnotationResponses()
|
assertEquals(newType.getType(), manualRedactionResponse.getManualAnnotationResponses()
|
||||||
.get(0).getEntityLogEntry().getType(), newType.getType());
|
.get(0).getEntityLogEntry().getType());
|
||||||
assertEquals(manualRedactionResponse.getManualAnnotationResponses()
|
assertEquals(newLegal, manualRedactionResponse.getManualAnnotationResponses()
|
||||||
.get(36).getEntityLogEntry().getLegalBasis(), newLegal);
|
.get(36).getEntityLogEntry().getLegalBasis());
|
||||||
assertEquals(manualRedactionResponse.getManualAnnotationResponses()
|
assertEquals(otherSection, manualRedactionResponse.getManualAnnotationResponses()
|
||||||
.get(98).getEntityLogEntry().getSection(), otherSection);
|
.get(98).getEntityLogEntry().getSection());
|
||||||
|
Long commentId3 = manualRedactionResponse.getManualAnnotationResponses()
|
||||||
|
.get(0).getCommentId();
|
||||||
|
assertNotNull(commentId3);
|
||||||
|
Optional<CommentEntity> commentEntity3 = commentRepository.findById(commentId3);
|
||||||
|
assertTrue(commentEntity3.isPresent());
|
||||||
|
assertEquals(comment3, commentEntity3.get().getText());
|
||||||
|
|
||||||
manualRedactionResponse = manualRedactionClient.removeRedactionBulkLocal(dossier.getId(),
|
String comment4 = "Removing all Darth Vader annotations";
|
||||||
|
manualRedactionResponse = manualRedactionClient.removeRedactionBulkLocal(
|
||||||
|
dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
RemoveRedactionBulkLocalRequestModel.builder().rectangle(false).value(darthVader).build(),
|
RemoveRedactionBulkLocalRequestModel.builder()
|
||||||
|
.rectangle(false)
|
||||||
|
.value(darthVader)
|
||||||
|
.comment(comment4)
|
||||||
|
.build(),
|
||||||
false);
|
false);
|
||||||
assertEquals(manualRedactionResponse.getManualAnnotationResponses().size(), 202);
|
assertEquals(202, manualRedactionResponse.getManualAnnotationResponses().size());
|
||||||
|
Long commentId4 = manualRedactionResponse.getManualAnnotationResponses()
|
||||||
|
.get(0).getCommentId();
|
||||||
|
assertNotNull(commentId4);
|
||||||
|
Optional<CommentEntity> commentEntity4 = commentRepository.findById(commentId4);
|
||||||
|
assertTrue(commentEntity4.isPresent());
|
||||||
|
assertEquals(comment4, commentEntity4.get().getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void testRectangleRedactionsBulkLocal(DossierTemplateModel dossierTemplate, Dossier dossier, FileStatus file) {
|
private void testRectangleRedactionsBulkLocal(DossierTemplateModel dossierTemplate, Dossier dossier, FileStatus file) {
|
||||||
|
|
||||||
whenGetEntityLogInvocation();
|
whenGetEntityLogInvocation();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user