Search in sources :

Example 1 with RuleEngineSettings

use of org.knime.base.node.rules.engine.RuleEngineSettings in project knime-core by knime.

the class PMMLRuleEditorNodeModel method validateSettings.

/**
 * {@inheritDoc}
 */
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
    RuleEngineSettings res = new RuleEngineSettings();
    res.loadSettings(settings);
    RuleFactory ruleFactory = RuleFactory.getInstance(RuleNodeSettings.PMMLRule).cloned();
    ruleFactory.disableColumnChecks();
    ruleFactory.disableFlowVariableChecks();
    Map<String, FlowVariable> flowVars = getAvailableInputFlowVariables();
    for (String rule : res.rules()) {
        try {
            ruleFactory.parse(rule, null, flowVars);
        } catch (ParseException e) {
            throw new InvalidSettingsException(e.getMessage(), e);
        }
    }
}
Also used : RuleFactory(org.knime.base.node.rules.engine.RuleFactory) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) ParseException(java.text.ParseException) RuleEngineSettings(org.knime.base.node.rules.engine.RuleEngineSettings) FlowVariable(org.knime.core.node.workflow.FlowVariable)

Aggregations

ParseException (java.text.ParseException)1 RuleEngineSettings (org.knime.base.node.rules.engine.RuleEngineSettings)1 RuleFactory (org.knime.base.node.rules.engine.RuleFactory)1 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)1 FlowVariable (org.knime.core.node.workflow.FlowVariable)1