use of org.dbflute.helper.dataset.DfDataTable in project dbflute-core by dbflute.
the class DfLReverseOutputHandler method setupXlsDataTable.
// ===================================================================================
// Xls Data
// ========
protected void setupXlsDataTable(DfDataSet dataSet, Table table, List<Map<String, String>> extractedList, int sheetNumber, List<String> sectionInfoList) {
final List<Map<String, String>> recordList;
{
final String tableInfo = " " + table.getTableDispName() + " (" + extractedList.size() + ")";
_log.info(tableInfo);
sectionInfoList.add(tableInfo);
if (extractedList.size() > _xlsLimit) {
// just in case
recordList = extractedList.subList(0, _xlsLimit);
} else {
recordList = extractedList;
}
}
final DfDataTable dataTable = new DfDataTable(resolveSheetName(table, sheetNumber));
final List<Column> columnList = table.getColumnList();
for (Column column : columnList) {
if (isExceptCommonColumn(column)) {
continue;
}
dataTable.addColumn(column.getName(), DfDtsColumnTypes.STRING);
}
for (Map<String, String> recordMap : recordList) {
final Set<String> columnNameSet = recordMap.keySet();
final DfDataRow dataRow = dataTable.addRow();
for (String columnName : columnNameSet) {
if (!dataTable.hasColumn(columnName)) {
// basically excepted common columns
continue;
}
final String value = recordMap.get(columnName);
dataRow.addValue(columnName, value);
}
}
dataSet.addTable(dataTable);
}
use of org.dbflute.helper.dataset.DfDataTable in project dbflute-core by dbflute.
the class DfXlsDataHandlerImpl method doWriteDataSet.
// -----------------------------------------------------
// DataSet
// -------
protected void doWriteDataSet(DfXlsDataResource resource, File file, DfDataSet dataSet, StringBuilder msgSb) {
msgSb.append(ln()).append(ln()).append("[").append(file.getName()).append("]");
for (int i = 0; i < dataSet.getTableSize(); i++) {
final DfDataTable dataTable = dataSet.getTable(i);
final int loadedCount = doWriteDataTable(resource, file, dataTable);
msgSb.append(ln()).append(" ").append(dataTable.getTableDbName()).append(" (").append(loadedCount).append(")");
}
}
use of org.dbflute.helper.dataset.DfDataTable 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.DfDataTable in project dbflute-core by dbflute.
the class DfXlsDataHandlingWriter 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.DfDataTable in project dbflute-core by dbflute.
the class DfXlsDataHandlingWriter method doWriteDataSet.
// -----------------------------------------------------
// DataSet
// -------
protected void doWriteDataSet(DfXlsDataResource resource, File file, DfDataSet dataSet, StringBuilder msgSb) {
msgSb.append(ln()).append(ln()).append("[").append(file.getName()).append("]");
for (int i = 0; i < dataSet.getTableSize(); i++) {
final DfDataTable dataTable = dataSet.getTable(i);
final int loadedCount = doWriteDataTable(resource, file, dataTable);
msgSb.append(ln()).append(" ").append(dataTable.getTableDbName()).append(" (").append(loadedCount).append(")");
}
}
Aggregations