RED-2439: Added textBefore and textAfter to manual add and resize redactions

This commit is contained in:
deiflaender 2021-12-09 14:32:05 +01:00
parent ea216f3bb8
commit 19fd46acbd
8 changed files with 40 additions and 0 deletions

View File

@ -32,4 +32,7 @@ public class AddRedactionRequest {
private boolean forceAddToDictionary; private boolean forceAddToDictionary;
private String textBefore;
private String textAfter;
} }

View File

@ -31,5 +31,7 @@ public class ManualRedactionEntry {
private OffsetDateTime processedDate; private OffsetDateTime processedDate;
private OffsetDateTime softDeletedTime; private OffsetDateTime softDeletedTime;
private List<Rectangle> positions = new ArrayList<>(); private List<Rectangle> positions = new ArrayList<>();
private String textBefore;
private String textAfter;
} }

View File

@ -25,5 +25,7 @@ public class ManualResizeRedaction {
private String value; private String value;
@Builder.Default @Builder.Default
private List<Rectangle> positions = new ArrayList<>(); private List<Rectangle> positions = new ArrayList<>();
private String textBefore;
private String textAfter;
} }

View File

@ -23,4 +23,7 @@ public class ResizeRedactionRequest {
@Builder.Default @Builder.Default
private List<Rectangle> positions = new ArrayList<>(); private List<Rectangle> positions = new ArrayList<>();
private String textBefore;
private String textAfter;
} }

View File

@ -56,5 +56,10 @@ public class ManualRedactionEntryEntity {
@ManyToOne @ManyToOne
private FileEntity fileStatus; private FileEntity fileStatus;
@Column
private String textBefore;
@Column
private String textAfter;
} }

View File

@ -53,4 +53,9 @@ public class ManualResizeRedactionEntity {
@ElementCollection @ElementCollection
private List<RectangleEntity> positions = new ArrayList<>(); private List<RectangleEntity> positions = new ArrayList<>();
@Column
private String textBefore;
@Column
private String textAfter;
} }

View File

@ -614,6 +614,12 @@ databaseChangeLog:
- column: - column:
name: file_status_id name: file_status_id
type: VARCHAR(255) type: VARCHAR(255)
- column:
name: text_before
type: VARCHAR(255)
- column:
name: text_after
type: VARCHAR(255)
tableName: manual_resize_redaction tableName: manual_resize_redaction
- changeSet: - changeSet:
id: 1637073006104-20 id: 1637073006104-20
@ -856,6 +862,12 @@ databaseChangeLog:
- column: - column:
name: file_status_id name: file_status_id
type: VARCHAR(255) type: VARCHAR(255)
- column:
name: text_before
type: VARCHAR(255)
- column:
name: text_after
type: VARCHAR(255)
tableName: manual_redaction tableName: manual_redaction
- changeSet: - changeSet:
id: 1637073006104-26 id: 1637073006104-26

View File

@ -77,12 +77,16 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.value("test") .value("test")
.legalBasis("1") .legalBasis("1")
.rectangle(true) .rectangle(true)
.textAfter("Text After")
.textBefore("Text Before")
.build()); .build());
var loadedAddRedaction = manualRedactionClient.getAddRedaction(file.getId(), addRedaction.getAnnotationId()); var loadedAddRedaction = manualRedactionClient.getAddRedaction(file.getId(), addRedaction.getAnnotationId());
assertThat(loadedAddRedaction.getUser()).isEqualTo("user"); assertThat(loadedAddRedaction.getUser()).isEqualTo("user");
assertThat(loadedAddRedaction.getType()).contains("manual"); assertThat(loadedAddRedaction.getType()).contains("manual");
assertThat(loadedAddRedaction.getSection()).contains("section test"); assertThat(loadedAddRedaction.getSection()).contains("section test");
assertThat(loadedAddRedaction.isRectangle()).isEqualTo(true); assertThat(loadedAddRedaction.isRectangle()).isEqualTo(true);
assertThat(loadedAddRedaction.getTextAfter()).isEqualTo("Text After");
assertThat(loadedAddRedaction.getTextBefore()).isEqualTo("Text Before");
manualRedactionClient.updateAddRedactionStatus(dossier.getId(), file.getId(), addRedaction.getAnnotationId(), JSONPrimitive.of(AnnotationStatus.APPROVED)); manualRedactionClient.updateAddRedactionStatus(dossier.getId(), file.getId(), addRedaction.getAnnotationId(), JSONPrimitive.of(AnnotationStatus.APPROVED));
loadedAddRedaction = manualRedactionClient.getAddRedaction(file.getId(), addRedaction.getAnnotationId()); loadedAddRedaction = manualRedactionClient.getAddRedaction(file.getId(), addRedaction.getAnnotationId());
@ -234,12 +238,16 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.positions(List.of(Rectangle.builder().topLeftY(2).topLeftX(2).height(2).width(2).build())) .positions(List.of(Rectangle.builder().topLeftY(2).topLeftX(2).height(2).width(2).build()))
.user("test") .user("test")
.value("some value") .value("some value")
.textAfter("Text After")
.textBefore("Text Before")
.build()); .build());
var loadedResizeRedaction = manualRedactionClient.getResizeRedaction(file.getId(), resizeRedaction.getAnnotationId()); var loadedResizeRedaction = manualRedactionClient.getResizeRedaction(file.getId(), resizeRedaction.getAnnotationId());
assertThat(loadedResizeRedaction.getStatus()).isEqualTo(AnnotationStatus.REQUESTED); assertThat(loadedResizeRedaction.getStatus()).isEqualTo(AnnotationStatus.REQUESTED);
assertThat(loadedResizeRedaction.getUser()).isEqualTo("test"); assertThat(loadedResizeRedaction.getUser()).isEqualTo("test");
assertThat(loadedResizeRedaction.getPositions()).isNotEmpty(); assertThat(loadedResizeRedaction.getPositions()).isNotEmpty();
assertThat(loadedResizeRedaction.getValue()).isEqualTo("some value"); assertThat(loadedResizeRedaction.getValue()).isEqualTo("some value");
assertThat(loadedResizeRedaction.getTextAfter()).isEqualTo("Text After");
assertThat(loadedResizeRedaction.getTextBefore()).isEqualTo("Text Before");
manualRedactionClient.updateResizeRedactionStatus(dossier.getId(), file.getId(), resizeRedaction.getAnnotationId(), JSONPrimitive.of(AnnotationStatus.APPROVED)); manualRedactionClient.updateResizeRedactionStatus(dossier.getId(), file.getId(), resizeRedaction.getAnnotationId(), JSONPrimitive.of(AnnotationStatus.APPROVED));
loadedResizeRedaction = manualRedactionClient.getResizeRedaction(file.getId(), resizeRedaction.getAnnotationId()); loadedResizeRedaction = manualRedactionClient.getResizeRedaction(file.getId(), resizeRedaction.getAnnotationId());