use of org.knime.core.node.InvalidSettingsException in project knime-core by knime.
the class LoopStartWindowConfiguration method loadSettingsInModel.
/**
* Load settings in model, fails if incomplete.
*
* @param settings To load from.
* @throws InvalidSettingsException If invalid.
*/
void loadSettingsInModel(final NodeSettingsRO settings) throws InvalidSettingsException {
try {
setWindowDefinition(WindowDefinition.valueOf(settings.getString(m_windowDefinitionKey)));
} catch (Exception e) {
throw new InvalidSettingsException("Invalid window definition: " + settings.getString(m_windowDefinitionKey));
}
try {
setTrigger(Trigger.valueOf(settings.getString(m_triggerKey)));
} catch (Exception e) {
throw new InvalidSettingsException("Invalid trigger: " + settings.getString(m_triggerKey));
}
setEventStepSize(settings.getInt(m_evenStepSizeKey));
setEventWindowSize(settings.getInt(m_eventWindowSizeKey));
setTimeStepSize(settings.getString(m_timeStepSizeKey));
setTimeWindowSize(settings.getString(m_timeWindowSizeKey));
setTimeStepUnit(Unit.getUnit(settings.getString(m_timeStepUnitKey, null)));
m_timeWindowUnit = Unit.getUnit(settings.getString(m_timeWindowUnitKey, null));
setLimitWindow(settings.getBoolean(m_limitWindowKey, false));
setUseSpecifiedStartTime(settings.getBoolean(m_useSpecifiedStartTimeKey, false));
}
use of org.knime.core.node.InvalidSettingsException in project knime-core by knime.
the class ModifyDateNodeModel method configure.
/**
* {@inheritDoc}
*/
@Override
protected DataTableSpec[] configure(final DataTableSpec[] inSpecs) throws InvalidSettingsException {
if (!m_hasValidatedConfiguration) {
throw new InvalidSettingsException("Node must be configured!");
}
DataTableSpec in = inSpecs[0];
ColumnRearranger r = createColumnRearranger(in);
DataTableSpec out = r.createSpec();
return new DataTableSpec[] { out };
}
use of org.knime.core.node.InvalidSettingsException in project knime-core by knime.
the class DialogComponentDate method updateModel.
/**
* Writes the values immediately into the model.
*
* @throws InvalidSettingsException if the year is not an integer
*/
protected void updateModel() throws InvalidSettingsException {
SettingsModelCalendar model = (SettingsModelCalendar) getModel();
if (!model.useDate()) {
// do not update/validate if date is not used by the model
return;
}
Calendar calendar = model.getCalendar();
// taking the index is perfectly fine, since Calendar
// represents months as zero-based indices
// (but not day of month)
int month = m_monthUI.getSelectedIndex();
int day = m_dayUI.getSelectedIndex() + 1;
// First set month and day -> unlikely that an error occurs
calendar.set(Calendar.MONTH, month);
calendar.set(Calendar.DAY_OF_MONTH, day);
model.setCalendar(calendar);
try {
// check whether the year contains only numbers
int year = Integer.parseInt(m_yearUI.getText());
calendar.set(Calendar.YEAR, year);
model.setCalendar(calendar);
} catch (NumberFormatException nfe) {
throw new InvalidSettingsException("Not a valid year: " + m_yearUI.getText() + "! " + "Please use only integer numbers", nfe);
}
}
use of org.knime.core.node.InvalidSettingsException in project knime-core by knime.
the class SettingsModelCalendar method loadSettingsForDialog.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsForDialog(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
try {
Config internals = settings.getConfig(m_key);
loadFromInternals(internals);
} catch (InvalidSettingsException ise) {
// load current time
m_value = Calendar.getInstance(DateAndTimeCell.UTC_TIMEZONE);
}
}
use of org.knime.core.node.InvalidSettingsException in project knime-core by knime.
the class MovingAggregationNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected BufferedDataTable[] execute(final BufferedDataTable[] inData, final ExecutionContext exec) throws Exception {
if (inData == null || inData.length != 1) {
throw new InvalidSettingsException("No input table available");
}
final BufferedDataTable table = inData[0];
if (table.getRowCount() == 0) {
setWarningMessage("Empty input table found");
} else if (!m_cumulativeComputing.getBooleanValue() && table.getRowCount() < m_winLength.getIntValue()) {
throw new InvalidSettingsException("Window length is larger than the number of rows of the input table");
}
final DataTableSpec spec = table.getDataTableSpec();
final MovingAggregationTableFactory tableFactory = createTableFactory(FileStoreFactory.createWorkflowFileStoreFactory(exec), spec);
BufferedDataTable resultTable = tableFactory.createTable(exec, table);
return new BufferedDataTable[] { resultTable };
}
Aggregations