DM-578 - Fix missing OECD number from reports

This commit is contained in:
Andrei Isvoran 2023-11-22 15:22:49 +02:00
parent 5f1c47dfec
commit 10f2faf91c

View File

@ -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;