From 9465f763e67cf1ab19ac109f02c2a8e4bb31c78d Mon Sep 17 00:00:00 2001 From: Ali Oezyetimoglu Date: Thu, 6 Apr 2023 12:43:42 +0200 Subject: [PATCH] RED-6098: Removed changing of reportEntries --- .../service/ExcelReportGenerationService.java | 17 +++++++++-------- .../service/WordReportGenerationService.java | 5 ++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ExcelReportGenerationService.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ExcelReportGenerationService.java index 7fc816d..38d39b9 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ExcelReportGenerationService.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ExcelReportGenerationService.java @@ -100,7 +100,7 @@ public class ExcelReportGenerationService { @Timed("redactmanager_generateExcelReport") - public void generateExcelReport(List reportEntries, + public void generateExcelReport(List allReportEntries, PlaceholderModel placeholderModel, String reportTemplateName, SXSSFWorkbook workbook, @@ -111,10 +111,9 @@ public class ExcelReportGenerationService { long start = System.currentTimeMillis(); - - if (!excelModel.isSkippedPlaceholderPresent()) { - reportEntries = reportEntries.stream().filter(entry -> !entry.isSkipped()).collect(Collectors.toList()); - } + List reportEntries = !excelModel.isSkippedPlaceholderPresent() ? allReportEntries.stream() + .filter(entry -> !entry.isSkipped()) + .collect(Collectors.toList()) : allReportEntries; try { @@ -376,7 +375,7 @@ public class ExcelReportGenerationService { return placeholderInput -> placeholderInput.getPlaceholderModel().getDossierAttributesValueByPlaceholder().get(placeholder); } - return switch(placeholder) { + return switch (placeholder) { case FILE_NAME_PLACEHOLDER -> PlaceholderInput::getFilename; case PAGE_PLACEHOLDER -> input -> String.valueOf(input.getEntry().getPage()); case PARAGRAPH_PLACEHOLDER -> input -> input.getEntry().getSection(); @@ -384,8 +383,10 @@ public class ExcelReportGenerationService { case JUSTIFICATION_PARAGRAPH_PLACEHOLDER, JUSTIFICATION_LEGAL_BASIS_PLACEHOLDER -> input -> input.getEntry().getJustificationParagraph(); case JUSTIFICATION_REASON_PLACEHOLDER, JUSTIFICATION_TEXT_PLACEHOLDER -> input -> input.getEntry().getJustificationReason(); case EXCERPT_PLACEHOLDER -> input -> input.getEntry().getExcerpt(); - case REDACTION_VALUE_PLACEHOLDER -> input -> input.getEntry().getValue() != null ? input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" {2,}", " ") : input.getEntry() - .getEntityDisplayName(); + case REDACTION_VALUE_PLACEHOLDER -> input -> input.getEntry().getValue() != null ? input.getEntry() + .getValue() + .replaceAll("\n", " ") + .replaceAll(" {2,}", " ") : input.getEntry().getEntityDisplayName(); case REDACTION_ENTITY_DISPLAY_NAME_PLACEHOLDER -> input -> input.getEntry().getEntityDisplayName(); case SKIPPED_PLACEHOLDER -> input -> input.getEntry().isSkipped() ? "true" : "false"; default -> input -> ""; diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/WordReportGenerationService.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/WordReportGenerationService.java index 132f3f7..e463ef4 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/WordReportGenerationService.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/WordReportGenerationService.java @@ -82,7 +82,7 @@ public class WordReportGenerationService { @Timed("redactmanager_generateWordReport") - public int generateWordReport(List reportEntries, + public int generateWordReport(List allReportEntries, PlaceholderModel placeholderModel, String reportTemplateName, XWPFDocument doc, @@ -92,8 +92,7 @@ public class WordReportGenerationService { long start = System.currentTimeMillis(); - // currently word reports should not contain skipped redactions - reportEntries = reportEntries.stream().filter(entry -> !entry.isSkipped()).collect(Collectors.toList()); + ListreportEntries = allReportEntries.stream().filter(entry -> !entry.isSkipped()).collect(Collectors.toList()); int sumOfChars = 0;