RED-4601: Sonar issues: gateway, redaction-report

This commit is contained in:
aoezyetimoglu 2022-07-11 14:49:24 +02:00
parent 16ee415426
commit c87fa028e5
14 changed files with 63 additions and 92 deletions

View File

@ -1,12 +1,12 @@
package buildjob; package buildjob;
import java.time.DayOfWeek;
import java.time.LocalTime;
import static com.atlassian.bamboo.specs.builders.task.TestParserTask.createJUnitParserTask; import static com.atlassian.bamboo.specs.builders.task.TestParserTask.createJUnitParserTask;
import java.time.LocalTime;
import com.atlassian.bamboo.specs.api.BambooSpec; import com.atlassian.bamboo.specs.api.BambooSpec;
import com.atlassian.bamboo.specs.api.builders.BambooKey; import com.atlassian.bamboo.specs.api.builders.BambooKey;
import com.atlassian.bamboo.specs.api.builders.Variable;
import com.atlassian.bamboo.specs.api.builders.docker.DockerConfiguration; import com.atlassian.bamboo.specs.api.builders.docker.DockerConfiguration;
import com.atlassian.bamboo.specs.api.builders.permission.PermissionType; import com.atlassian.bamboo.specs.api.builders.permission.PermissionType;
import com.atlassian.bamboo.specs.api.builders.permission.Permissions; import com.atlassian.bamboo.specs.api.builders.permission.Permissions;
@ -18,19 +18,16 @@ import com.atlassian.bamboo.specs.api.builders.plan.Stage;
import com.atlassian.bamboo.specs.api.builders.plan.branches.BranchCleanup; import com.atlassian.bamboo.specs.api.builders.plan.branches.BranchCleanup;
import com.atlassian.bamboo.specs.api.builders.plan.branches.PlanBranchManagement; import com.atlassian.bamboo.specs.api.builders.plan.branches.PlanBranchManagement;
import com.atlassian.bamboo.specs.api.builders.project.Project; import com.atlassian.bamboo.specs.api.builders.project.Project;
import com.atlassian.bamboo.specs.api.builders.Variable;
import com.atlassian.bamboo.specs.builders.task.CheckoutItem; import com.atlassian.bamboo.specs.builders.task.CheckoutItem;
import com.atlassian.bamboo.specs.builders.task.InjectVariablesTask; import com.atlassian.bamboo.specs.builders.task.InjectVariablesTask;
import com.atlassian.bamboo.specs.builders.task.ScriptTask; import com.atlassian.bamboo.specs.builders.task.ScriptTask;
import com.atlassian.bamboo.specs.builders.task.VcsCheckoutTask; import com.atlassian.bamboo.specs.builders.task.VcsCheckoutTask;
import com.atlassian.bamboo.specs.builders.task.VcsTagTask; import com.atlassian.bamboo.specs.builders.task.VcsTagTask;
import com.atlassian.bamboo.specs.builders.trigger.BitbucketServerTrigger; import com.atlassian.bamboo.specs.builders.trigger.BitbucketServerTrigger;
import com.atlassian.bamboo.specs.builders.trigger.RepositoryPollingTrigger;
import com.atlassian.bamboo.specs.builders.trigger.ScheduledTrigger; import com.atlassian.bamboo.specs.builders.trigger.ScheduledTrigger;
import com.atlassian.bamboo.specs.model.task.InjectVariablesScope; import com.atlassian.bamboo.specs.model.task.InjectVariablesScope;
import com.atlassian.bamboo.specs.util.BambooServer;
import com.atlassian.bamboo.specs.builders.task.ScriptTask;
import com.atlassian.bamboo.specs.model.task.ScriptTaskProperties.Location; import com.atlassian.bamboo.specs.model.task.ScriptTaskProperties.Location;
import com.atlassian.bamboo.specs.util.BambooServer;
/** /**
* Plan configuration for Bamboo. * Plan configuration for Bamboo.

View File

@ -1,4 +1,3 @@
#!/bin/bash #!/bin/bash
set -e set -e

View File

@ -5,9 +5,6 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.List;
@Data @Data
@Builder @Builder
@AllArgsConstructor @AllArgsConstructor

View File

@ -80,8 +80,8 @@ public class ExcelReportGenerationService {
if (!excelModel.isRowsBeforeRedactionEntryRowsAdded()) { if (!excelModel.isRowsBeforeRedactionEntryRowsAdded()) {
for (Map.Entry<Integer, Integer> colummWidthEntry : excelModel.getCellWidths().entrySet()) { for (Map.Entry<Integer, Integer> columnWidthEntry : excelModel.getCellWidths().entrySet()) {
sheet.setColumnWidth(colummWidthEntry.getKey(), colummWidthEntry.getValue()); sheet.setColumnWidth(columnWidthEntry.getKey(), columnWidthEntry.getValue());
} }
addRows(workbook, sheet, excelModel.getCellsToCopyBeforeRedactionPlaceholderRow(), 0, placeholderModel, dossierName, fileModel.getFilename()); addRows(workbook, sheet, excelModel.getCellsToCopyBeforeRedactionPlaceholderRow(), 0, placeholderModel, dossierName, fileModel.getFilename());

View File

@ -11,7 +11,6 @@ import static com.iqser.red.service.redaction.report.v1.server.service.Placehold
import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.SEEDS_FUNCTION_REDACTION_GROUPED_BY_JUSTIFICATION_PAGES_PLACEHOLDER; import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.SEEDS_FUNCTION_REDACTION_GROUPED_BY_JUSTIFICATION_PAGES_PLACEHOLDER;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64; import java.util.Base64;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -64,8 +63,7 @@ public class GeneratePlaceholderService {
imagePlaceholders.add(new ImagePlaceholder(attributeConfig.getPlaceholder(), Base64.getDecoder() imagePlaceholders.add(new ImagePlaceholder(attributeConfig.getPlaceholder(), Base64.getDecoder()
.decode(dossierAttribute.getValue().split(",")[1]))); .decode(dossierAttribute.getValue().split(",")[1])));
} else { } else {
imagePlaceholders.add(new ImagePlaceholder(attributeConfig.getPlaceholder(), Base64.getDecoder() imagePlaceholders.add(new ImagePlaceholder(attributeConfig.getPlaceholder(), Base64.getDecoder().decode(dossierAttribute.getValue())));
.decode(dossierAttribute.getValue())));
} }
} }
} else { } else {
@ -93,12 +91,7 @@ public class GeneratePlaceholderService {
Map<String, String> fileAttributeValueByPlaceholder = new HashMap<>(); Map<String, String> fileAttributeValueByPlaceholder = new HashMap<>();
for (Map.Entry<String, String> idEntry : placeholderModel.getFileAttributeIdByPlaceholder().entrySet()) { for (Map.Entry<String, String> idEntry : placeholderModel.getFileAttributeIdByPlaceholder().entrySet()) {
if (fileModel.getFileAttributes().containsKey(idEntry.getValue())) { fileAttributeValueByPlaceholder.put(idEntry.getKey(), fileModel.getFileAttributes().getOrDefault(idEntry.getValue(), ""));
fileAttributeValueByPlaceholder.put(idEntry.getKey(), fileModel.getFileAttributes()
.get(idEntry.getValue()));
} else {
fileAttributeValueByPlaceholder.put(idEntry.getKey(), "");
}
} }
placeholderModel.setFileAttributeValueByPlaceholder(fileAttributeValueByPlaceholder); placeholderModel.setFileAttributeValueByPlaceholder(fileAttributeValueByPlaceholder);
} }
@ -106,9 +99,7 @@ public class GeneratePlaceholderService {
public Set<String> getDefaultPlaceholders() { public Set<String> getDefaultPlaceholders() {
Set<String> defPlaceholders = new HashSet<>(); return new HashSet<>(Set.of(FILE_NAME_PLACEHOLDER, FORMAT_DATE_ISO_PLACEHOLDER, FORMAT_DATE_GER_PLACEHOLDER, FORMAT_DATE_ENG_PLACEHOLDER, FORMAT_TIME_ISO_PLACEHOLDER, DOSSIER_NAME_PLACEHOLDER, IUCLID_FUNCTION_PLACEHOLDER, SEEDS_FUNCTION_REDACTION_GROUPED_BY_JUSTIFICATION_PAGES_PLACEHOLDER, SEEDS_FUNCTION_JUSTIFICATION_PLACEHOLDER));
defPlaceholders.addAll(Set.of(FILE_NAME_PLACEHOLDER, FORMAT_DATE_ISO_PLACEHOLDER, FORMAT_DATE_GER_PLACEHOLDER, FORMAT_DATE_ENG_PLACEHOLDER, FORMAT_TIME_ISO_PLACEHOLDER, DOSSIER_NAME_PLACEHOLDER, IUCLID_FUNCTION_PLACEHOLDER, SEEDS_FUNCTION_REDACTION_GROUPED_BY_JUSTIFICATION_PAGES_PLACEHOLDER, SEEDS_FUNCTION_JUSTIFICATION_PLACEHOLDER));
return defPlaceholders;
} }
@ -117,9 +108,7 @@ public class GeneratePlaceholderService {
Map<String, String> fileAttributePlaceholders = new HashMap<>(); Map<String, String> fileAttributePlaceholders = new HashMap<>();
var fileAttributesConfig = fileAttributesClient.getFileAttributeConfigs(dossierTemplateId); var fileAttributesConfig = fileAttributesClient.getFileAttributeConfigs(dossierTemplateId);
fileAttributesConfig.forEach(fileAttributeConfig -> { fileAttributesConfig.forEach(fileAttributeConfig -> fileAttributePlaceholders.put(fileAttributeConfig.getPlaceholder(), fileAttributeConfig.getId()));
fileAttributePlaceholders.put(fileAttributeConfig.getPlaceholder(), fileAttributeConfig.getId());
});
return fileAttributePlaceholders; return fileAttributePlaceholders;
} }

View File

@ -20,10 +20,8 @@ public class IuclidFunctionService {
public String computeIuclidFunction(List<ReportRedactionEntry> reportRedactionEntries, String filename) { public String computeIuclidFunction(List<ReportRedactionEntry> reportRedactionEntries, String filename) {
Map<String, List<ReportRedactionEntry>> entriesPerJustification = new HashMap<>(); Map<String, List<ReportRedactionEntry>> entriesPerJustification = new HashMap<>();
reportRedactionEntries.forEach(reportRedactionEntry -> { reportRedactionEntries.forEach(reportRedactionEntry -> entriesPerJustification.computeIfAbsent(reportRedactionEntry.getJustification(), (x) -> new ArrayList<>())
entriesPerJustification.computeIfAbsent(reportRedactionEntry.getJustification(), (x) -> new ArrayList<>()) .add(reportRedactionEntry));
.add(reportRedactionEntry);
});
StringBuilder s = new StringBuilder(); StringBuilder s = new StringBuilder();
s.append(removeExtension(filename)); s.append(removeExtension(filename));

View File

@ -201,13 +201,9 @@ public class PlaceholderService {
Set<String> allPlaceholders = new HashSet<>(getGeneralPlaceholders()); Set<String> allPlaceholders = new HashSet<>(getGeneralPlaceholders());
dossierAttributesConfigClient.getDossierAttributes(dossierTemplateId).forEach(dossierAttributeConfig -> { dossierAttributesConfigClient.getDossierAttributes(dossierTemplateId).forEach(dossierAttributeConfig -> allPlaceholders.add(dossierAttributeConfig.getPlaceholder()));
allPlaceholders.add(dossierAttributeConfig.getPlaceholder());
});
fileAttributesClient.getFileAttributeConfigs(dossierTemplateId).forEach(fileAttributeConfig -> { fileAttributesClient.getFileAttributeConfigs(dossierTemplateId).forEach(fileAttributeConfig -> allPlaceholders.add(fileAttributeConfig.getPlaceholder()));
allPlaceholders.add(fileAttributeConfig.getPlaceholder());
});
return allPlaceholders; return allPlaceholders;
} }

View File

@ -108,12 +108,12 @@ public class RedactionLogConverterService {
str = str.replaceAll("_+?", " "); str = str.replaceAll("_+?", " ");
str = str.replaceAll(" +", " "); str = str.replaceAll(" +", " ");
StringBuilder strbf = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
Matcher match = Pattern.compile("([a-z])([a-z]*)", Pattern.CASE_INSENSITIVE).matcher(str); Matcher match = Pattern.compile("([a-z])([a-z]*)", Pattern.CASE_INSENSITIVE).matcher(str);
while (match.find()) { while (match.find()) {
match.appendReplacement(strbf, match.group(1).toUpperCase() + match.group(2)); match.appendReplacement(stringBuilder, match.group(1).toUpperCase() + match.group(2));
} }
return match.appendTail(strbf).toString(); return match.appendTail(stringBuilder).toString();
} }

View File

@ -40,6 +40,7 @@ import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@SuppressWarnings("ALL")
@Slf4j @Slf4j
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@ -153,9 +154,7 @@ public class ReportGenerationService {
storedFileInformation.add(new StoredFileInformation(null, storageId, ReportType.WORD_TEMPLATE_MULTI_FILE, multiFileDocument.getTemplateId())); storedFileInformation.add(new StoredFileInformation(null, storageId, ReportType.WORD_TEMPLATE_MULTI_FILE, multiFileDocument.getTemplateId()));
} }
String reportFileInformationStorageId = reportStorageService.storeReportInformation(reportMessage.getDownloadId(), storedFileInformation); return reportStorageService.storeReportInformation(reportMessage.getDownloadId(), storedFileInformation);
return reportFileInformationStorageId;
} }
@ -201,7 +200,7 @@ public class ReportGenerationService {
} }
RedactionLog redactionLog; RedactionLog redactionLog;
Map<String, String> mapOfEntityDisplayName = new HashMap<>(); Map<String, String> mapOfEntityDisplayName;
try { try {
redactionLog = redactionLogClient.getRedactionLog(dossierId, fileId, new ArrayList<>(), true, false); redactionLog = redactionLogClient.getRedactionLog(dossierId, fileId, new ArrayList<>(), true, false);
mapOfEntityDisplayName = fillMapOfTypeAndEntityDisplayName(dossierId); mapOfEntityDisplayName = fillMapOfTypeAndEntityDisplayName(dossierId);

View File

@ -1,21 +1,20 @@
package com.iqser.red.service.redaction.report.v1.server.service; package com.iqser.red.service.redaction.report.v1.server.service;
import com.fasterxml.jackson.core.JsonProcessingException; import static com.iqser.red.service.redaction.report.v1.server.configuration.MessagingConfiguration.REPORT_QUEUE;
import com.fasterxml.jackson.databind.ObjectMapper; import static com.iqser.red.service.redaction.report.v1.server.configuration.MessagingConfiguration.REPORT_RESULT_QUEUE;
import com.iqser.red.service.redaction.report.v1.api.model.ReportRequestMessage;
import com.iqser.red.service.redaction.report.v1.api.model.ReportResultMessage;
import com.iqser.red.service.redaction.report.v1.api.model.StoredFileInformation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler; import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.iqser.red.service.redaction.report.v1.api.model.ReportRequestMessage;
import com.iqser.red.service.redaction.report.v1.api.model.ReportResultMessage;
import static com.iqser.red.service.redaction.report.v1.server.configuration.MessagingConfiguration.REPORT_QUEUE; import lombok.RequiredArgsConstructor;
import static com.iqser.red.service.redaction.report.v1.server.configuration.MessagingConfiguration.REPORT_RESULT_QUEUE; import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
@Service @Service
@ -44,8 +43,7 @@ public class ReportMessageReceiver {
} }
private void addToReportResultQueue(String userId, String downloadId, private void addToReportResultQueue(String userId, String downloadId, String reportFileInformationStorageId, int priority) {
String reportFileInformationStorageId, int priority) {
try { try {
rabbitTemplate.convertAndSend(REPORT_RESULT_QUEUE, objectMapper.writeValueAsString(new ReportResultMessage(userId, downloadId, reportFileInformationStorageId)), message -> { rabbitTemplate.convertAndSend(REPORT_RESULT_QUEUE, objectMapper.writeValueAsString(new ReportResultMessage(userId, downloadId, reportFileInformationStorageId)), message -> {

View File

@ -1,22 +1,28 @@
package com.iqser.red.service.redaction.report.v1.server.service; package com.iqser.red.service.redaction.report.v1.server.service;
import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.FORMAT_DATE_ISO;
import java.io.ByteArrayOutputStream;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFFont;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Service;
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.Dossier; import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.Dossier;
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.file.FileAttributeConfig; import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.file.FileAttributeConfig;
import com.iqser.red.service.redaction.report.v1.server.client.FileAttributesConfigClient; import com.iqser.red.service.redaction.report.v1.server.client.FileAttributesConfigClient;
import com.iqser.red.service.redaction.report.v1.server.client.FileStatusClient; import com.iqser.red.service.redaction.report.v1.server.client.FileStatusClient;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.stereotype.Service;
import java.io.ByteArrayOutputStream;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.FORMAT_DATE_ISO;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@ -28,7 +34,6 @@ public class StatusReportGenerationService {
public byte[] generateReport(Dossier dossier) { public byte[] generateReport(Dossier dossier) {
var fileStatuses = fileStatusClient.getDossierStatus(dossier.getId()); var fileStatuses = fileStatusClient.getDossierStatus(dossier.getId());
List<FileAttributeConfig> fileAttributeConfigs = fileAttributesClient.getFileAttributeConfigs(dossier.getDossierTemplateId()); List<FileAttributeConfig> fileAttributeConfigs = fileAttributesClient.getFileAttributeConfigs(dossier.getDossierTemplateId());
@ -64,7 +69,6 @@ public class StatusReportGenerationService {
int pages = fileStatus.getNumberOfPages(); int pages = fileStatus.getNumberOfPages();
var fileAttributes = fileStatus.getFileAttributes(); var fileAttributes = fileStatus.getFileAttributes();
XSSFRow row = sheet.createRow(i + 1); XSSFRow row = sheet.createRow(i + 1);
XSSFCell cellName = row.createCell(0); XSSFCell cellName = row.createCell(0);
@ -84,9 +88,7 @@ public class StatusReportGenerationService {
sheet.autoSizeColumn(3); sheet.autoSizeColumn(3);
sheet.autoSizeColumn(4); sheet.autoSizeColumn(4);
Iterator<Map.Entry<String, String>> iterator = fileAttributes.entrySet().iterator(); for (Map.Entry<String, String> nextElement : fileAttributes.entrySet()) {
while (iterator.hasNext()) {
var nextElement = iterator.next();
if (attributesAssignment.get(nextElement.getKey()) != null) { if (attributesAssignment.get(nextElement.getKey()) != null) {
XSSFCell cell = row.createCell(attributesAssignment.get(nextElement.getKey())); XSSFCell cell = row.createCell(attributesAssignment.get(nextElement.getKey()));
cell.setCellValue(nextElement.getValue()); cell.setCellValue(nextElement.getValue());

View File

@ -79,8 +79,8 @@ public class WordReportGenerationService {
@Timed("redactmanager_generateWordReport") @Timed("redactmanager_generateWordReport")
public XWPFDocument generateWordReport(List<ReportRedactionEntry> reportEntries, PlaceholderModel placeholderModel, String reportTemplateName, XWPFDocument doc, public void generateWordReport(List<ReportRedactionEntry> reportEntries, PlaceholderModel placeholderModel, String reportTemplateName, XWPFDocument doc, FileModel fileModel,
FileModel fileModel, Dossier dossier, boolean isLastFile) { Dossier dossier, boolean isLastFile) {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
@ -104,7 +104,6 @@ public class WordReportGenerationService {
log.info("Report Generation took: {} for file with id {}, pageCount: {}, redactionLogEntryCount: {}, reportName: {}, className: {}", System.currentTimeMillis() - start, fileModel.getId(), fileModel.getNumberOfPages(), reportEntries.size(), reportTemplateName, getClass().getSimpleName()); log.info("Report Generation took: {} for file with id {}, pageCount: {}, redactionLogEntryCount: {}, reportName: {}, className: {}", System.currentTimeMillis() - start, fileModel.getId(), fileModel.getNumberOfPages(), reportEntries.size(), reportTemplateName, getClass().getSimpleName());
return doc;
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage() + " in file: " + fileModel.getFilename()); log.error(e.getMessage() + " in file: " + fileModel.getFilename());
throw new RuntimeException(e); throw new RuntimeException(e);
@ -419,7 +418,7 @@ public class WordReportGenerationService {
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
SortedSet<Integer> numbers = new TreeSet<Integer>(pages); SortedSet<Integer> numbers = new TreeSet<>(pages);
Integer start = null; Integer start = null;
Integer end = null; Integer end = null;
@ -440,7 +439,7 @@ public class WordReportGenerationService {
if (start.equals(end)) { if (start.equals(end)) {
result.append(start).append(","); result.append(start).append(",");
} }
//range lenth 2 and more //range length 2 and more
else { else {
result.append(start).append("-").append(end).append(","); result.append(start).append("-").append(end).append(",");
} }
@ -449,7 +448,7 @@ public class WordReportGenerationService {
end = num; end = num;
} }
} }
if (start.equals(end)) { if (start != null && start.equals(end)) {
result.append(start); result.append(start);
} else { } else {
result.append(start).append("-").append(end); result.append(start).append("-").append(end);
@ -458,10 +457,10 @@ public class WordReportGenerationService {
} }
private Dimension2DDouble getImageDimension(ByteArrayInputStream bais) throws IOException { private Dimension2DDouble getImageDimension(ByteArrayInputStream byteArrayInputStream) throws IOException {
BufferedImage bufImg = ImageIO.read(bais); BufferedImage bufImg = ImageIO.read(byteArrayInputStream);
bais.reset(); byteArrayInputStream.reset();
double width = bufImg.getWidth(); double width = bufImg.getWidth();
double height = bufImg.getHeight(); double height = bufImg.getHeight();

View File

@ -388,7 +388,7 @@ public class RedactionReportIntegrationTest {
private PlaceholderModel buildPlaceHolderModel(Map<String, String> dossierAttributes, Map<String, String> fileAttributes, List<ImagePlaceholder> imagePlaceholders) { private PlaceholderModel buildPlaceHolderModel(Map<String, String> dossierAttributes, Map<String, String> fileAttributes, List<ImagePlaceholder> imagePlaceholders) {
var defaultPlaceHolder = new HashSet(Set.of(FILE_NAME_PLACEHOLDER, FORMAT_DATE_ISO_PLACEHOLDER, FORMAT_DATE_GER_PLACEHOLDER, FORMAT_DATE_ENG_PLACEHOLDER, FORMAT_TIME_ISO_PLACEHOLDER, DOSSIER_NAME_PLACEHOLDER, IUCLID_FUNCTION_PLACEHOLDER, SEEDS_FUNCTION_REDACTION_GROUPED_BY_JUSTIFICATION_PAGES_PLACEHOLDER, SEEDS_FUNCTION_JUSTIFICATION_PLACEHOLDER)); var defaultPlaceHolder = new HashSet<>(Set.of(FILE_NAME_PLACEHOLDER, FORMAT_DATE_ISO_PLACEHOLDER, FORMAT_DATE_GER_PLACEHOLDER, FORMAT_DATE_ENG_PLACEHOLDER, FORMAT_TIME_ISO_PLACEHOLDER, DOSSIER_NAME_PLACEHOLDER, IUCLID_FUNCTION_PLACEHOLDER, SEEDS_FUNCTION_REDACTION_GROUPED_BY_JUSTIFICATION_PAGES_PLACEHOLDER, SEEDS_FUNCTION_JUSTIFICATION_PLACEHOLDER));
defaultPlaceHolder.addAll(dossierAttributes.keySet()); defaultPlaceHolder.addAll(dossierAttributes.keySet());
defaultPlaceHolder.addAll(fileAttributes.keySet()); defaultPlaceHolder.addAll(fileAttributes.keySet());
return new PlaceholderModel(defaultPlaceHolder, imagePlaceholders, dossierAttributes, null, fileAttributes); return new PlaceholderModel(defaultPlaceHolder, imagePlaceholders, dossierAttributes, null, fileAttributes);

View File

@ -23,8 +23,6 @@ import com.iqser.red.service.redaction.report.v1.server.client.DossierClient;
import com.iqser.red.service.redaction.report.v1.server.client.FileAttributesConfigClient; import com.iqser.red.service.redaction.report.v1.server.client.FileAttributesConfigClient;
import com.iqser.red.service.redaction.report.v1.server.client.FileStatusClient; import com.iqser.red.service.redaction.report.v1.server.client.FileStatusClient;
import io.undertow.util.BadRequestException;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
public class StatusReportGenerationServiceTest { public class StatusReportGenerationServiceTest {
@ -42,7 +40,7 @@ public class StatusReportGenerationServiceTest {
@Test @Test
public void testGenerateReport() throws IOException, BadRequestException { public void testGenerateReport() throws IOException {
String dossierId = "dossierId"; String dossierId = "dossierId";
@ -59,7 +57,6 @@ public class StatusReportGenerationServiceTest {
.fileAttributes(Map.of("a", "A", "config2", "B2")) .fileAttributes(Map.of("a", "A", "config2", "B2"))
.build(); .build();
FileModel fileStatus2 = FileModel.builder() FileModel fileStatus2 = FileModel.builder()
.dossierId(dossierId) .dossierId(dossierId)
.filename("file2desJahrtausendsGibtsJaNicht") .filename("file2desJahrtausendsGibtsJaNicht")