RED-3252 - Provide endpoint to accept a recommendation instead of storing the ID in the reason field

- add the sourceId to manual add redaction
- update junit tests
This commit is contained in:
devplant 2022-03-14 11:32:35 +02:00
parent f695a2446d
commit a397cbf660
6 changed files with 22 additions and 1 deletions

View File

@ -27,6 +27,7 @@ public class AddRedactionRequest {
private AnnotationStatus status;
private String section;
private boolean rectangle;
private String sourceId;
@Builder.Default
private List<Rectangle> positions = new ArrayList<>();

View File

@ -27,6 +27,7 @@ public class ManualRedactionEntry extends BaseAnnotation {
private List<Rectangle> positions = new ArrayList<>();
private String textBefore;
private String textAfter;
private String sourceId;
@Builder
public ManualRedactionEntry(String annotationId, String fileId,
@ -37,7 +38,7 @@ public class ManualRedactionEntry extends BaseAnnotation {
boolean rectangle, boolean addToDictionary,
boolean addToDossierDictionary, String legalBasis,
String section, String reason, String type,
List<Rectangle> positions) {
List<Rectangle> positions, String sourceId) {
super(annotationId, fileId, user, status, requestDate, processedDate, softDeletedTime);
this.textBefore = textBefore;
this.textAfter = textAfter;
@ -50,6 +51,7 @@ public class ManualRedactionEntry extends BaseAnnotation {
this.reason = reason;
this.type = type;
this.positions = positions != null ? positions : new ArrayList<>();
this.sourceId = sourceId;
}
}

View File

@ -70,5 +70,8 @@ public class ManualRedactionEntryEntity implements IBaseAnnotation {
@Column
private String textAfter;
@Column
private String sourceId;
}

View File

@ -0,0 +1,11 @@
databaseChangeLog:
- changeSet:
id: add-redaction-source-id-column
author: corina
changes:
- addColumn:
columns:
- column:
name: source_id
type: VARCHAR(255)
tableName: manual_redaction

View File

@ -29,3 +29,5 @@ databaseChangeLog:
file: db/changelog/12-dossier-visibility.changelog.yaml
- include:
file: db/changelog/13-file-manual-change-date.changelog.yaml
- include:
file: db/changelog/14-add-redaction-source-id.changelog.yaml

View File

@ -71,6 +71,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.rectangle(true)
.textAfter("Text After")
.textBefore("Text Before")
.sourceId("SourceId")
.build())).iterator().next();
var loadedAddRedaction = manualRedactionClient.getAddRedaction(file.getId(), addRedaction.getAnnotationId());
assertThat(loadedAddRedaction.getUser()).isEqualTo("user");
@ -79,6 +80,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
assertThat(loadedAddRedaction.isRectangle()).isEqualTo(true);
assertThat(loadedAddRedaction.getTextAfter()).isEqualTo("Text After");
assertThat(loadedAddRedaction.getTextBefore()).isEqualTo("Text Before");
assertThat(loadedAddRedaction.getSourceId()).isEqualTo("SourceId");
manualRedactionClient.updateAddRedactionStatus(dossier.getId(), file.getId(),
UpdateRedactionRequest.builder()