Search in sources :

Example 36 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class RenameNodeModel method saveSettingsTo.

/**
 * {@inheritDoc}
 */
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) {
    if (m_config != null) {
        final NodeSettingsWO subSettings = settings.addNodeSettings(CFG_SUB_CONFIG);
        m_config.save(subSettings);
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 37 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class ColumnAggregatorNodeModel method saveSettingsTo.

/**
 * {@inheritDoc}
 */
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) {
    m_aggregationCols.saveSettingsTo(settings);
    m_removeRetainedCols.saveSettingsTo(settings);
    m_removeAggregationCols.saveSettingsTo(settings);
    m_valueDelimiter.saveSettingsTo(settings);
    m_maxUniqueValues.saveSettingsTo(settings);
    final NodeSettingsWO subSettings = settings.addNodeSettings(CFG_AGGREGATION_METHODS);
    NamedAggregationOperator.saveMethods(subSettings, m_methods);
    m_version.saveSettingsTo(settings);
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 38 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class DBDataTypeAggregationFunctionRow method saveFunctions.

/**
 * @param settings {@link NodeSettingsWO}
 * @param key the config key
 * @param rows the {@link DBDataTypeAggregationFunctionRow}s to save
 */
public static void saveFunctions(final NodeSettingsWO settings, final String key, final List<DBDataTypeAggregationFunctionRow> rows) {
    if (key == null || key.isEmpty()) {
        throw new IllegalArgumentException("key must not be empty");
    }
    if (settings == null) {
        throw new NullPointerException("settings must not be null");
    }
    if (rows == null) {
        return;
    }
    final NodeSettingsWO root = settings.addNodeSettings(key);
    for (int i = 0, length = rows.size(); i < length; i++) {
        final NodeSettingsWO cfg = root.addNodeSettings("f_" + i);
        final DBDataTypeAggregationFunctionRow row = rows.get(i);
        cfg.addDataType(CNFG_DATA_TYPE, row.getDataType());
        AbstractDBAggregationFunctionRow.saveFunction(cfg, row.getFunction());
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 39 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class DBNumericBinnerNodeModel method saveSettingsTo.

/**
 * {@inheritDoc}
 */
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) {
    for (String columnKey : m_columnToBins.keySet()) {
        NodeSettingsWO column = settings.addNodeSettings(columnKey);
        if (m_columnToAppended.get(columnKey) != null) {
            settings.addString(columnKey + IS_APPENDED, m_columnToAppended.get(columnKey));
        } else {
            settings.addString(columnKey + IS_APPENDED, null);
        }
        Bin[] bins = m_columnToBins.get(columnKey);
        for (int b = 0; b < bins.length; b++) {
            NodeSettingsWO bin = column.addNodeSettings(bins[b].getBinName() + "_" + b);
            bins[b].saveToSettings(bin);
        }
    }
    settings.addStringArray(NUMERIC_COLUMNS, m_columnToAppended.keySet().toArray(new String[0]));
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO) Bin(org.knime.base.node.preproc.pmml.binner.BinnerColumnFactory.Bin) NumericBin(org.knime.base.node.preproc.pmml.binner.NumericBin)

Example 40 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class AbstractDBAggregationFunctionRow method saveFunction.

/**
 * @param cfg {@link NodeSettingsWO} to write to
 * @param function the {@link AggregationFunction} to save
 */
public static void saveFunction(final NodeSettingsWO cfg, final AggregationFunction function) {
    cfg.addString(CNFG_AGGR_COL_SECTION, function.getId());
    if (function.hasOptionalSettings()) {
        try {
            final NodeSettingsWO subConfig = cfg.addNodeSettings("functionSettings");
            function.saveSettingsTo(subConfig);
        } catch (Exception e) {
            LOGGER.error("Exception while saving settings for aggreation function '" + function.getId() + "', reason: " + e.getMessage());
        }
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO) InvalidSettingsException(org.knime.core.node.InvalidSettingsException)

Aggregations

NodeSettingsWO (org.knime.core.node.NodeSettingsWO)111 NodeSettings (org.knime.core.node.NodeSettings)16 Map (java.util.Map)11 File (java.io.File)9 FileOutputStream (java.io.FileOutputStream)9 LinkedHashMap (java.util.LinkedHashMap)9 HashMap (java.util.HashMap)8 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)8 RowKey (org.knime.core.data.RowKey)6 DataCell (org.knime.core.data.DataCell)5 BufferedOutputStream (java.io.BufferedOutputStream)4 NodeSettingsRO (org.knime.core.node.NodeSettingsRO)4 HashSet (java.util.HashSet)3 GZIPOutputStream (java.util.zip.GZIPOutputStream)3 DataRow (org.knime.core.data.DataRow)3 ExecutionMonitor (org.knime.core.node.ExecutionMonitor)3 AbstractQuickFormConfiguration (org.knime.core.quickform.AbstractQuickFormConfiguration)3 AbstractQuickFormValueInConfiguration (org.knime.core.quickform.AbstractQuickFormValueInConfiguration)3 QuickFormInputNode (org.knime.core.quickform.in.QuickFormInputNode)3 MutableInteger (org.knime.core.util.MutableInteger)3