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:
commit
f492fb6e47
@ -12,7 +12,6 @@ import lombok.NoArgsConstructor;
|
||||
public class StoredFileInformation {
|
||||
|
||||
private String fileId;
|
||||
private String originalFilename;
|
||||
private String storageId;
|
||||
private ReportType reportType;
|
||||
|
||||
|
||||
@ -1,13 +1,5 @@
|
||||
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.redaction.report.v1.api.model.ReportRequestMessage;
|
||||
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.storage.ReportStorageService;
|
||||
import com.iqser.red.service.redaction.v1.model.RedactionLog;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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
|
||||
@Service
|
||||
@ -51,7 +49,7 @@ public class ReportGenerationService {
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
RedactionLog redactionLog = reportStorageService.getRedactionLog(reportMessage.getProjectId(), fileId);
|
||||
if(legalBasisMappings == null){
|
||||
if (legalBasisMappings == null) {
|
||||
legalBasisMappings = legalBasisMappingClient.getLegalBasisMapping(redactionLog.getRuleSetId());
|
||||
}
|
||||
|
||||
@ -64,21 +62,21 @@ public class ReportGenerationService {
|
||||
if (reportMessage.getReportTypes().contains(ReportType.EXCEL_SINGLE_FILE)) {
|
||||
byte[] excelSingleReport = excelReportService.generateSingleFileReport(reportEntries, redactionLog.getFilename());
|
||||
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)) {
|
||||
byte[] wordEFSATemplate = wordReportGenerationService.generateReport(ReportType.WORD_SINGLE_FILE_APPENDIX_A1_TEMPLATE, reportEntries, redactionLog
|
||||
.getFilename());
|
||||
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)) {
|
||||
byte[] wordSyngentaTemplate = wordReportGenerationService.generateReport(ReportType.WORD_SINGLE_FILE_APPENDIX_A2_TEMPLATE, reportEntries, redactionLog
|
||||
.getFilename());
|
||||
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();
|
||||
@ -87,11 +85,11 @@ public class ReportGenerationService {
|
||||
i++;
|
||||
}
|
||||
|
||||
if (reportMessage.getReportTypes().contains(ReportType.EXCEL_MULTI_FILE)) {
|
||||
if (excelMultiFileWorkbook != null) {
|
||||
long start = System.currentTimeMillis();
|
||||
byte[] multifileExcelReport = excelReportService.toByteArray(excelMultiFileWorkbook);
|
||||
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();
|
||||
log.info("Successfully stored multiFileExcelReport for downloadId {}, took {}", reportMessage.getDownloadId(), end - start);
|
||||
}
|
||||
@ -99,4 +97,4 @@ public class ReportGenerationService {
|
||||
return storedFileInformation;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user