use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class DBDeleteRowsNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
// validate login settings
new DatabaseConnectionSettings(settings, getCredentialsProvider());
// validate table name
final String tableName = settings.getString(KEY_TABLE_NAME);
if (tableName == null || tableName.trim().isEmpty()) {
throw new InvalidSettingsException("Configure node and enter a valid table name.");
}
// validate WHERE columns
final DataColumnSpecFilterConfiguration confWHERE = new DataColumnSpecFilterConfiguration(KEY_WHERE_FILTER_COLUMN);
confWHERE.loadConfigurationInModel(settings);
// validate batch size
final int batchSize = settings.getInt(KEY_BATCH_SIZE);
if (batchSize <= 0) {
throw new InvalidSettingsException("Batch size must be greater than 0, is " + batchSize);
}
}
use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class DBDeleteRowsDialogPane method saveSettingsTo.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
// save login settings
m_loginPanel.saveSettingsTo(settings, getCredentialsProvider());
// save table name
settings.addString(DBDeleteRowsNodeModel.KEY_TABLE_NAME, m_tableName.getText().trim());
// save WHERE columns
DataColumnSpecFilterConfiguration configWHERE = new DataColumnSpecFilterConfiguration(DBDeleteRowsNodeModel.KEY_WHERE_FILTER_COLUMN);
m_columnsInWhereClause.saveConfiguration(configWHERE);
configWHERE.saveConfiguration(settings);
// save batch size
final String strBatchSite = m_batchSize.getText().trim();
if (strBatchSite.isEmpty()) {
throw new InvalidSettingsException("Batch size must not be empty.");
}
try {
final int intBatchSize = Integer.parseInt(strBatchSite);
settings.addInt(DBDeleteRowsNodeModel.KEY_BATCH_SIZE, intBatchSize);
} catch (final NumberFormatException nfe) {
throw new InvalidSettingsException("Can't parse batch size \"" + strBatchSite + "\", reason: " + nfe.getMessage(), nfe);
}
}
use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class DBDeleteRowsNodeModel method loadValidatedSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadValidatedSettingsFrom(final NodeSettingsRO settings) throws InvalidSettingsException {
// load WHERE columns
final DataColumnSpecFilterConfiguration confWHERE = new DataColumnSpecFilterConfiguration(KEY_WHERE_FILTER_COLUMN);
confWHERE.loadConfigurationInModel(settings);
m_configWHERE = confWHERE;
// load login settings
m_loginConfig = new DatabaseConnectionSettings(settings, getCredentialsProvider());
// load table name
m_tableName = settings.getString(KEY_TABLE_NAME).trim();
// load batch size
m_batchSize = settings.getInt(KEY_BATCH_SIZE);
}
use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class DBUpdateDialogPane method saveSettingsTo.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
// save login settings
m_loginPanel.saveSettingsTo(settings, getCredentialsProvider());
// save table name
settings.addString(DBUpdateNodeModel.KEY_TABLE_NAME, m_tableName.getText().trim());
// save SET columns
DataColumnSpecFilterConfiguration configSET = new DataColumnSpecFilterConfiguration(DBUpdateNodeModel.KEY_SET_FILTER_COLUMN);
m_columnsInSetClause.saveConfiguration(configSET);
configSET.saveConfiguration(settings);
// save WHERE columns
DataColumnSpecFilterConfiguration configWHERE = new DataColumnSpecFilterConfiguration(DBUpdateNodeModel.KEY_WHERE_FILTER_COLUMN);
m_columnsInWhereClause.saveConfiguration(configWHERE);
configWHERE.saveConfiguration(settings);
// save batch size
final String strBatchSite = m_batchSize.getText().trim();
if (strBatchSite.isEmpty()) {
throw new InvalidSettingsException("Batch size must not be empty.");
}
try {
final int intBatchSize = Integer.parseInt(strBatchSite);
settings.addInt(DBUpdateNodeModel.KEY_BATCH_SIZE, intBatchSize);
} catch (final NumberFormatException nfe) {
throw new InvalidSettingsException("Can't parse batch size \"" + strBatchSite + "\", reason: " + nfe.getMessage(), nfe);
}
}
use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class DBUpdateNodeModel method loadValidatedSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadValidatedSettingsFrom(final NodeSettingsRO settings) throws InvalidSettingsException {
// load SET columns
final DataColumnSpecFilterConfiguration confSET = new DataColumnSpecFilterConfiguration(KEY_SET_FILTER_COLUMN);
confSET.loadConfigurationInModel(settings);
m_configSET = confSET;
// load WHERE columns
final DataColumnSpecFilterConfiguration confWHERE = new DataColumnSpecFilterConfiguration(KEY_WHERE_FILTER_COLUMN);
confWHERE.loadConfigurationInModel(settings);
m_configWHERE = confWHERE;
// load login settings
m_loginConfig = new DatabaseConnectionSettings(settings, getCredentialsProvider());
// load table name
m_tableName = settings.getString(KEY_TABLE_NAME).trim();
// load batch size
m_batchSize = settings.getInt(KEY_BATCH_SIZE);
}
Aggregations