use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class FileWorkflowPersistor method saveInPort.
protected static void saveInPort(final NodeSettingsWO settings, final WorkflowManager wm, final int portIndex) {
WorkflowInPort inport = wm.getInPort(portIndex);
settings.addInt("index", portIndex);
settings.addString("name", inport.getPortName());
NodeSettingsWO portTypeSettings = settings.addNodeSettings("type");
inport.getPortType().save(portTypeSettings);
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class ObsoleteMetaNodeFileWorkflowPersistor method loadInPortsSetting.
/**
* {@inheritDoc}
*/
@Override
protected NodeSettingsRO loadInPortsSetting(final NodeSettingsRO settings) throws InvalidSettingsException {
NodeSettings template = new NodeSettings("inports");
for (int i = 0; i < m_dataInNodeIDs.length; i++) {
NodeSettingsWO sub = template.addNodeSettings("data_" + i);
sub.addInt("index", i);
sub.addInt("node", m_dataInNodeIDs[i]);
sub.addString("type", "data");
}
return template;
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class DBWriterDialogPane method saveSettingsTo.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
m_loginPane.saveSettingsTo(settings, getCredentialsProvider());
settings.addString(DBWriterNodeModel.KEY_TABLE_NAME, m_table.getText().trim());
settings.addBoolean(DBWriterNodeModel.KEY_APPEND_DATA, m_append.isSelected());
settings.addBoolean(DBWriterNodeModel.KEY_INSERT_NULL_FOR_MISSING_COLS, m_insertNullForMissing.isSelected());
// introduced in KNIME 3.3.1 legacy behavior is not failing e.g. false
settings.addBoolean(DBWriterNodeModel.KEY_FAIL_ON_ERROR, m_failOnError.isSelected());
// save SQL Types for each column
NodeSettingsWO typeSett = settings.addNodeSettings(DBWriterNodeModel.CFG_SQL_TYPES);
m_typePanel.saveSettingsTo(typeSett);
// 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(DBWriterNodeModel.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.NodeSettingsWO in project knime-core by knime.
the class DBWriterNodeModel method saveSettingsTo.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) {
m_conn.saveConnection(settings);
settings.addString(KEY_TABLE_NAME, m_tableName);
settings.addBoolean(KEY_APPEND_DATA, m_append);
settings.addBoolean(KEY_INSERT_NULL_FOR_MISSING_COLS, m_insertNullForMissingCols);
settings.addBoolean(KEY_FAIL_ON_ERROR, m_failOnError);
// save SQL Types mapping
NodeSettingsWO typeSett = settings.addNodeSettings(CFG_SQL_TYPES);
for (Map.Entry<String, String> e : m_types.entrySet()) {
typeSett.addString(e.getKey(), e.getValue());
}
// save batch size
settings.addInt(KEY_BATCH_SIZE, m_batchSize);
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class DBColumnAggregationFunctionRow method saveFunctions.
/**
* @param settings {@link NodeSettingsWO}
* @param key the config key
* @param rows the {@link DBColumnAggregationFunctionRow}s to save
*/
public static void saveFunctions(final NodeSettingsWO settings, final String key, final List<DBColumnAggregationFunctionRow> 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 DBColumnAggregationFunctionRow row = rows.get(i);
DataColumnSpec spec = row.getColumnSpec();
cfg.addString(CNFG_COL_NAMES, spec.getName());
cfg.addDataType(CNFG_COL_TYPES, spec.getType());
AbstractDBAggregationFunctionRow.saveFunction(cfg, row.getFunction());
}
}
Aggregations