diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/pom.xml b/redaction-report-service-v1/redaction-report-service-server-v1/pom.xml
index 4829e4c..5b8a9bf 100644
--- a/redaction-report-service-v1/redaction-report-service-server-v1/pom.xml
+++ b/redaction-report-service-v1/redaction-report-service-server-v1/pom.xml
@@ -22,7 +22,7 @@
com.iqser.red.service
configuration-service-api-v1
- 2.0.0
+ 2.1.4
org.apache.poi
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 07eb7c5..2f6d5f4 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
@@ -24,7 +24,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Comparator;
import java.util.List;
-import java.util.Map;
import java.util.stream.Collectors;
@Service
@@ -58,8 +57,8 @@ public class ReportGenerationService {
try (ByteArrayInputStream is = new ByteArrayInputStream(template)) {
XWPFDocument doc = new XWPFDocument(is);
- LegalBasisMapping legalBasisMapping = legalBasisMappingClient.getLegalBasisMapping(multiFileRedactionLog.getRuleSetId());
- addTableRows(doc, multiFileRedactionLog, legalBasisMapping.getReasonByLegalBasis());
+ List legalBasisMappings = legalBasisMappingClient.getLegalBasisMapping(multiFileRedactionLog.getRuleSetId());
+ addTableRows(doc, multiFileRedactionLog, legalBasisMappings);
return toByteArray(doc);
} catch (IOException e) {
throw new RuntimeException(e);
@@ -68,7 +67,7 @@ public class ReportGenerationService {
private void addTableRows(XWPFDocument doc, MultiFileRedactionLog multiFileRedactionLog,
- Map reasonByLegalBasis) {
+ List legalBasisMappings) {
XWPFTable table = doc.getTables().get(0);
@@ -109,7 +108,13 @@ public class ReportGenerationService {
setText(row.getCell(0), fileRedactionLog.getFilename());
setText(row.getCell(1), String.valueOf(page));
setText(row.getCell(2), entry.getSection());
- setText(row.getCell(3), entry.getLegalBasis() + " " + reasonByLegalBasis.get(entry.getLegalBasis()));
+ setText(row.getCell(3), entry.getLegalBasis() + " " +
+ legalBasisMappings
+ .stream()
+ .filter(lbm -> lbm.getReason().equalsIgnoreCase(entry.getLegalBasis()))
+ .findAny()
+ .map(LegalBasisMapping::getDescription)
+ .orElse(""));
});
}
});
diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/test/java/com/iqser/red/service/redaction/report/v1/server/RedactionReportIntegrationTest.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/test/java/com/iqser/red/service/redaction/report/v1/server/RedactionReportIntegrationTest.java
index e953d7c..4b5a5ef 100644
--- a/redaction-report-service-v1/redaction-report-service-server-v1/src/test/java/com/iqser/red/service/redaction/report/v1/server/RedactionReportIntegrationTest.java
+++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/test/java/com/iqser/red/service/redaction/report/v1/server/RedactionReportIntegrationTest.java
@@ -1,5 +1,6 @@
package com.iqser.red.service.redaction.report.v1.server;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.iqser.red.service.configuration.v1.api.model.LegalBasisMapping;
import com.iqser.red.service.redaction.report.v1.api.model.MultiFileRedactionLog;
@@ -41,7 +42,8 @@ public class RedactionReportIntegrationTest {
ClassPathResource legalBasisMappingResource = new ClassPathResource("files/LegalBasisMapping.json");
- LegalBasisMapping legalBasisMapping = objectMapper.readValue(legalBasisMappingResource.getInputStream(), LegalBasisMapping.class);
+ List legalBasisMapping = objectMapper.readValue(legalBasisMappingResource.getInputStream(), new TypeReference<>() {
+ });
when(legalBasisMappingClient.getLegalBasisMapping("123")).thenReturn(legalBasisMapping);
diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/test/resources/files/LegalBasisMapping.json b/redaction-report-service-v1/redaction-report-service-server-v1/src/test/resources/files/LegalBasisMapping.json
index 6d389cf..9c042de 100644
--- a/redaction-report-service-v1/redaction-report-service-server-v1/src/test/resources/files/LegalBasisMapping.json
+++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/test/resources/files/LegalBasisMapping.json
@@ -1 +1,30 @@
-{"reasonByLegalBasis":{"Reg (EC) No 1107/2009 Art. 63 (2d)":"methods of analysis for impurities in the active substance as manufactured except for methods for impurities that are considered to be toxicologically, ecotoxicologically or environmentally relevant","Reg (EC) No 1107/2009 Art. 63 (2c)":"results of production batches of the active substance including impurities","Reg (EC) No 1107/2009 Art. 63 (2b)":"the specification of impurity of the active substance except for the impurities that are considered to be toxicologically, ecotoxicologically or environmentally relevant","Reg (EC) No 1107/2009 Art. 63 (2a)":"the method of manufacture","Reg (EC) No 1107/2009 Art. 63 (2g)":"names and addresses of persons involved in testing on vertebrate animals","Reg (EC) No 1107/2009 Art. 63 (2f)":"information on the complete composition of a plant protection product","Reg (EC) No 1107/2009 Art. 63 (2e)":"links between a producer or importer and the applicant or the authorisation holder"}}
\ No newline at end of file
+[
+ {
+ "reason": "Reg (EC) No 1107/2009 Art. 63 (2d)",
+ "description": "methods of analysis for impurities in the active substance as manufactured except for methods for impurities that are considered to be toxicologically, ecotoxicologically or environmentally relevant"
+ },
+ {
+ "reason": "Reg (EC) No 1107/2009 Art. 63 (2c)",
+ "description": "results of production batches of the active substance including impurities"
+ },
+ {
+ "reason": "Reg (EC) No 1107/2009 Art. 63 (2b)",
+ "description": "the specification of impurity of the active substance except for the impurities that are considered to be toxicologically, ecotoxicologically or environmentally relevant"
+ },
+ {
+ "reason": "Reg (EC) No 1107/2009 Art. 63 (2a)",
+ "description": "the method of manufacture"
+ },
+ {
+ "reason": "Reg (EC) No 1107/2009 Art. 63 (2g)",
+ "description": "names and addresses of persons involved in testing on vertebrate animals"
+ },
+ {
+ "reason": "Reg (EC) No 1107/2009 Art. 63 (2f)",
+ "description": "information on the complete composition of a plant protection product"
+ },
+ {
+ "reason": "Reg (EC) No 1107/2009 Art. 63 (2e)",
+ "description": "links between a producer or importer and the applicant or the authorisation holder"
+ }
+]