use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class DBPatternAggregationFunctionRow method saveFunctions.
/**
* @param settings {@link NodeSettingsWO}
* @param key the config key
* @param rows the {@link DBPatternAggregationFunctionRow}s to save
*/
public static void saveFunctions(final NodeSettingsWO settings, final String key, final List<DBPatternAggregationFunctionRow> 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 DBPatternAggregationFunctionRow row = rows.get(i);
final String inputPattern = row.getInputPattern();
final boolean isRegex = row.isRegex();
cfg.addString(CNFG_INPUT_PATTERN, inputPattern);
cfg.addBoolean(CNFG_IS_REGEX, isRegex);
DBAggregationFunction function = row.getFunction();
AbstractDBAggregationFunctionRow.saveFunction(cfg, function);
}
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class DBTableCreatorConfiguration method saveSettingsForModel.
/**
* Saves settings for NodeModel
*
* @param settings NodeSettingsWO instance to save settings to
*/
public void saveSettingsForModel(final NodeSettingsWO settings) {
m_schemaSettingsModel.saveSettingsTo(settings);
m_tableNameSettingsModel.saveSettingsTo(settings);
m_tempTableSettingsModel.saveSettingsTo(settings);
m_ifNotExistsSettingsModel.saveSettingsTo(settings);
m_useDynamicSettingsModel.saveSettingsTo(settings);
m_additionalOptionsModel.saveSettingsTo(settings);
for (Entry<String, List<RowElement>> entry : m_tableMap.entrySet()) {
final NodeSettingsWO root = settings.addNodeSettings(entry.getKey());
int idx = 0;
for (RowElement elem : entry.getValue()) {
final NodeSettingsWO cfg = root.addNodeSettings(elem.getPrefix() + idx++);
elem.saveSettingsTo(cfg);
}
}
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class KeyElement method saveSettingsTo.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) {
settings.addString(CFG_KEY_NAME, getName());
NodeSettingsWO cfg = settings.addNodeSettings(CFG_KEY_COLUMNS);
int idx = 0;
for (DBColumn col : getColumns()) {
cfg.addString(ColumnElement.DEFAULT_PREFIX + idx++, col.getName());
}
settings.addBoolean(CFG_KEY_PRIMARY, isPrimaryKey());
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class ColProperty method saveToConfiguration.
/**
* Writes all settings from this object into the passed configuration
* object.
*
* @param cfg the configuration object to write the settings into
*/
public void saveToConfiguration(final NodeSettingsWO cfg) {
if (cfg == null) {
throw new NullPointerException("Can't save column property into" + "null config.");
}
cfg.addBoolean(CFGKEY_USERSETTINGS, m_userSettings);
cfg.addString(CFGKEY_MISSVALUE, m_missValuePattern);
cfg.addString(CFGKEY_FORMAT, m_formatParameter);
cfg.addBoolean(CFGKEY_READVALS, m_readPossValsFromFile);
cfg.addBoolean(CFGKEY_SKIP, m_skipColumn);
// add the stuff from the ColumnSpec
cfg.addString(CFGKEY_COLNAME, m_colSpec.getName());
cfg.addDataType(CFGKEY_COLTYPE, m_colSpec.getType());
Set<DataCell> posValues = m_colSpec.getDomain().getValues();
if ((posValues != null) && (posValues.size() > 0)) {
NodeSettingsWO pVCfg = cfg.addNodeSettings(CFGKEY_POSVALUES);
int count = 0;
for (DataCell cell : posValues) {
pVCfg.addDataCell(CFGKEY_POSSVAL + count, cell);
count++;
}
}
if ((m_colSpec.getDomain().getLowerBound() != null) || (m_colSpec.getDomain().getUpperBound() != null)) {
cfg.addDataCell(CFGKEY_LOWERBOUND, m_colSpec.getDomain().getLowerBound());
cfg.addDataCell(CFGKEY_UPPERBOUND, m_colSpec.getDomain().getUpperBound());
}
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class MissingValueHandling2ColSetting method saveIndividualsColSettings.
/**
* Saves the individual settings to a config object.
*
* @param colSettings the settings to write, may include meta settings
* (ignored)
* @param settings to write to
*/
protected static void saveIndividualsColSettings(final MissingValueHandling2ColSetting[] colSettings, final NodeSettingsWO settings) {
NodeSettingsWO individuals = settings.addNodeSettings(CFG_INDIVIDUAL);
for (int i = 0; i < colSettings.length; i++) {
if (colSettings[i].isMetaConfig()) {
continue;
}
String id = colSettings[i].getDisplayName();
NodeSettingsWO subConfig = individuals.addNodeSettings(id);
colSettings[i].saveSettings(subConfig);
}
}
Aggregations