use of org.knime.core.node.config.ConfigWO in project knime-core by knime.
the class VirtualParallelizedChunkPortObjectInNodeFactory method savePortTypeList.
/**
* @param portTypes
* @param config
*/
static void savePortTypeList(final PortType[] portTypes, final ConfigWO config) {
for (int i = 0; i < portTypes.length; i++) {
ConfigWO portSetting = config.addConfig("port_" + i);
portSetting.addInt("index", i);
ConfigWO portTypeConfig = portSetting.addConfig("type");
portTypes[i].save(portTypeConfig);
}
}
use of org.knime.core.node.config.ConfigWO in project knime-core by knime.
the class PieSectionDataModel method saveElements.
/**
* {@inheritDoc}
*/
@Override
protected void saveElements(final Collection<PieSubSectionDataModel> elements, final ConfigWO config, final ExecutionMonitor exec) throws CanceledExecutionException {
config.addInt(CFG_ELEMENT_COUNT, elements.size());
int idx = 0;
for (final PieSubSectionDataModel element : elements) {
final ConfigWO elementConfig = config.addConfig(CFG_SECTION_ELEMENT + idx++);
element.save2File(elementConfig, exec);
}
}
use of org.knime.core.node.config.ConfigWO in project knime-core by knime.
the class DataTableSpec method save.
/**
* Saves the table spec name and all {@link DataColumnSpec}s to the given
* {@link ConfigWO} object.
*
* @param config the config object to save this table specs to
*/
public void save(final ConfigWO config) {
config.addString(CFG_SPEC_NAME, m_name);
config.addInt(CFG_NR_COLUMNS, m_columnSpecs.length);
for (int i = 0; i < m_columnSpecs.length; i++) {
ConfigWO column = config.addConfig(CFG_COLUMN_SPEC + i);
m_columnSpecs[i].save(column);
}
if (!m_properties.isEmpty()) {
Config propertiesConfig = config.addConfig(CFG_PROPERTIES);
int i = 0;
for (Map.Entry<String, String> entry : m_properties.entrySet()) {
Config entryConfig = propertiesConfig.addConfig("prop-" + (i++));
entryConfig.addString(CFG_PROPERTY_KEY, entry.getKey());
entryConfig.addString(CFG_PROPERTY_VALUE, entry.getValue());
}
}
}
use of org.knime.core.node.config.ConfigWO in project knime-core by knime.
the class DataType method save.
/**
* Saves this <code>DataType</code> to the given
* {@link org.knime.core.node.config.ConfigWO}.
* If it is a native type only the class name of the cell class is stored.
* Otherwise the names of all value classes and whether it has a preferred
* value is written to the {@link org.knime.core.node.config.ConfigWO}.
*
* @param config write to this {@link org.knime.core.node.config.ConfigWO}
*/
public void save(final ConfigWO config) {
if (m_collectionElementType != null) {
ConfigWO sub = config.addConfig(CFG_COLL_ELEMENT_TYPE);
m_collectionElementType.save(sub);
}
if (m_cellClass == null) {
config.addString(CFG_CELL_NAME, null);
// only for backwards compatibility
config.addBoolean(CFG_HAS_PREF_VALUE, true);
String[] valueClasses = convertClassesToNames(m_valueClasses);
config.addStringArray(CFG_VALUE_CLASSES, valueClasses);
} else {
// only memorize cell class (is hashed anyway)
config.addString(CFG_CELL_NAME, m_cellClass.getName());
}
if (!m_adapterValueList.isEmpty()) {
String[] adapterClasses = convertClassesToNames(m_adapterValueList);
config.addStringArray(CFG_ADAPTER_CLASSES, adapterClasses);
}
}
use of org.knime.core.node.config.ConfigWO in project knime-core by knime.
the class BarDataModel method saveElements.
/**
* {@inheritDoc}
*/
@Override
protected void saveElements(final Collection<BarElementDataModel> elements, final ConfigWO config, final ExecutionMonitor exec) throws CanceledExecutionException {
config.addInt(CFG_ELEMENT_COUNT, elements.size());
int idx = 0;
for (final BarElementDataModel element : elements) {
final ConfigWO elementConfig = config.addConfig(CFG_BAR_ELEMENT + idx++);
element.save2File(elementConfig, exec);
}
}
Aggregations