use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class TreeEnsembleClassificationLearnerNodeModel method saveInternals.
/**
* {@inheritDoc}
*/
@Override
protected void saveInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
File file;
ExecutionMonitor sub;
if (m_oldStyleEnsembleModel_deprecated != null) {
// old workflow (<2.10) loaded and saved ...
file = new File(nodeInternDir, INTERNAL_TREES_FILE);
OutputStream out = new GZIPOutputStream(new FileOutputStream(file));
sub = exec.createSubProgress(0.2);
m_oldStyleEnsembleModel_deprecated.save(out, sub);
out.close();
}
if (m_hiliteRowSample != null) {
file = new File(nodeInternDir, INTERNAL_DATASAMPLE_FILE);
sub = exec.createSubProgress(0.2);
DataContainer.writeToZip(m_hiliteRowSample, file, sub);
}
if (m_viewMessage != null) {
file = new File(nodeInternDir, INTERNAL_INFO_FILE);
NodeSettings sets = new NodeSettings("ensembleData");
sets.addString("view_warning", m_viewMessage);
sets.saveToXML(new FileOutputStream(file));
}
}
use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class SorterNodeModelTest method setUp.
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
m_snm = new SorterNodeModel();
m_settings = new NodeSettings("Sorter");
}
use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class CreateTempDirectoryConfiguration method loadInDialog.
void loadInDialog(final NodeSettingsRO settings) {
m_baseName = settings.getString("baseName", "knime_tc_");
m_variableName = settings.getString("variableName", "temp_path");
m_deleteOnReset = settings.getBoolean("deleteOnReset", true);
NodeSettingsRO pairs;
try {
pairs = settings.getNodeSettings("variable_name_pairs");
} catch (InvalidSettingsException ise) {
pairs = new NodeSettings("empty");
}
Set<String> keySet = pairs.keySet();
List<VarNameFileNamePair> pairList = new ArrayList<VarNameFileNamePair>();
m_pairs = new VarNameFileNamePair[keySet.size()];
for (String key : keySet) {
try {
NodeSettingsRO p = pairs.getNodeSettings(key);
String varName = p.getString("variableName");
String fileName = p.getString("fileName");
if (varName != null && fileName != null) {
pairList.add(new VarNameFileNamePair(varName, fileName));
}
} catch (InvalidSettingsException ise) {
// ignore
}
}
m_pairs = pairList.toArray(new VarNameFileNamePair[pairList.size()]);
}
use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class CrosstabNodeModel method saveInternals.
/**
* {@inheritDoc}
*/
@Override
protected void saveInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException {
if (m_settings.getEnableHiliting()) {
final NodeSettings config = new NodeSettings("hilite_mapping");
final DefaultHiLiteMapper mapper = (DefaultHiLiteMapper) m_hilite.getMapper();
if (mapper != null) {
mapper.save(config);
}
config.saveToXML(new FileOutputStream(new File(nodeInternDir, INTERNALS_FILE_NAME)));
}
}
use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class DataTableSpecCreatorTest method testAllPropertiesAndSaveLoad.
@Test
public void testAllPropertiesAndSaveLoad() throws Exception {
DataColumnSpec[] cols1 = createColumnSpecs(5, "ColName");
DataTableSpecCreator creator = new DataTableSpecCreator();
creator.addColumns(cols1);
String name = "expected name 'ae-";
creator.setName(name);
creator.putProperties(Collections.<String, String>emptyMap());
creator.putProperties(Collections.singletonMap("key1", "value1"));
creator.putProperty("key2", "value2");
DataTableSpec spec = creator.createSpec();
Map<String, String> properties = spec.getProperties();
Assert.assertEquals(properties.get("key1"), "value1");
Assert.assertEquals(properties.get("key2"), "value2");
NodeSettings config = new NodeSettings("dummy");
spec.save(config);
DataTableSpec load = DataTableSpec.load(config);
Map<String, String> loadProperties = load.getProperties();
Assert.assertEquals(loadProperties.get("key1"), "value1");
Assert.assertEquals(loadProperties.get("key2"), "value2");
Assert.assertEquals(spec, load);
}
Aggregations