use of org.dbflute.helper.dataset.DfDataColumn in project dbflute-core by dbflute.
the class DfXlsDataHandlerImpl method throwXlsDataColumnDefFailureException.
protected void throwXlsDataColumnDefFailureException(String dataDirectory, File file, DfDataTable dataTable) {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("The table specified on the xls file does not have (writable) columns.");
br.addItem("Advice");
br.addElement("Please confirm the column names about their spellings.");
br.addElement("And confirm the column definition of the table.");
// suppress duplicated info (show these elements in failure exception later)
// br.addItem("Data Directory");
// br.addElement(dataDirectory);
// br.addItem("Xls File");
// br.addElement(file);
br.addItem("Table");
br.addElement(dataTable.getTableDbName());
br.addItem("Defined Column");
final int columnSize = dataTable.getColumnSize();
if (columnSize > 0) {
for (int i = 0; i < dataTable.getColumnSize(); i++) {
final DfDataColumn dataColumn = dataTable.getColumn(i);
br.addElement(dataColumn.getColumnDbName());
}
} else {
br.addElement("(no column)");
}
final String msg = br.buildExceptionMessage();
throw new DfXlsDataEmptyColumnDefException(msg);
}
use of org.dbflute.helper.dataset.DfDataColumn in project dbflute-core by dbflute.
the class DfXlsDataHandlerImpl 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;
}
use of org.dbflute.helper.dataset.DfDataColumn in project dbflute-core by dbflute.
the class DfXlsDataHandlerImpl method createColumnContainer.
// ===================================================================================
// Column Container
// ================
protected ColumnContainer createColumnContainer(DfDataTable dataTable, DfDataRow dataRow) {
final ColumnContainer container = new ColumnContainer();
for (int i = 0; i < dataTable.getColumnSize(); i++) {
final DfDataColumn dataColumn = dataTable.getColumn(i);
if (!dataColumn.isWritable()) {
continue;
}
final Object columnValue = dataRow.getValue(i);
final String columnName = dataColumn.getColumnDbName();
container.addColumnValue(columnName, columnValue);
container.addColumnObject(columnName, dataColumn);
}
return container;
}
use of org.dbflute.helper.dataset.DfDataColumn in project dbflute-core by dbflute.
the class DfXlsDataHandlerImpl method filterValidColumn.
protected void filterValidColumn(final DfDataSet dataSet) {
for (int i = 0; i < dataSet.getTableSize(); i++) {
final DfDataTable table = dataSet.getTable(i);
final String tableName = table.getTableDbName();
final Map<String, DfColumnMeta> metaMetaMap = getColumnMetaMap(tableName);
for (int j = 0; j < table.getColumnSize(); j++) {
final DfDataColumn dataColumn = table.getColumn(j);
if (!metaMetaMap.containsKey(dataColumn.getColumnDbName())) {
dataColumn.setWritable(false);
}
}
}
}
use of org.dbflute.helper.dataset.DfDataColumn in project dbflute-core by dbflute.
the class DfXlsDataWritingExceptionThrower method throwXlsDataColumnDefFailureException.
// -----------------------------------------------------
// Column Definition
// -----------------
public void throwXlsDataColumnDefFailureException(String dataDirectory, File file, DfDataTable dataTable) {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("The table specified on the xls file does not have (writable) columns.");
br.addItem("Advice");
br.addElement("Please confirm the column names about their spellings.");
br.addElement("And confirm the column definition of the table.");
// suppress duplicated info (show these elements in failure exception later)
// br.addItem("Data Directory");
// br.addElement(dataDirectory);
// br.addItem("Xls File");
// br.addElement(file);
br.addItem("Table");
br.addElement(dataTable.getTableDbName());
br.addItem("Defined Column");
final int columnSize = dataTable.getColumnSize();
if (columnSize > 0) {
for (int i = 0; i < dataTable.getColumnSize(); i++) {
final DfDataColumn dataColumn = dataTable.getColumn(i);
br.addElement(dataColumn.getColumnDbName());
}
} else {
br.addElement("(no column)");
}
final String msg = br.buildExceptionMessage();
throw new DfXlsDataEmptyColumnDefException(msg);
}
Aggregations