Merge branch 'DM-578-fix-missing-oecd' into 'master'

DM-578 - Fix missing OECD number from reports

Closes DM-578

See merge request redactmanager/redaction-report-service!35
This commit is contained in:
Andrei Isvoran 2023-11-22 15:02:41 +01:00
commit 4e4b668b78

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;