Merge branch 'RED-9132-rollback' into 'master'

RED-9132 - Remove debug information from Paragraph/Location field

Closes RED-9132

See merge request redactmanager/redaction-report-service!69
This commit is contained in:
Corina Olariu 2024-05-14 12:24:49 +02:00
commit 4dedf9ff61
2 changed files with 2 additions and 46 deletions

View File

@ -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) {

View File

@ -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);
}
}