use of org.knime.core.node.NodeSettingsRO in project knime-core by knime.
the class NamedAggregationOperator method validateSettings.
/**
* Validates the operator specific settings of all {@link NamedAggregationOperator}s
* that require additional settings.
*
* @param settings the settings to validate
* @param operators the operators to validate
* @throws InvalidSettingsException if the settings of an operator are not valid
* @since 2.7
*/
public static void validateSettings(final NodeSettingsRO settings, final List<NamedAggregationOperator> operators) throws InvalidSettingsException {
for (NamedAggregationOperator operator : operators) {
if (operator.hasOptionalSettings()) {
try {
final NodeSettingsRO operatorSettings = settings.getNodeSettings(createSettingsKey(operator));
operator.validateSettings(operatorSettings);
} catch (InvalidSettingsException e) {
throw new InvalidSettingsException("Invalid operator settings for result column '" + operator.getName() + "', reason: " + e.getMessage());
}
}
}
}
use of org.knime.core.node.NodeSettingsRO in project knime-core by knime.
the class JoinedTable method load.
/**
* Method being called when the workflow is restored and the table shall
* recreated.
* @param s The settings object, contains tables ids.
* @param spec The final spec.
* @param tblRep The table repository
* @return The restored table.
* @throws InvalidSettingsException If the settings can't be read.
*/
public static JoinedTable load(final NodeSettingsRO s, final DataTableSpec spec, final Map<Integer, BufferedDataTable> tblRep) throws InvalidSettingsException {
NodeSettingsRO subSettings = s.getNodeSettings(CFG_INTERNAL_META);
int leftID = subSettings.getInt(CFG_LEFT_TABLE_ID);
int rightID = subSettings.getInt(CFG_RIGHT_TABLE_ID);
BufferedDataTable leftTable = BufferedDataTable.getDataTable(tblRep, leftID);
BufferedDataTable rightTable = BufferedDataTable.getDataTable(tblRep, rightID);
return new JoinedTable(leftTable, rightTable, spec);
}
use of org.knime.core.node.NodeSettingsRO in project knime-core by knime.
the class RandomForestClassificationLearnerNodeModel method loadInternals.
/**
* {@inheritDoc}
*/
@Override
protected void loadInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
File file = new File(nodeInternDir, INTERNAL_TREES_FILE);
if (file.exists()) {
getLogger().info("Node was executed with KNIME version <2.10 - keep using old model type, re-execute node to update");
// workflow is older than 2.10
InputStream in = new GZIPInputStream(new FileInputStream(file));
m_oldStyleEnsembleModel_deprecated = TreeEnsembleModel.load(in, exec);
in.close();
}
file = new File(nodeInternDir, INTERNAL_DATASAMPLE_FILE);
if (file.exists()) {
m_hiliteRowSample = DataContainer.readFromZip(file);
}
file = new File(nodeInternDir, INTERNAL_INFO_FILE);
if (file.exists()) {
NodeSettingsRO sets = NodeSettings.loadFromXML(new FileInputStream(file));
m_viewMessage = sets.getString("view_warning", null);
}
}
use of org.knime.core.node.NodeSettingsRO in project knime-core by knime.
the class TreeEnsembleClassificationLearnerNodeModel method loadInternals.
/**
* {@inheritDoc}
*/
@Override
protected void loadInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
File file = new File(nodeInternDir, INTERNAL_TREES_FILE);
if (file.exists()) {
getLogger().info("Node was executed with KNIME version <2.10 - keep using old model type, re-execute node to update");
// workflow is older than 2.10
InputStream in = new GZIPInputStream(new FileInputStream(file));
m_oldStyleEnsembleModel_deprecated = TreeEnsembleModel.load(in, exec);
in.close();
}
file = new File(nodeInternDir, INTERNAL_DATASAMPLE_FILE);
if (file.exists()) {
m_hiliteRowSample = DataContainer.readFromZip(file);
}
file = new File(nodeInternDir, INTERNAL_INFO_FILE);
if (file.exists()) {
NodeSettingsRO sets = NodeSettings.loadFromXML(new FileInputStream(file));
m_viewMessage = sets.getString("view_warning", null);
}
}
use of org.knime.core.node.NodeSettingsRO 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()]);
}
Aggregations