Pull request #405: RED-3791 - redaction log merge of duplicate annotations
Merge in RED/redaction-service from RED-3791 to master * commit 'ec8d3183dc119e3eddd45a653ca88a2666073f51': RED-3791 - redaction log merge of duplicate annotations
This commit is contained in:
commit
2301849815
@ -76,10 +76,17 @@ public class RedactionLogMergeService {
|
||||
Set<Integer> excludedPages, List<Type> types, Colors colors) {
|
||||
|
||||
var skippedImportedRedactions = new HashSet<>();
|
||||
|
||||
var validSourceIds = new HashSet<>();
|
||||
log.info("Merging Redaction log with manual redactions");
|
||||
if (manualRedactions != null) {
|
||||
|
||||
// entries that have been added to dictionaries
|
||||
validSourceIds.addAll(manualRedactions.getEntriesToAdd().stream()
|
||||
.filter(entry -> entry.getSourceId() != null)
|
||||
.filter(entry -> entry.isAddToDictionary() || entry.isAddToDossierDictionary())
|
||||
.filter(entry -> entry.getStatus() == AnnotationStatus.APPROVED)
|
||||
.filter(entry -> entry.getProcessedDate() != null)
|
||||
.map(ManualRedactionEntry::getSourceId).collect(Collectors.toList()));
|
||||
|
||||
var manualRedactionLogEntries = addManualAddEntries(sectionGrid, manualRedactions.getEntriesToAdd(), manualRedactions.getComments(), colors, types);
|
||||
|
||||
@ -112,6 +119,11 @@ public class RedactionLogMergeService {
|
||||
|
||||
Set<String> processedIds = new HashSet<>();
|
||||
redactionLog.getRedactionLogEntry().removeIf(entry -> {
|
||||
|
||||
if(validSourceIds.contains(entry.getId())){
|
||||
return true;
|
||||
}
|
||||
|
||||
if (entry.getImportedRedactionIntersections() != null) {
|
||||
entry.getImportedRedactionIntersections().removeAll(skippedImportedRedactions);
|
||||
if (!entry.getImportedRedactionIntersections().isEmpty() && (!entry.isImage() || entry.isImage() && !(entry.getType().equals("image") || entry.getType().equals("ocr")))) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user