From 752f9d6888a9ffa4292465a6eee94a4a3b0a5aa8 Mon Sep 17 00:00:00 2001 From: Corina Olariu Date: Mon, 13 May 2024 19:46:07 +0300 Subject: [PATCH] RED-9132 - Remove debug information from Paragraph/Location field - rollback to update the entry section for reports. Will be done in redaction-service in the entity log --- .../service/EntityLogConverterService.java | 13 +------ .../EntityLogConverterServiceTest.java | 35 +------------------ 2 files changed, 2 insertions(+), 46 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/EntityLogConverterService.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/EntityLogConverterService.java index 02042b8..5febc31 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/EntityLogConverterService.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/EntityLogConverterService.java @@ -38,7 +38,6 @@ import lombok.extern.slf4j.Slf4j; @RequiredArgsConstructor public class EntityLogConverterService { - private final static String numericalIdentifierPatternForSection = "^.*\\d\\s*+\\]\\:"; private final DossierClient dossierClient; private final DictionaryClient dictionaryClient; @@ -193,7 +192,7 @@ public class EntityLogConverterService { private String getSection(EntityLogEntry entry, Position position) { if (StringUtils.isNotBlank(entry.getSection())) { - return removeNumericalIdentifierPatternFromSection(entry.getSection()); + return entry.getSection(); } if (entry.getEntryType() == EntryType.IMAGE || entry.getEntryType() == EntryType.IMAGE_HINT) { @@ -208,16 +207,6 @@ public class EntityLogConverterService { } - public String removeNumericalIdentifierPatternFromSection(String section) { - - String[] sectionParts = section.split(numericalIdentifierPatternForSection); - if (sectionParts.length > 1) { - return sectionParts[1].trim(); - } - return section.trim(); - } - - private String checkTextForNull(String text) { if (text == null) { diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/test/java/com/iqser/red/service/redaction/report/v1/server/service/EntityLogConverterServiceTest.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/test/java/com/iqser/red/service/redaction/report/v1/server/service/EntityLogConverterServiceTest.java index 9dd989a..f201f59 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/test/java/com/iqser/red/service/redaction/report/v1/server/service/EntityLogConverterServiceTest.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/test/java/com/iqser/red/service/redaction/report/v1/server/service/EntityLogConverterServiceTest.java @@ -80,43 +80,10 @@ public class EntityLogConverterServiceTest { assertFalse(reportEntries.isEmpty()); assertEquals(reportEntries.size(), 61); assertEquals(reportEntries.get(0).getPage(), 1); - assertEquals(reportEntries.get(0).getSection(), "Section: Rule 1/2: Redact CBI"); + assertEquals(reportEntries.get(0).getSection(), "[1]: Section: Rule 1/2: Redact CBI"); assertEquals(reportEntries.get(0).getJustification(), "Article 39(e)(3) of Regulation (EC) No 178/2002 "); assertEquals(reportEntries.get(0).getJustificationParagraph(), "Article 39(e)(3) of Regulation (EC) No 178/2002"); assertFalse(reportEntries.get(0).isSkipped()); } - - @Test - public void testSection() { - - String sectionResult = "Paragraph"; - String section1 = "[1.1.1]: Paragraph"; - String section2 = "[1. 1.1]: Paragraph"; - String section3 = "[1,1.1]: Paragraph"; - String section4 = "[1,1,1]: Paragraph"; - String section5 = "[29]: Paragraph"; - String section6 = "[29 ]: Paragraph"; - String section7 = "[ 1, 1 . 2]: Paragraph"; - String section8 = "[ 29]: Paragraph"; - String section9 = "[ 1.1.1]: Paragraph"; - String section10 = "[ 29 ]: Paragraph"; - String section11 = "[ 1, 1. 1]: Paragraph"; - String section12 = " Paragraph"; - - assertEquals(entityLogConverterService.removeNumericalIdentifierPatternFromSection(section1), sectionResult); - assertEquals(entityLogConverterService.removeNumericalIdentifierPatternFromSection(section2), sectionResult); - assertEquals(entityLogConverterService.removeNumericalIdentifierPatternFromSection(section3), sectionResult); - assertEquals(entityLogConverterService.removeNumericalIdentifierPatternFromSection(section4), sectionResult); - assertEquals(entityLogConverterService.removeNumericalIdentifierPatternFromSection(section5), sectionResult); - assertEquals(entityLogConverterService.removeNumericalIdentifierPatternFromSection(section6), sectionResult); - assertEquals(entityLogConverterService.removeNumericalIdentifierPatternFromSection(section7), sectionResult); - assertEquals(entityLogConverterService.removeNumericalIdentifierPatternFromSection(section8), sectionResult); - assertEquals(entityLogConverterService.removeNumericalIdentifierPatternFromSection(section9), sectionResult); - assertEquals(entityLogConverterService.removeNumericalIdentifierPatternFromSection(section10), sectionResult); - assertEquals(entityLogConverterService.removeNumericalIdentifierPatternFromSection(section11), sectionResult); - assertEquals(entityLogConverterService.removeNumericalIdentifierPatternFromSection(section12), sectionResult); - - } - }