Pull request #14: removed legal basis non-sense at it is not reliable
Merge in RED/redaction-report-service from legal-basis-update to master * commit '56ad432feaf758da5e24359dd84d1fa1aa808559': Reverted to reading legal basis, optimistically fixed tests regarding legal basis removed legal basis non-sense at it is not reliable
This commit is contained in:
commit
183532fd07
@ -22,7 +22,7 @@
|
||||
<dependency>
|
||||
<groupId>com.iqser.red.service</groupId>
|
||||
<artifactId>configuration-service-api-v1</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<version>2.1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
|
||||
@ -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<LegalBasisMapping> 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<String, String> reasonByLegalBasis) {
|
||||
List<LegalBasisMapping> 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(""));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -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> legalBasisMapping = objectMapper.readValue(legalBasisMappingResource.getInputStream(), new TypeReference<>() {
|
||||
});
|
||||
|
||||
when(legalBasisMappingClient.getLegalBasisMapping("123")).thenReturn(legalBasisMapping);
|
||||
|
||||
|
||||
@ -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"}}
|
||||
[
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user