From 10f2faf91c99c7d973af57685d6c06c1cd9664cf Mon Sep 17 00:00:00 2001 From: Andrei Isvoran Date: Wed, 22 Nov 2023 15:22:49 +0200 Subject: [PATCH] DM-578 - Fix missing OECD number from reports --- .../v1/server/service/ScmReportService.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ScmReportService.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ScmReportService.java index e5f0a03..594c2f0 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ScmReportService.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/ScmReportService.java @@ -32,13 +32,14 @@ import lombok.experimental.FieldDefaults; @Service @RequiredArgsConstructor -@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) +@FieldDefaults(level = AccessLevel.PRIVATE) @SuppressWarnings("checkstyle:all") public class ScmReportService { - ComponentClient componentResource; - FileAttributesConfigClient fileAttributesClient; - DataFormatter formatter = new DataFormatter(); + final ComponentClient componentResource; + final FileAttributesConfigClient fileAttributesClient; + final DataFormatter formatter = new DataFormatter(); + Row row; public void addScmRows(Sheet sheet, FileModel fileModel, ExcelModel excelModel) { @@ -50,6 +51,15 @@ public class ScmReportService { firstRowIndex++; } + // sometimes first row is identified wrong. this makes sure we always identify the correct first row which contains the + // header cells as we need them for file attributes (e.g. OECD Number) + Cell firstCell = firstRow.getCell(0); + if (formatter.formatCellValue(firstCell).equals("File")) { + row = firstRow; + } else { + firstRow = row; + } + int fileColumnIndex = 0; int textColumnIndex = firstRow.getLastCellNum() - 1; int valueIndexColumn = firstRow.getLastCellNum() - 2;