use of org.jkiss.dbeaver.model.virtual.DBVTransformSettings in project dbeaver by serge-rider.
the class TransformerSettingsDialog method loadTransformerSettings.
private void loadTransformerSettings(Collection<? extends DBPPropertyDescriptor> properties) {
DBVTransformSettings settings = currentAttribute == null ? null : DBVUtils.getTransformSettings(currentAttribute, false);
Map<String, Object> transformOptions = settings == null ? null : settings.getTransformOptions();
if (transformOptions == null) {
transformOptions = Collections.emptyMap();
}
propertySource = new PropertySourceCustom(properties, transformOptions);
propertiesEditor.loadProperties(propertySource);
}
use of org.jkiss.dbeaver.model.virtual.DBVTransformSettings in project dbeaver by serge-rider.
the class TransformerSettingsDialog method saveTransformerSettings.
private void saveTransformerSettings() {
if (currentAttribute == null) {
// Nothign to save - just ignore
return;
}
DBVEntityAttribute vAttr = vEntity.getVirtualAttribute(currentAttribute, true);
if (vAttr == null) {
log.error("Can't get attribute settings for " + currentAttribute.getName());
return;
}
DBVTransformSettings settings = DBVUtils.getTransformSettings(vAttr, true);
if (settings == null) {
log.error("Can't get transform settings for " + currentAttribute.getName());
return;
}
if (selector) {
settings.setCustomTransformer(transformer == null ? null : transformer.getId());
}
if (transformer == null) {
settings.setTransformOptions(new LinkedHashMap<>());
} else {
final Map<String, Object> properties = propertySource.getPropertiesWithDefaults();
for (Map.Entry<String, Object> prop : properties.entrySet()) {
if (prop.getValue() != null) {
settings.setTransformOption(prop.getKey().toString(), prop.getValue().toString());
}
}
}
}
use of org.jkiss.dbeaver.model.virtual.DBVTransformSettings in project dbeaver by dbeaver.
the class TransformerSettingsDialog method detectTransformers.
private void detectTransformers() {
final DBPDataSource dataSource = viewer.getDataSource();
DBVEntityAttribute vAttr = vEntity.getVirtualAttribute(currentAttribute, false);
DBVTransformSettings settings = vAttr == null ? null : DBVUtils.getTransformSettings(vAttr, false);
if (dataSource != null && settings != null && !CommonUtils.isEmpty(settings.getCustomTransformer())) {
transformer = dataSource.getContainer().getPlatform().getValueHandlerRegistry().getTransformer(settings.getCustomTransformer());
} else {
transformer = null;
}
transformerList = DBWorkbench.getPlatform().getValueHandlerRegistry().findTransformers(currentAttribute.getDataSource(), currentAttribute, null);
}
Aggregations