use of org.dbflute.logic.replaceschema.loaddata.base.secretary.DfColumnValueConverter 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);
}
use of org.dbflute.logic.replaceschema.loaddata.base.secretary.DfColumnValueConverter in project dbflute-core by dbflute.
the class DfDelimiterDataWriteSqlBuilder method convertColumnValueIfNeeds.
protected void convertColumnValueIfNeeds(Map<String, Object> columnValueMap) {
// because it needs to convert empty string to null
// if ((_convertValueMap == null || _convertValueMap.isEmpty()) // no convert
// && (_defaultValueMap == null || _defaultValueMap.isEmpty())) { // and no default
// return;
// }
adjustColumnValueBeforeConvert(columnValueMap);
final DfColumnValueConverter converter = createColumnValueConverter();
// for compatible with e.g. $$empty$$ = $$empty$$
converter.treatEmptyBeforeAsNull();
converter.convert(_tableDbName, columnValueMap, _columnMetaMap);
}
Aggregations