use of org.jkiss.dbeaver.tools.transfer.stream.StreamDataImporterColumnInfo in project dbeaver by dbeaver.
the class StreamImporterAbstract method applyTransformHints.
protected void applyTransformHints(StreamTransferResultSet resultSet, IDataTransferConsumer consumer, Map<String, Object> properties, String formatPropName, String zoneIdPropName) throws DBException {
DateTimeFormatter tsFormat = formatPropName == null ? null : getTimeStampFormat(properties, formatPropName);
ZoneId tsZoneId = null;
if (zoneIdPropName != null) {
String zoneId = CommonUtils.toString(properties.get(zoneIdPropName));
if (!CommonUtils.isEmpty(zoneId)) {
tsZoneId = ZoneId.of(zoneId);
}
}
if (tsFormat != null) {
resultSet.setDateTimeFormat(tsFormat, tsZoneId);
}
// Do it only for valid String mappings
if (consumer instanceof DatabaseTransferConsumer) {
for (DatabaseTransferConsumer.ColumnMapping cm : ((DatabaseTransferConsumer) consumer).getColumnMappings()) {
if (cm == null) {
continue;
}
for (StreamDataImporterColumnInfo attributeMapping : resultSet.getAttributeMappings()) {
if (cm.targetAttr.getMappingType().isValid()) {
if (cm.sourceAttr.getDataKind() == DBPDataKind.STRING && cm.sourceAttr.getName().equals(attributeMapping.getName())) {
// Gotcha
DBSEntityAttribute targetAttr = cm.targetAttr.getTarget();
if (targetAttr != null) {
switch(targetAttr.getDataKind()) {
case DATETIME:
case NUMERIC:
case BOOLEAN:
attributeMapping.setDataKind(targetAttr.getDataKind());
break;
}
}
}
}
}
}
Object targetObject = consumer.getTargetObject();
if (targetObject instanceof DBSEntity) {
}
}
}
use of org.jkiss.dbeaver.tools.transfer.stream.StreamDataImporterColumnInfo in project dbeaver by serge-rider.
the class StreamImporterAbstract method applyTransformHints.
protected void applyTransformHints(StreamTransferResultSet resultSet, IDataTransferConsumer consumer, Map<String, Object> properties, String formatPropName, String zoneIdPropName) throws DBException {
DateTimeFormatter tsFormat = formatPropName == null ? null : getTimeStampFormat(properties, formatPropName);
ZoneId tsZoneId = null;
if (zoneIdPropName != null) {
String zoneId = CommonUtils.toString(properties.get(zoneIdPropName));
if (!CommonUtils.isEmpty(zoneId)) {
tsZoneId = ZoneId.of(zoneId);
}
}
if (tsFormat != null) {
resultSet.setDateTimeFormat(tsFormat, tsZoneId);
}
// Do it only for valid String mappings
if (consumer instanceof DatabaseTransferConsumer) {
for (DatabaseTransferConsumer.ColumnMapping cm : ((DatabaseTransferConsumer) consumer).getColumnMappings()) {
if (cm == null) {
continue;
}
for (StreamDataImporterColumnInfo attributeMapping : resultSet.getAttributeMappings()) {
if (cm.targetAttr.getMappingType().isValid()) {
if (cm.sourceAttr.getDataKind() == DBPDataKind.STRING && cm.sourceAttr.getName().equals(attributeMapping.getName())) {
// Gotcha
DBSEntityAttribute targetAttr = cm.targetAttr.getTarget();
if (targetAttr != null) {
switch(targetAttr.getDataKind()) {
case DATETIME:
case NUMERIC:
case BOOLEAN:
attributeMapping.setDataKind(targetAttr.getDataKind());
break;
}
}
}
}
}
}
Object targetObject = consumer.getTargetObject();
if (targetObject instanceof DBSEntity) {
}
}
}
Aggregations