Class ActivationRuleGroup
- java.lang.Object
-
- org.rossonet.ext.rules.core.BasicRule
-
- org.rossonet.ext.rules.support.composite.CompositeRule
-
- org.rossonet.ext.rules.support.composite.ActivationRuleGroup
-
public class ActivationRuleGroup extends CompositeRule
An activation rule group is a composite rule that fires the first applicable rule and ignores other rules in the group (XOR logic). Rules are first sorted by their natural order (priority by default) within the group. This class is not thread-safe.
-
-
Field Summary
-
Fields inherited from class org.rossonet.ext.rules.support.composite.CompositeRule
rules
-
Fields inherited from class org.rossonet.ext.rules.core.BasicRule
description, name, priority
-
Fields inherited from interface org.rossonet.ext.rules.api.Rule
DEFAULT_DESCRIPTION, DEFAULT_NAME, DEFAULT_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description ActivationRuleGroup()Create an activation rule group.ActivationRuleGroup(java.lang.String name)Create an activation rule group.ActivationRuleGroup(java.lang.String name, java.lang.String description)Create a conditional rule group.ActivationRuleGroup(java.lang.String name, java.lang.String description, int priority)Create an activation rule group.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanevaluate(Facts facts)This method implements the rule's condition(s).voidexecute(Facts facts)This method implements the rule's action(s).-
Methods inherited from class org.rossonet.ext.rules.support.composite.CompositeRule
addRule, removeRule
-
Methods inherited from class org.rossonet.ext.rules.core.BasicRule
compareTo, equals, getDescription, getName, getPriority, hashCode, setDescription, setPriority, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.rossonet.ext.rules.api.Rule
isTraceEnable
-
-
-
-
Constructor Detail
-
ActivationRuleGroup
public ActivationRuleGroup()
Create an activation rule group.
-
ActivationRuleGroup
public ActivationRuleGroup(java.lang.String name)
Create an activation rule group.- Parameters:
name- of the activation rule group
-
ActivationRuleGroup
public ActivationRuleGroup(java.lang.String name, java.lang.String description)Create a conditional rule group.- Parameters:
name- of the activation rule groupdescription- of the activation rule group
-
ActivationRuleGroup
public ActivationRuleGroup(java.lang.String name, java.lang.String description, int priority)Create an activation rule group.- Parameters:
name- of the activation rule groupdescription- of the activation rule grouppriority- of the activation rule group
-
-
Method Detail
-
evaluate
public boolean evaluate(Facts facts)
Description copied from class:BasicRuleThis method implements the rule's condition(s). Implementations should handle any runtime exception and return true/false accordingly- Specified by:
evaluatein interfaceRule- Specified by:
evaluatein classCompositeRule- Returns:
- true if the rule should be applied given the provided facts, false otherwise
-
execute
public void execute(Facts facts) throws java.lang.Exception
Description copied from class:BasicRuleThis method implements the rule's action(s).- Specified by:
executein interfaceRule- Specified by:
executein classCompositeRule- Throws:
java.lang.Exception- thrown if an exception occurs when performing action(s)
-
-