diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/service/RedactionLogMergeService.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/service/RedactionLogMergeService.java index 5f2f8a75..3114d026 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/service/RedactionLogMergeService.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/service/RedactionLogMergeService.java @@ -277,15 +277,17 @@ public class RedactionLogMergeService { for (ManualRedactionEntry manualRedactionEntry : manualAdds) { - RedactionLogEntry redactionLogEntry = createRedactionLogEntry(manualRedactionEntry, manualRedactionEntry.getAnnotationId(), dossierTemplateId); - redactionLogEntry.setPositions(convertPositions(manualRedactionEntry.getPositions())); - redactionLogEntry.setComments(comments.get(manualRedactionEntry.getAnnotationId())); - redactionLogEntry.setTextBefore(manualRedactionEntry.getTextBefore()); - redactionLogEntry.setTextAfter(manualRedactionEntry.getTextAfter()); + if (shouldCreateManualEntry(manualRedactionEntry)) { + RedactionLogEntry redactionLogEntry = createRedactionLogEntry(manualRedactionEntry, manualRedactionEntry.getAnnotationId(), dossierTemplateId); + redactionLogEntry.setPositions(convertPositions(manualRedactionEntry.getPositions())); + redactionLogEntry.setComments(comments.get(manualRedactionEntry.getAnnotationId())); + redactionLogEntry.setTextBefore(manualRedactionEntry.getTextBefore()); + redactionLogEntry.setTextAfter(manualRedactionEntry.getTextAfter()); - sectionTextService.handleSectionText(sectionGrid, redactionLogEntry); + sectionTextService.handleSectionText(sectionGrid, redactionLogEntry); - redactionLogEntries.add(redactionLogEntry); + redactionLogEntries.add(redactionLogEntry); + } } return redactionLogEntries; @@ -300,6 +302,14 @@ public class RedactionLogMergeService { .collect(Collectors.toList()); } + + private boolean shouldCreateManualEntry(ManualRedactionEntry manualRedactionEntry) { + + return (!manualRedactionEntry.isAddToDictionary() && !manualRedactionEntry.isAddToDossierDictionary()) + || ((manualRedactionEntry.isAddToDictionary() || manualRedactionEntry.isAddToDictionary()) && manualRedactionEntry.getProcessedDate() == null); + } + + private RedactionLogEntry createRedactionLogEntry(ManualRedactionEntry manualRedactionEntry, String id, String dossierTemplateId) {