hotfix: filter entities with empty value in redactionLog and entityLog #213

Closed
kilian.schuettler1 wants to merge 2 commits from release/4.142.x into master
Showing only changes of commit 1ba3952e9b - Show all commits

View File

@ -90,11 +90,12 @@ public class EntityLogCreatorService {
Set<Integer> sectionsToReanalyseIds,
DictionaryVersion dictionaryVersion) {
previousEntityLog.setEntityLogEntry(previousEntityLog.getEntityLogEntry().stream().filter(entity -> !entity.getValue().isEmpty()).collect(Collectors.toList())); // fix broken entityLogs with empty entries
List<EntityLogEntry> newEntityLogEntries = createEntityLogEntries(document, analyzeRequest.getDossierTemplateId(), notFoundManualRedactionEntries);
Set<String> newEntityIds = newEntityLogEntries.stream().map(EntityLogEntry::getId).collect(Collectors.toSet());
List<EntityLogEntry> entriesFromReanalysedSections = previousEntityLog.getEntityLogEntry()
.stream()
.filter(entry -> !entry.getValue().isEmpty())
.filter(entry -> (newEntityIds.contains(entry.getId()) || sectionsToReanalyseIds.contains(entry.getContainingNodeId().get(0))) && !entry.getType()
.equals(ImportedRedactionService.IMPORTED_REDACTION_TYPE))
.toList();