RED-3791 - redaction log merge of duplicate annotations
This commit is contained in:
parent
6fec4cc209
commit
ec8d3183dc
@ -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