Pull request #24: filename is no longer stored in redactionlog

Merge in RED/redaction-report-service from api-updates to master

* commit '920277c20ba536ba45b8a442e1cf2d438dd499c5':
  filename is no longer stored in redactionlog
This commit is contained in:
Timo Bejan 2021-04-26 15:58:31 +02:00
commit f492fb6e47
2 changed files with 14 additions and 17 deletions

View File

@ -12,7 +12,6 @@ import lombok.NoArgsConstructor;
public class StoredFileInformation { public class StoredFileInformation {
private String fileId; private String fileId;
private String originalFilename;
private String storageId; private String storageId;
private ReportType reportType; private ReportType reportType;

View File

@ -1,13 +1,5 @@
package com.iqser.red.service.redaction.report.v1.server.service; package com.iqser.red.service.redaction.report.v1.server.service;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Service;
import com.iqser.red.service.configuration.v1.api.model.LegalBasisMapping; import com.iqser.red.service.configuration.v1.api.model.LegalBasisMapping;
import com.iqser.red.service.redaction.report.v1.api.model.ReportRequestMessage; import com.iqser.red.service.redaction.report.v1.api.model.ReportRequestMessage;
import com.iqser.red.service.redaction.report.v1.api.model.ReportType; import com.iqser.red.service.redaction.report.v1.api.model.ReportType;
@ -16,9 +8,15 @@ import com.iqser.red.service.redaction.report.v1.server.client.LegalBasisMapping
import com.iqser.red.service.redaction.report.v1.server.model.ReportRedactionEntry; import com.iqser.red.service.redaction.report.v1.server.model.ReportRedactionEntry;
import com.iqser.red.service.redaction.report.v1.server.storage.ReportStorageService; import com.iqser.red.service.redaction.report.v1.server.storage.ReportStorageService;
import com.iqser.red.service.redaction.v1.model.RedactionLog; import com.iqser.red.service.redaction.v1.model.RedactionLog;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
@Slf4j @Slf4j
@Service @Service
@ -64,21 +62,21 @@ public class ReportGenerationService {
if (reportMessage.getReportTypes().contains(ReportType.EXCEL_SINGLE_FILE)) { if (reportMessage.getReportTypes().contains(ReportType.EXCEL_SINGLE_FILE)) {
byte[] excelSingleReport = excelReportService.generateSingleFileReport(reportEntries, redactionLog.getFilename()); byte[] excelSingleReport = excelReportService.generateSingleFileReport(reportEntries, redactionLog.getFilename());
String storageId = reportStorageService.storeObject(reportMessage.getDownloadId(), excelSingleReport); String storageId = reportStorageService.storeObject(reportMessage.getDownloadId(), excelSingleReport);
storedFileInformation.add(new StoredFileInformation(fileId, redactionLog.getFilename(), storageId, ReportType.EXCEL_SINGLE_FILE)); storedFileInformation.add(new StoredFileInformation(fileId, storageId, ReportType.EXCEL_SINGLE_FILE));
} }
if (reportMessage.getReportTypes().contains(ReportType.WORD_SINGLE_FILE_APPENDIX_A1_TEMPLATE)) { if (reportMessage.getReportTypes().contains(ReportType.WORD_SINGLE_FILE_APPENDIX_A1_TEMPLATE)) {
byte[] wordEFSATemplate = wordReportGenerationService.generateReport(ReportType.WORD_SINGLE_FILE_APPENDIX_A1_TEMPLATE, reportEntries, redactionLog byte[] wordEFSATemplate = wordReportGenerationService.generateReport(ReportType.WORD_SINGLE_FILE_APPENDIX_A1_TEMPLATE, reportEntries, redactionLog
.getFilename()); .getFilename());
String storageId = reportStorageService.storeObject(reportMessage.getDownloadId(), wordEFSATemplate); String storageId = reportStorageService.storeObject(reportMessage.getDownloadId(), wordEFSATemplate);
storedFileInformation.add(new StoredFileInformation(fileId, redactionLog.getFilename(), storageId, ReportType.WORD_SINGLE_FILE_APPENDIX_A1_TEMPLATE)); storedFileInformation.add(new StoredFileInformation(fileId, storageId, ReportType.WORD_SINGLE_FILE_APPENDIX_A1_TEMPLATE));
} }
if (reportMessage.getReportTypes().contains(ReportType.WORD_SINGLE_FILE_APPENDIX_A2_TEMPLATE)) { if (reportMessage.getReportTypes().contains(ReportType.WORD_SINGLE_FILE_APPENDIX_A2_TEMPLATE)) {
byte[] wordSyngentaTemplate = wordReportGenerationService.generateReport(ReportType.WORD_SINGLE_FILE_APPENDIX_A2_TEMPLATE, reportEntries, redactionLog byte[] wordSyngentaTemplate = wordReportGenerationService.generateReport(ReportType.WORD_SINGLE_FILE_APPENDIX_A2_TEMPLATE, reportEntries, redactionLog
.getFilename()); .getFilename());
String storageId = reportStorageService.storeObject(reportMessage.getDownloadId(), wordSyngentaTemplate); String storageId = reportStorageService.storeObject(reportMessage.getDownloadId(), wordSyngentaTemplate);
storedFileInformation.add(new StoredFileInformation(fileId, redactionLog.getFilename(), storageId, ReportType.WORD_SINGLE_FILE_APPENDIX_A2_TEMPLATE)); storedFileInformation.add(new StoredFileInformation(fileId, storageId, ReportType.WORD_SINGLE_FILE_APPENDIX_A2_TEMPLATE));
} }
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
@ -87,11 +85,11 @@ public class ReportGenerationService {
i++; i++;
} }
if (reportMessage.getReportTypes().contains(ReportType.EXCEL_MULTI_FILE)) { if (excelMultiFileWorkbook != null) {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
byte[] multifileExcelReport = excelReportService.toByteArray(excelMultiFileWorkbook); byte[] multifileExcelReport = excelReportService.toByteArray(excelMultiFileWorkbook);
String storageId = reportStorageService.storeObject(reportMessage.getDownloadId(), multifileExcelReport); String storageId = reportStorageService.storeObject(reportMessage.getDownloadId(), multifileExcelReport);
storedFileInformation.add(new StoredFileInformation(null, null, storageId, ReportType.EXCEL_MULTI_FILE)); storedFileInformation.add(new StoredFileInformation(null, storageId, ReportType.EXCEL_MULTI_FILE));
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
log.info("Successfully stored multiFileExcelReport for downloadId {}, took {}", reportMessage.getDownloadId(), end - start); log.info("Successfully stored multiFileExcelReport for downloadId {}, took {}", reportMessage.getDownloadId(), end - start);
} }