use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class DBColumnRenameNodeModel 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);
}
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class DataTypeAggregator method saveAggregators.
/**
* @param settings the settings object to write to
* @param key the unique settings key
* @param aggregators the {@link DataTypeAggregator} objects to save
*/
public static void saveAggregators(final NodeSettingsWO settings, final String key, final Collection<DataTypeAggregator> aggregators) {
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 (aggregators == null) {
throw new NullPointerException("cols must not be null");
}
final NodeSettingsWO root = settings.addNodeSettings(key);
int idx = 0;
for (DataTypeAggregator aggr : aggregators) {
final NodeSettingsWO cfg = root.addNodeSettings("f_" + idx++);
cfg.addDataType(CNFG_DATA_TYPE, aggr.getDataType());
cfg.addBoolean(CNFG_INCL_MISSING_VALS, aggr.inclMissingCells());
AggregationMethodDecorator.saveMethod(cfg, aggr.getMethodTemplate());
}
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class SettingsModelAggregationMethod method saveSettingsForModel.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsForModel(final NodeSettingsWO settings) {
final NodeSettingsWO subSettings = settings.addNodeSettings(m_configName);
subSettings.addString(CFG_METHOD_ID, m_method.getId());
subSettings.addBoolean(CFG_INCL_MISSING, m_method.inclMissingCells());
subSettings.addString(CFG_VALUE_SEPARATOR, m_valueDelimiter);
subSettings.addInt(CFG_MAX_UNIQUE_VALUES, m_maxUniqueValues);
if (m_method.hasOptionalSettings()) {
final NodeSettingsWO methodSettings = subSettings.addNodeSettings(CFG_METHOD_SETTINGS);
m_method.saveSettingsTo(methodSettings);
}
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class HiLiteCollectorNodeModel method saveInternals.
/**
* {@inheritDoc}
*/
@Override
protected void saveInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
NodeSettings sett = new NodeSettings(KEY_ANNOTATIONS);
RowKey[] cells = m_annotationMap.keySet().toArray(new RowKey[m_annotationMap.size()]);
sett.addRowKeyArray("row_keys", cells);
for (RowKey cell : cells) {
NodeSettingsWO subSett = sett.addNodeSettings(cell.toString());
for (Map.Entry<Integer, String> e : m_annotationMap.get(cell).entrySet()) {
subSett.addString(e.getKey().toString(), e.getValue());
}
}
File f = new File(nodeInternDir, KEY_ANNOTATIONS);
sett.saveToXML(new FileOutputStream(f));
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class TokenizerSettings method saveToConfiguration.
/**
* Saves all settings into a <code>NodeSettings</code> object. Using the cfg
* object to construct a new FileTokenizerSettings object should lead to an
* object identical to this.
*
* @param cfg the config object the settings are stored into.
*/
public void saveToConfiguration(final NodeSettingsWO cfg) {
if (cfg == null) {
throw new NullPointerException("Can't save 'file " + "tokenizer settings' to null config!");
}
// save delimiters first
NodeSettingsWO subCfg = cfg.addNodeSettings(CFGKEY_DELIMS);
saveDelimitersToConfiguration(subCfg);
// save quotes next
subCfg = cfg.addNodeSettings(CFGKEY_QUOTES);
saveQuotesToConfiguration(subCfg);
// also, save comments
subCfg = cfg.addNodeSettings(CFGKEY_COMMENTS);
saveCommentsToConfiguration(subCfg);
// do the whitespaces
subCfg = cfg.addNodeSettings(CFGKEY_WHITES);
saveWhitesToConfiguration(subCfg);
// add the linecontinuatino character if defined
String lineCont = getLineContinuationCharacter();
if (lineCont != null) {
assert lineCont.length() == 1;
cfg.addChar(CFGKEY_LINECONT, lineCont.charAt(0));
}
// add the flag for combining multiple delimiters
cfg.addBoolean(CFGKEY_COMBMULTI, getCombineMultipleDelimiters());
cfg.addLong(CFGKEY_SKIPLINES, m_skipFirstLines);
cfg.addBoolean(CFGKEY_LFINQUOTES, m_allowLFinQuotes);
}
Aggregations