RedactionLogMergeService.java edited online with Bitbucket

This commit is contained in:
Timo Bejan 2021-08-13 13:56:23 +02:00
parent dc2508d0d0
commit b2acdc646d

View File

@ -32,7 +32,6 @@ public class RedactionLogMergeService {
var manualRedactionWrappers = createManualRedactionWrappers(manualRedactions); var manualRedactionWrappers = createManualRedactionWrappers(manualRedactions);
log.info("Adding {}", manualRedactionLogEntries);
for (RedactionLogEntry entry : redactionLog.getRedactionLogEntry()) { for (RedactionLogEntry entry : redactionLog.getRedactionLogEntry()) {
processRedactionLogEntry(manualRedactionWrappers.stream().filter(mr -> entry.getId().equals(mr.getId())) processRedactionLogEntry(manualRedactionWrappers.stream().filter(mr -> entry.getId().equals(mr.getId()))
@ -48,44 +47,44 @@ public class RedactionLogMergeService {
private List<ManualRedactionWrapper> createManualRedactionWrappers(ManualRedactions manualRedactions) { private List<ManualRedactionWrapper> createManualRedactionWrappers(ManualRedactions manualRedactions) {
log.info("Processing Manual Redactions: {}", manualRedactions);
List<ManualRedactionWrapper> manualRedactionWrappers = new ArrayList<>(); List<ManualRedactionWrapper> manualRedactionWrappers = new ArrayList<>();
manualRedactions.getImageRecategorizations().forEach(item -> { manualRedactions.getImageRecategorizations().forEach(item -> {
if (item.getSoftDeletedTime() != null) { if (item.getSoftDeletedTime() == null) {
manualRedactionWrappers.add(new ManualRedactionWrapper(item.getId(), item.getRequestDate(), item)); manualRedactionWrappers.add(new ManualRedactionWrapper(item.getId(), item.getRequestDate(), item));
} }
}); });
manualRedactions.getIdsToRemove().forEach(item -> { manualRedactions.getIdsToRemove().forEach(item -> {
if (item.getSoftDeletedTime() != null) { if (item.getSoftDeletedTime() == null) {
manualRedactionWrappers.add(new ManualRedactionWrapper(item.getId(), item.getRequestDate(), item)); manualRedactionWrappers.add(new ManualRedactionWrapper(item.getId(), item.getRequestDate(), item));
} }
}); });
manualRedactions.getForceRedacts().forEach(item -> { manualRedactions.getForceRedacts().forEach(item -> {
if (item.getSoftDeletedTime() != null) { if (item.getSoftDeletedTime() == null) {
manualRedactionWrappers.add(new ManualRedactionWrapper(item.getId(), item.getRequestDate(), item)); manualRedactionWrappers.add(new ManualRedactionWrapper(item.getId(), item.getRequestDate(), item));
} }
}); });
manualRedactions.getManualLegalBasisChanges().forEach(item -> { manualRedactions.getManualLegalBasisChanges().forEach(item -> {
if (item.getSoftDeletedTime() != null) { if (item.getSoftDeletedTime() == null) {
manualRedactionWrappers.add(new ManualRedactionWrapper(item.getId(), item.getRequestDate(), item)); manualRedactionWrappers.add(new ManualRedactionWrapper(item.getId(), item.getRequestDate(), item));
} }
}); });
Collections.sort(manualRedactionWrappers); Collections.sort(manualRedactionWrappers);
log.info("Obtained manual redaction wrappers: {}", manualRedactionWrappers);
return manualRedactionWrappers; return manualRedactionWrappers;
} }
private void processRedactionLogEntry(List<ManualRedactionWrapper> manualRedactionWrappers, String dossierTemplateId, RedactionLogEntry redactionLogEntry) { private void processRedactionLogEntry(List<ManualRedactionWrapper> manualRedactionWrappers, String dossierTemplateId, RedactionLogEntry redactionLogEntry) {
log.info("Processing: {} for: {}", manualRedactionWrappers, redactionLogEntry);
manualRedactionWrappers.forEach(mrw -> { manualRedactionWrappers.forEach(mrw -> {