Pull request #61: Removed id prefix

Merge in RED/redaction-service from TimoTest to master

* commit '6e83040a50728c491667bdbe211636d245e0cf6a':
  Removed id prefix
This commit is contained in:
Dominique Eiflaender 2020-11-03 09:15:28 +01:00
commit 3371b825ef

View File

@ -102,7 +102,6 @@ public class AnnotationHighlightService {
RedactionLogEntry redactionLogEntry = createRedactionLogEntry(entity);
boolean requestedToRemove = false;
boolean removeFromDictionary = false;
List<Comment> comments = null;
for (EntityPositionSequence entityPositionSequence : entity.getPositionSequences()) {
@ -119,9 +118,6 @@ public class AnnotationHighlightService {
} else if (manualRemoval.getStatus().equals(Status.REQUESTED)) {
requestedToRemove = true;
manualOverrideReason = entity.getRedactionReason() + ", requested to remove";
if (manualRemoval.isRemoveFromDictionary()) {
removeFromDictionary = true;
}
}
entity.setRedactionReason(manualOverrideReason != null ? manualOverrideReason : entity.getRedactionReason());
@ -143,7 +139,7 @@ public class AnnotationHighlightService {
}
redactionLogEntry.getPositions().addAll(rectanglesPerLine);
annotations.addAll(createAnnotation(rectanglesPerLine, prefixId(entity, entityPositionSequence.getId(), requestedToRemove, removeFromDictionary), createAnnotationContent(entity), getColor(entity, requestedToRemove), comments, !isHint(entity)));
annotations.addAll(createAnnotation(rectanglesPerLine, entityPositionSequence.getId(), createAnnotationContent(entity), getColor(entity, requestedToRemove), comments, !isHint(entity)));
}
redactionLogEntry.setId(entityPositionSequence.getId());
@ -154,27 +150,6 @@ public class AnnotationHighlightService {
}
private String prefixId(Entity entity, String id, boolean requestedToRemove, boolean removeFromDictionary) {
if (isHint(entity)) {
return "hint:" + entity.getType() + ":" + id;
}
if (entity.isRedaction() && requestedToRemove && removeFromDictionary) {
return "request:remove:" + entity.getType() + ":" + id;
}
if (entity.isRedaction() && requestedToRemove && !removeFromDictionary) {
return "request:remove:only_here:" + id;
}
if (entity.isRedaction()) {
return "redaction:" + entity.getType() + ":automatic:" + id;
}
return "ignore:" + entity.getType() + ":" + id;
}
private List<Rectangle> getRectanglesPerLine(List<TextPosition> textPositions, int page) {
List<Rectangle> rectangles = new ArrayList<>();
@ -224,7 +199,7 @@ public class AnnotationHighlightService {
}
if (!rectanglesOnPage.isEmpty() && !approvedAndShouldBeInDictionary(manualRedactionEntry)) {
annotations.addAll(createAnnotation(rectanglesOnPage, prefixId(manualRedactionEntry, id), createAnnotationContent(manualRedactionEntry), getColorForManualAdd(manualRedactionEntry
annotations.addAll(createAnnotation(rectanglesOnPage, id, createAnnotationContent(manualRedactionEntry), getColorForManualAdd(manualRedactionEntry
.getType(), manualRedactionEntry.getStatus()), manualRedactions.getComments().get(id), true));
classifiedDoc.getRedactionLogEntities().add(redactionLogEntry);
}
@ -238,23 +213,6 @@ public class AnnotationHighlightService {
}
private String prefixId(ManualRedactionEntry manualRedactionEntry, String id) {
if (manualRedactionEntry.getStatus().equals(Status.APPROVED)) {
return "redaction:" + manualRedactionEntry.getType() + ":manual:" + id;
}
if (manualRedactionEntry.getStatus().equals(Status.REQUESTED)) {
if (manualRedactionEntry.isAddToDictionary()) {
return "request:add:" + manualRedactionEntry.getType() + ":" + id;
}
return "request:add:only_here:" + id;
}
return "ignore:" + manualRedactionEntry.getType() + ":" + id;
}
private RedactionLogEntry createRedactionLogEntry(ManualRedactionEntry manualRedactionEntry, String id) {
return RedactionLogEntry.builder()