Search in sources :

Example 1 with DfColumnBindTypeProvider

use of org.dbflute.logic.replaceschema.loaddata.base.secretary.DfColumnBindTypeProvider in project dbflute-core by dbflute.

the class DfDelimiterDataWriterImpl method createSqlBuilder.

protected DfDelimiterDataWriteSqlBuilder createSqlBuilder(DfDelimiterDataResultInfo resultInfo, String tableDbName, final Map<String, DfColumnMeta> columnMetaMap, List<String> columnNameList, List<String> valueList) {
    final DfDelimiterDataWriteSqlBuilder sqlBuilder = new DfDelimiterDataWriteSqlBuilder();
    sqlBuilder.setTableDbName(tableDbName);
    sqlBuilder.setColumnMetaMap(columnMetaMap);
    sqlBuilder.setColumnNameList(columnNameList);
    sqlBuilder.setValueList(valueList);
    sqlBuilder.setNotFoundColumnMap(resultInfo.getNotFoundColumnMap());
    sqlBuilder.setConvertValueMap(_convertValueMap);
    sqlBuilder.setDefaultValueMap(_defaultValueMap);
    sqlBuilder.setBindTypeProvider(new DfColumnBindTypeProvider() {

        public Class<?> provide(String tableName, DfColumnMeta columnMeta) {
            return getBindType(tableName, columnMeta);
        }
    });
    sqlBuilder.setDefaultValueProp(_defaultValueProp);
    return sqlBuilder;
}
Also used : DfColumnMeta(org.dbflute.logic.jdbc.metadata.info.DfColumnMeta) DfColumnBindTypeProvider(org.dbflute.logic.replaceschema.loaddata.base.secretary.DfColumnBindTypeProvider)

Example 2 with DfColumnBindTypeProvider

use of org.dbflute.logic.replaceschema.loaddata.base.secretary.DfColumnBindTypeProvider in project dbflute-core by dbflute.

the class DfXlsDataHandlingWriter method convertColumnValueIfNeeds.

// ===================================================================================
// Column Value Filter
// ===================
protected void convertColumnValueIfNeeds(String dataDirectory, String tableName, Map<String, Object> columnValueMap, Map<String, DfColumnMeta> columnMetaMap) {
    // handling both convertValueMap and defaultValueMap
    final Map<String, Map<String, String>> convertValueMap = getConvertValueMap(dataDirectory);
    final Map<String, String> defaultValueMap = getDefaultValueMap(dataDirectory);
    // so it does not need to convert here
    if (// no convert
    (convertValueMap == null || convertValueMap.isEmpty()) && (defaultValueMap == null || defaultValueMap.isEmpty())) {
        // and no default
        return;
    }
    final DfColumnBindTypeProvider bindTypeProvider = new DfColumnBindTypeProvider() {

        public Class<?> provide(String tableName, DfColumnMeta columnMeta) {
            return getBindType(tableName, columnMeta);
        }
    };
    final DfColumnValueConverter converter = new DfColumnValueConverter(convertValueMap, defaultValueMap, bindTypeProvider);
    converter.convert(tableName, columnValueMap, columnMetaMap);
}
Also used : DfColumnValueConverter(org.dbflute.logic.replaceschema.loaddata.base.secretary.DfColumnValueConverter) DfColumnMeta(org.dbflute.logic.jdbc.metadata.info.DfColumnMeta) DfColumnBindTypeProvider(org.dbflute.logic.replaceschema.loaddata.base.secretary.DfColumnBindTypeProvider) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Aggregations

DfColumnMeta (org.dbflute.logic.jdbc.metadata.info.DfColumnMeta)2 DfColumnBindTypeProvider (org.dbflute.logic.replaceschema.loaddata.base.secretary.DfColumnBindTypeProvider)2 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 DfColumnValueConverter (org.dbflute.logic.replaceschema.loaddata.base.secretary.DfColumnValueConverter)1