Skip to content

Commit

Permalink
MARP-1315 re update databaseFieldLenght
Browse files Browse the repository at this point in the history
  • Loading branch information
tvtphuc-axonivy committed Nov 6, 2024
1 parent a97ecbf commit 2c13e02
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
Expand Down Expand Up @@ -91,10 +92,13 @@ private static void updateColumn(Column column, Cell cell) {
}
if (cell.getCellType() == CellType.STRING) {
column.setType(String.class);
if (ObjectUtils.isEmpty(column.getDatabaseFieldLength())) {
column.setDatabaseFieldLength(DEFAULT_STRING_LENGTH);
}
}
if (column.getType().equals(String.class)) {
var cellValue = getCellValueAsString(cell);
if (cellValue.length() > column.getDatabaseFieldLength()) {
if (cellValue.length() > column.getDatabaseFieldLength()) {
column.setDatabaseFieldLength(cellValue.length());
}
}
Expand Down

0 comments on commit 2c13e02

Please sign in to comment.