Search in sources :

Example 31 with DataColumnSpecFilterConfiguration

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);
    }
}
Also used : DatabaseConnectionSettings(org.knime.core.node.port.database.DatabaseConnectionSettings) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration)

Example 32 with DataColumnSpecFilterConfiguration

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);
    }
}
Also used : DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration) InvalidSettingsException(org.knime.core.node.InvalidSettingsException)

Example 33 with DataColumnSpecFilterConfiguration

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);
}
Also used : DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration) DatabaseConnectionSettings(org.knime.core.node.port.database.DatabaseConnectionSettings)

Example 34 with DataColumnSpecFilterConfiguration

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);
    }
}
Also used : DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration) InvalidSettingsException(org.knime.core.node.InvalidSettingsException)

Example 35 with DataColumnSpecFilterConfiguration

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);
}
Also used : DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration) DatabaseConnectionSettings(org.knime.core.node.port.database.DatabaseConnectionSettings)

Aggregations

DataColumnSpecFilterConfiguration (org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration)75 DataTableSpec (org.knime.core.data.DataTableSpec)15 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)14 NotConfigurableException (org.knime.core.node.NotConfigurableException)9 ChangeEvent (javax.swing.event.ChangeEvent)4 ChangeListener (javax.swing.event.ChangeListener)4 DataColumnSpec (org.knime.core.data.DataColumnSpec)4 SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)4 DatabaseConnectionSettings (org.knime.core.node.port.database.DatabaseConnectionSettings)4 EnforceOption (org.knime.core.node.util.filter.NameFilterConfiguration.EnforceOption)4 DatabaseConnectionPortObjectSpec (org.knime.core.node.port.database.DatabaseConnectionPortObjectSpec)2 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1 Solver (org.knime.base.node.mine.regression.logistic.learner4.LogRegLearnerSettings.Solver)1 BinNaming (org.knime.base.node.preproc.autobinner3.AutoBinnerLearnSettings.BinNaming)1 EqualityMethod (org.knime.base.node.preproc.autobinner3.AutoBinnerLearnSettings.EqualityMethod)1 Method (org.knime.base.node.preproc.autobinner3.AutoBinnerLearnSettings.Method)1 DoubleValue (org.knime.core.data.DoubleValue)1 IntValue (org.knime.core.data.IntValue)1