From 2d0a6d4d29034c1afee5a122a87135614e099fbd Mon Sep 17 00:00:00 2001 From: Timo Date: Tue, 13 Jul 2021 11:39:44 +0300 Subject: [PATCH] fixed pmd --- .../service/RedactionLogCreatorService.java | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/service/RedactionLogCreatorService.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/service/RedactionLogCreatorService.java index aa60d857..ee628067 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/service/RedactionLogCreatorService.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/service/RedactionLogCreatorService.java @@ -635,26 +635,24 @@ public class RedactionLogCreatorService { for (var manualRedaction : manualRedactions.getEntriesToAdd()) { - if (manualRedaction.getProcessedDate() == null) { - - if (manualRedaction.isAddToDictionary() || manualRedaction.isAddToDossierDictionary()) { - var redactionLogEntry = createRedactionLogEntry(manualRedaction, manualRedaction.getId(), dossierTemplateId); - redactionLogEntry.setDictionaryEntry(manualRedaction.isAddToDossierDictionary()); - redactionLogEntry.setDossierDictionaryEntry(manualRedaction.isAddToDossierDictionary()); - redactionLogEntry.setPositions(manualRedaction.getPositions()); - - - var found = redactionLog.getRedactionLogEntry().stream().filter(r -> r.getId().equalsIgnoreCase(redactionLogEntry.getId())).findAny(); - if (found.isPresent()) { - found.get().setDictionaryEntry(manualRedaction.isAddToDossierDictionary()); - found.get().setDossierDictionaryEntry(manualRedaction.isAddToDossierDictionary()); - found.get().setPositions(manualRedaction.getPositions()); - } else { - redactionLog.getRedactionLogEntry().add(redactionLogEntry); - } + // not yet processed, and dictionary modifying, show in redaction-log preview + if (manualRedaction.getProcessedDate() == null && manualRedaction.isAddToDictionary() || manualRedaction.isAddToDossierDictionary()) { + var redactionLogEntry = createRedactionLogEntry(manualRedaction, manualRedaction.getId(), dossierTemplateId); + redactionLogEntry.setDictionaryEntry(manualRedaction.isAddToDossierDictionary()); + redactionLogEntry.setDossierDictionaryEntry(manualRedaction.isAddToDossierDictionary()); + redactionLogEntry.setPositions(manualRedaction.getPositions()); + var found = redactionLog.getRedactionLogEntry().stream().filter(r -> r.getId().equalsIgnoreCase(redactionLogEntry.getId())).findAny(); + if (found.isPresent()) { + found.get().setDictionaryEntry(manualRedaction.isAddToDossierDictionary()); + found.get().setDossierDictionaryEntry(manualRedaction.isAddToDossierDictionary()); + found.get().setPositions(manualRedaction.getPositions()); + } else { + redactionLog.getRedactionLogEntry().add(redactionLogEntry); } + + } } }