diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/RedactionLogConverterService.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/RedactionLogConverterService.java index bd0f691..c98cd88 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/RedactionLogConverterService.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/RedactionLogConverterService.java @@ -15,6 +15,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.AnnotationStatus; +import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.Dossier; import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.type.Type; import com.iqser.red.service.persistence.service.v1.api.shared.model.redactionlog.ManualRedactionType; import com.iqser.red.service.persistence.service.v1.api.shared.model.redactionlog.Rectangle; @@ -42,7 +43,7 @@ public class RedactionLogConverterService { @Timed("redactmanager_getReportEntries") - public List getReportEntries(String dossierId, String fileId, boolean isExcluded) { + public List getReportEntries(String dossierId, String fileId, boolean isExcluded, Dossier dossier) { if (isExcluded) { return new ArrayList<>(); @@ -58,7 +59,7 @@ public class RedactionLogConverterService { } var legalBasisMappings = redactionLog.getLegalBasis(); - return convertAndSort(redactionLog, legalBasisMappings, mapOfEntityDisplayName, dossierId); + return convertAndSort(redactionLog, legalBasisMappings, mapOfEntityDisplayName, dossier); } @@ -82,11 +83,11 @@ public class RedactionLogConverterService { public List convertAndSort(RedactionLog redactionLog, List legalBasisMappings, Map mapOfEntityDisplayName, - String dossierId) { + Dossier dossier) { List reportEntries = new ArrayList<>(); - var allTypes = dictionaryClient.getAllTypesForDossierTemplate(dossierClient.getDossierById(dossierId, false, false).getDossierTemplateId(), false); + var allTypes = dictionaryClient.getAllTypesForDossierTemplate(dossier.getDossierTemplateId(), false); redactionLog.getRedactionLogEntry().forEach(entry -> { var isSkipped = !entry.isRedacted() && !entry.isHint() && !isHintType(allTypes, entry.getType()); 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 c3d21a3..4280634 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 @@ -80,7 +80,7 @@ public class ReportGenerationService { var fileStatus = fileStatusClient.getFileStatus(dossierId, fileId); generatePlaceholderService.resolveFileAttributeValues(fileStatus, placeholderModel); - List reportEntries = redactionLogConverterService.getReportEntries(dossierId, fileId, fileStatus.isExcluded()); + List reportEntries = redactionLogConverterService.getReportEntries(dossierId, fileId, fileStatus.isExcluded(), dossier); generateMultiFileExcelReports(reportTemplates.multiFileWorkbookReportTemplates, placeholderModel, fileStatus, isLastFile, dossierName, reportEntries); 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 c062181..40ab973 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 @@ -156,7 +156,7 @@ public class RedactionReportIntegrationTest { RedactionLog redactionLog = objectMapper.readValue(new ClassPathResource("files/redactionLog.json").getInputStream(), RedactionLog.class); List legalBasisMapping = objectMapper.readValue(new ClassPathResource("files/legalBasisMapping.json").getInputStream(), new TypeReference<>() { }); - List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, new HashMap<>(), dossier.getDossierId()); + List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, new HashMap<>(), dossier); var wordTemplateResource = new ClassPathResource("templates/Justification Appendix A1.docx"); var imageResource = new ClassPathResource("files/exampleImage.jpg"); @@ -193,7 +193,7 @@ public class RedactionReportIntegrationTest { RedactionLog redactionLog = objectMapper.readValue(new ClassPathResource("files/redactionLog.json").getInputStream(), RedactionLog.class); List legalBasisMapping = objectMapper.readValue(new ClassPathResource("files/legalBasisMapping.json").getInputStream(), new TypeReference<>() { }); - List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, new HashMap<>(), dossier.getDossierId()); + List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, new HashMap<>(), dossier); var wordTemplateResource = new ClassPathResource("templates/Justification Appendix A2.docx"); var imageResource = new ClassPathResource("files/exampleImage.jpg"); @@ -272,7 +272,7 @@ public class RedactionReportIntegrationTest { RedactionLog redactionLog = objectMapper.readValue(new ClassPathResource("files/redactionLog.json").getInputStream(), RedactionLog.class); List legalBasisMapping = objectMapper.readValue(new ClassPathResource("files/legalBasisMapping.json").getInputStream(), new TypeReference<>() { }); - List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, new HashMap<>(), dossier.getDossierId()); + List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, new HashMap<>(), dossier); ClassPathResource templateResource = new ClassPathResource("templates/IUCLID_Template.docx"); XWPFDocument doc = new XWPFDocument(templateResource.getInputStream()); @@ -298,7 +298,7 @@ public class RedactionReportIntegrationTest { RedactionLog redactionLog = objectMapper.readValue(new ClassPathResource("files/redactionLog.json").getInputStream(), RedactionLog.class); List legalBasisMapping = objectMapper.readValue(new ClassPathResource("files/legalBasisMapping.json").getInputStream(), new TypeReference<>() { }); - List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, new HashMap<>(), dossier.getDossierId()); + List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, new HashMap<>(), dossier); ClassPathResource templateResource = new ClassPathResource("templates/Seeds - New Justification Form.docx"); XWPFDocument doc = new XWPFDocument(templateResource.getInputStream()); @@ -324,14 +324,14 @@ public class RedactionReportIntegrationTest { RedactionLog redactionLog = objectMapper.readValue(new ClassPathResource("files/redactionLog.json").getInputStream(), RedactionLog.class); List legalBasisMapping = objectMapper.readValue(new ClassPathResource("files/legalBasisMapping.json").getInputStream(), new TypeReference<>() { }); - List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, new HashMap<>(), dossier.getDossierId()); + List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, new HashMap<>(), dossier); FileModel fileModelSecondFile = FileModel.builder().filename("secondFile").build(); RedactionLog redactionLogSecondFile = objectMapper.readValue(new ClassPathResource("files/excelReportRedactionLog.json").getInputStream(), RedactionLog.class); List reportEntriesSecondFile = redactionLogConverterService.convertAndSort(redactionLogSecondFile, legalBasisMapping, new HashMap<>(), - dossier.getDossierId()); + dossier); ClassPathResource templateResource = new ClassPathResource("templates/Seeds-NewJustificationForm.docx"); XWPFDocument doc = new XWPFDocument(templateResource.getInputStream()); @@ -358,7 +358,7 @@ public class RedactionReportIntegrationTest { RedactionLog redactionLog = objectMapper.readValue(new ClassPathResource("files/redactionLog.json").getInputStream(), RedactionLog.class); List legalBasisMapping = objectMapper.readValue(new ClassPathResource("files/legalBasisMapping.json").getInputStream(), new TypeReference<>() { }); - List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, new HashMap<>(), dossier.getDossierId()); + List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, new HashMap<>(), dossier); var wordTemplateResource = new ClassPathResource("templates/6464 appendix_b EFSA dRAR justification.docx"); var imageResource = new ClassPathResource("files/exampleImage.jpg"); @@ -396,7 +396,7 @@ public class RedactionReportIntegrationTest { List legalBasisMapping = objectMapper.readValue(new ClassPathResource("files/legalBasisMapping.json").getInputStream(), new TypeReference<>() { }); Map mapOfEntityDisplayName = createEntityDisplayNames(redactionLog); - List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, mapOfEntityDisplayName, dossier.getDossierId()); + List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, mapOfEntityDisplayName, dossier); ClassPathResource templateResource = new ClassPathResource("templates/Excel Report.xlsx"); @@ -425,7 +425,7 @@ public class RedactionReportIntegrationTest { List legalBasisMapping = objectMapper.readValue(new ClassPathResource("files/legalBasisMapping.json").getInputStream(), new TypeReference<>() { }); Map mapOfEntityDisplayName = createEntityDisplayNames(redactionLog); - List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, mapOfEntityDisplayName, dossier.getDossierId()); + List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, mapOfEntityDisplayName, dossier); FileModel fileModel = FileModel.builder().filename("filename").build(); @@ -443,7 +443,7 @@ public class RedactionReportIntegrationTest { List reportEntriesSecondFile = redactionLogConverterService.convertAndSort(redactionLogSecondFile, legalBasisMapping, mapOfEntityDisplayName, - dossier.getDossierId()); + dossier); FileModel fileModelSecondFile = FileModel.builder().filename("secondFile").build(); excelTemplateReportGenerationService.generateExcelReport(reportEntriesSecondFile, placeholders, @@ -470,7 +470,7 @@ public class RedactionReportIntegrationTest { List legalBasisMapping = objectMapper.readValue(new ClassPathResource("files/legalBasisMapping.json").getInputStream(), new TypeReference<>() { }); Map mapOfEntityDisplayName = createEntityDisplayNames(redactionLog); - List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, mapOfEntityDisplayName, dossier.getDossierId()); + List reportEntries = redactionLogConverterService.convertAndSort(redactionLog, legalBasisMapping, mapOfEntityDisplayName, dossier); var imageResource = new ClassPathResource("files/exampleImage.jpg"); FileModel fileModel = FileModel.builder().filename("filename").build();