Pull request #187: Redaction log backend preview remove code duplication from ui

Merge in RED/redaction-service from redaction-log-backend-preview-remove-code-duplication-from-ui to master

* commit '58dd6841d60ad8562ae0aedf3e0aea2889fb8a4c':
  fixed typo
  update dictionary before preview
This commit is contained in:
Timo Bejan 2021-07-13 14:57:09 +02:00
commit 0851712a10
2 changed files with 4 additions and 3 deletions

View File

@ -161,8 +161,9 @@ public class RedactionController implements RedactionResource {
public RedactionLog getRedactionLogPreview(RedactionRequest redactionRequest) {
log.info("Requested preview for: {}", redactionRequest);
var redactionLog = redactionStorageService.getRedactionLog(redactionRequest.getDossierId(), redactionRequest.getFileId());
dictionaryService.updateDictionary(redactionRequest.getDossierTemplateId(), redactionRequest.getDossierId());
var redactionLog = redactionStorageService.getRedactionLog(redactionRequest.getDossierId(), redactionRequest.getFileId());
return redactionLogCreatorService.getRedactionLogPreview(redactionLog, redactionRequest.getDossierTemplateId(), redactionRequest.getManualRedactions());
}

View File

@ -638,14 +638,14 @@ public class RedactionLogCreatorService {
// 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.setDictionaryEntry(manualRedaction.isAddToDictionary());
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().setDictionaryEntry(manualRedaction.isAddToDictionary());
found.get().setDossierDictionaryEntry(manualRedaction.isAddToDossierDictionary());
found.get().setPositions(manualRedaction.getPositions());
} else {