From 7f972556f41aa182c3e990f043f1901a8cfde96c Mon Sep 17 00:00:00 2001 From: Ali Oezyetimoglu Date: Wed, 30 Nov 2022 17:21:34 +0100 Subject: [PATCH 1/7] RED-5473: try to get list of types --- .../report/v1/server/service/ReportGenerationService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ReportGenerationService.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ReportGenerationService.java index 598971e..a68da39 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ReportGenerationService.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ReportGenerationService.java @@ -8,6 +8,7 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.xssf.streaming.SXSSFWorkbook; @@ -327,6 +328,10 @@ public class ReportGenerationService { typeList.addAll(dictionaryClient.getAllTypesForDossier(dossierId, false)); typeList.addAll(dictionaryClient.getAllTypesForDossierTemplate(dossierClient.getDossierById(dossierId, true, false).getDossierTemplateId(), false)); + // TODO: remove 2 lines + var a = typeList.stream().map(Type::getType).collect(Collectors.toList()); + log.info("typeList: {}", a); + Map mapOfEntityDisplayName = new HashMap<>(); for (var type : typeList) { From d345ba1faebf34e4938a410ffe4dd6a901e7109e Mon Sep 17 00:00:00 2001 From: Ali Oezyetimoglu Date: Wed, 30 Nov 2022 17:38:14 +0100 Subject: [PATCH 2/7] RED-5473: try to get redaction value --- .../v1/server/service/ExcelReportGenerationService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 9f14d6c..b59ca22 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 @@ -383,7 +383,9 @@ public class ExcelReportGenerationService { return input -> input.getEntry().getExcerpt(); } if (placeholder.equals(REDACTION_VALUE_PLACEHOLDER)) { - return input -> input.getEntry().getValue() != null ? input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " ") : ""; +// return input -> input.getEntry().getValue() != null ? input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " ") : ""; + //TODO: comment in above and delete down + return input -> input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " "); } if (placeholder.equals(REDACTION_ENTITY_DISPLAY_NAME_PLACEHOLDER)) { return input -> input.getEntry().getEntityDisplayName(); From c5a092990de0907c4e49df7b22933197208868c2 Mon Sep 17 00:00:00 2001 From: Ali Oezyetimoglu Date: Wed, 30 Nov 2022 17:45:46 +0100 Subject: [PATCH 3/7] RED-5473: try to get redaction value --- .../v1/server/service/ExcelReportGenerationService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 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 b59ca22..a92c017 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 @@ -383,9 +383,10 @@ public class ExcelReportGenerationService { return input -> input.getEntry().getExcerpt(); } if (placeholder.equals(REDACTION_VALUE_PLACEHOLDER)) { -// return input -> input.getEntry().getValue() != null ? input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " ") : ""; - //TODO: comment in above and delete down - return input -> input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " "); + // TODO: remove 2 lines + Function aa = input -> input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " "); + log.info("REDACTION_VALUE: {}", aa); + return input -> input.getEntry().getValue() != null ? input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " ") : ""; } if (placeholder.equals(REDACTION_ENTITY_DISPLAY_NAME_PLACEHOLDER)) { return input -> input.getEntry().getEntityDisplayName(); From 318882d8c37b29e0630ab6346be4ed5f4535e4b1 Mon Sep 17 00:00:00 2001 From: Ali Oezyetimoglu Date: Mon, 5 Dec 2022 14:18:41 +0100 Subject: [PATCH 4/7] RED-5473: try to get redaction value --- .../service/ExcelReportGenerationService.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 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 a92c017..c6cf267 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 @@ -383,10 +383,20 @@ public class ExcelReportGenerationService { return input -> input.getEntry().getExcerpt(); } if (placeholder.equals(REDACTION_VALUE_PLACEHOLDER)) { - // TODO: remove 2 lines - Function aa = input -> input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " "); - log.info("REDACTION_VALUE: {}", aa); - return input -> input.getEntry().getValue() != null ? input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " ") : ""; + +// return input -> input.getEntry().getValue() != null ? input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " ") : ""; +// return input -> input.getEntry().getValue() != null ? input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " ") : computeValueForSignatureRedactions(input); + return input -> input.getEntry().getValue() != null ? input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " ") : input.getEntry().getEntityDisplayName(); + +// return input -> { +// String value = ""; +// if (input.getEntry().getValue() != null) { +// value = input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " "); +// } else { +// value = computeValueForSignatureRedactions(input); +// } +// return value; +// }; } if (placeholder.equals(REDACTION_ENTITY_DISPLAY_NAME_PLACEHOLDER)) { return input -> input.getEntry().getEntityDisplayName(); @@ -394,6 +404,12 @@ public class ExcelReportGenerationService { return input -> ""; } +// private String computeValueForSignatureRedactions(PlaceholderInput input) { +// +// System.out.println(input.getEntry().getEntityDisplayName()); +// return input.getEntry().getEntityDisplayName(); +// } + private void replacePlaceholdersForCell(Cell cell, String search, String replace) { From e7a05a670e1d6859eec2ba0b87b02ea799c4cd3d Mon Sep 17 00:00:00 2001 From: Ali Oezyetimoglu Date: Mon, 5 Dec 2022 14:27:53 +0100 Subject: [PATCH 5/7] RED-5473: fixed output of value placeholder for empty values by adding type of entry --- .../service/ExcelReportGenerationService.java | 17 ----------------- .../server/service/IuclidFunctionService.java | 2 +- 2 files changed, 1 insertion(+), 18 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 c6cf267..5aa1ae8 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 @@ -384,19 +384,8 @@ public class ExcelReportGenerationService { } if (placeholder.equals(REDACTION_VALUE_PLACEHOLDER)) { -// return input -> input.getEntry().getValue() != null ? input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " ") : ""; -// return input -> input.getEntry().getValue() != null ? input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " ") : computeValueForSignatureRedactions(input); return input -> input.getEntry().getValue() != null ? input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " ") : input.getEntry().getEntityDisplayName(); -// return input -> { -// String value = ""; -// if (input.getEntry().getValue() != null) { -// value = input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " "); -// } else { -// value = computeValueForSignatureRedactions(input); -// } -// return value; -// }; } if (placeholder.equals(REDACTION_ENTITY_DISPLAY_NAME_PLACEHOLDER)) { return input -> input.getEntry().getEntityDisplayName(); @@ -404,12 +393,6 @@ public class ExcelReportGenerationService { return input -> ""; } -// private String computeValueForSignatureRedactions(PlaceholderInput input) { -// -// System.out.println(input.getEntry().getEntityDisplayName()); -// return input.getEntry().getEntityDisplayName(); -// } - private void replacePlaceholdersForCell(Cell cell, String search, String replace) { diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/IuclidFunctionService.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/IuclidFunctionService.java index a9cbd64..952bb51 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/IuclidFunctionService.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/IuclidFunctionService.java @@ -36,7 +36,7 @@ public class IuclidFunctionService { ReportRedactionEntry entry = iterator.next(); s.append("P").append(entry.getPage()).append(" "); if (StringUtils.isBlank(entry.getValue()) || entry.getValue().equalsIgnoreCase("Rectangle")) { - s.append("non-readable content"); + s.append(entry.getEntityDisplayName()).append(" - non-readable content"); } else { s.append(entry.getValue().replaceAll("\n", " ").replaceAll(" ", " ")); } From e21e74bff3bbea92aec040d07ecd8b861ff1bcb3 Mon Sep 17 00:00:00 2001 From: Ali Oezyetimoglu Date: Mon, 5 Dec 2022 14:33:05 +0100 Subject: [PATCH 6/7] RED-5473: removed unnecessary log of typeslist --- .../report/v1/server/service/ReportGenerationService.java | 4 ---- 1 file changed, 4 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/ReportGenerationService.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ReportGenerationService.java index a68da39..a66b887 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ReportGenerationService.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ReportGenerationService.java @@ -328,10 +328,6 @@ public class ReportGenerationService { typeList.addAll(dictionaryClient.getAllTypesForDossier(dossierId, false)); typeList.addAll(dictionaryClient.getAllTypesForDossierTemplate(dossierClient.getDossierById(dossierId, true, false).getDossierTemplateId(), false)); - // TODO: remove 2 lines - var a = typeList.stream().map(Type::getType).collect(Collectors.toList()); - log.info("typeList: {}", a); - Map mapOfEntityDisplayName = new HashMap<>(); for (var type : typeList) { From 4473060ddaec611ceeefad13a60373dac85e1331 Mon Sep 17 00:00:00 2001 From: Ali Oezyetimoglu Date: Mon, 5 Dec 2022 14:46:29 +0100 Subject: [PATCH 7/7] RED-5473: added value fix for Word reports --- .../report/v1/server/service/WordReportGenerationService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 8092425..92cc1b7 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 @@ -433,7 +433,7 @@ public class WordReportGenerationService { } if (placeholder.equals(REDACTION_VALUE_PLACEHOLDER)) { foundPlaceholders.add(REDACTION_VALUE_PLACEHOLDER); - return input -> input.getEntry().getValue() != null ? input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " ") : ""; + return input -> input.getEntry().getValue() != null ? input.getEntry().getValue().replaceAll("\n", " ").replaceAll(" ", " ") : input.getEntry().getEntityDisplayName(); } if (placeholder.equals(REDACTION_ENTITY_DISPLAY_NAME_PLACEHOLDER)) { foundPlaceholders.add(REDACTION_ENTITY_DISPLAY_NAME_PLACEHOLDER);