use of org.dbflute.helper.dataset.DfDataColumn in project dbflute-core by dbflute.
the class DfTableXlsReaderTest method test_read_rtrim.
public void test_read_rtrim() throws IOException {
// ## Arrange ##
final File xlsFile = prepareTestBasicXlsFile();
final DfTableXlsReader reader = createTableXlsReader(xlsFile, null, true);
// ## Act ##
final DfDataSet dataSet = reader.read();
// ## Assert ##
log("[DataSet]:" + ln() + dataSet);
final int tableSize = dataSet.getTableSize();
assertTrue(tableSize > 0);
for (int tableIndex = 0; tableIndex < tableSize; tableIndex++) {
final DfDataTable table = dataSet.getTable(tableIndex);
final int columnSize = table.getColumnSize();
assertTrue(columnSize > 0);
final int rowSize = table.getRowSize();
assertTrue(rowSize > 0);
for (int rowIndex = 0; rowIndex < rowSize; rowIndex++) {
final DfDataRow row = table.getRow(rowIndex);
for (int columnIndex = 0; columnIndex < columnSize; columnIndex++) {
final DfDataColumn column = table.getColumn(columnIndex);
final String columnDbName = column.getColumnDbName();
final Object value = row.getValue(columnDbName);
if (columnDbName.equals("AAA")) {
assertNotNull(value);
} else if (columnDbName.equals("BBB")) {
markHere("nullBBB");
} else if (columnDbName.equals("CCC")) {
assertNotNull(value);
} else if (columnDbName.equals("DDD")) {
assertNotNull(value);
String str = (String) value;
if (str.length() > str.trim().length()) {
fail();
}
} else if (columnDbName.equals("EEE")) {
assertNotNull(value);
String str = (String) value;
if (str.length() > str.trim().length()) {
// because of not trimmed column
markHere("trimmed_EEE");
}
}
}
}
}
assertMarked("nullBBB");
assertMarked("trimmed_EEE");
}
use of org.dbflute.helper.dataset.DfDataColumn in project dbflute-core by dbflute.
the class DfXlsDataHandlingWriter method extractColumnNameList.
protected List<String> extractColumnNameList(DfDataTable dataTable) {
// for small function
final List<String> columnNameList = new ArrayList<String>();
for (int i = 0; i < dataTable.getColumnSize(); i++) {
final DfDataColumn dataColumn = dataTable.getColumn(i);
if (!dataColumn.isWritable()) {
continue;
}
final String columnName = dataColumn.getColumnDbName();
columnNameList.add(columnName);
}
return columnNameList;
}
Aggregations