org.kuali.rice.krms.framework.engine
Class BasicRule

java.lang.Object
  extended by org.kuali.rice.krms.framework.engine.BasicRule
All Implemented Interfaces:
Rule
Direct Known Subclasses:
FalseTriggeredRule, ValidationRule

public class BasicRule
extends Object
implements Rule

A Rule that executes a Action when the Proposition is true.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Constructor Summary
BasicRule(Proposition proposition, List<Action> actions)
          Constructor
BasicRule(String name, Proposition proposition, List<Action> actions)
          Constructor
 
Method Summary
 boolean evaluate(ExecutionEnvironment environment)
          Evaluate a given ExecutionEnvironment, returning true if the rules conditions pass, false if they do not.
 String getName()
          Return the Rule name
protected  boolean shouldExecuteAction(boolean ruleExecutionResult)
          Based on the ruleExecutionResult should the Action be executed? Default behavior is to return the given ruleExecutionResult.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicRule

public BasicRule(String name,
                 Proposition proposition,
                 List<Action> actions)
Constructor

Parameters:
name - Rule name to set the name to
proposition - Proposition to set the proposition to, cannot be null
actions - Rule Actions to set the actions to
Throws:
IllegalArgumentException - if the Proposition is null

BasicRule

public BasicRule(Proposition proposition,
                 List<Action> actions)
Constructor

Parameters:
proposition - Proposition to set the proposition to, cannot be null
actions - Rule Actions to set the actions to
Throws:
IllegalArgumentException - if the Proposition is null
Method Detail

evaluate

public boolean evaluate(ExecutionEnvironment environment)
Description copied from interface: Rule
Evaluate a given ExecutionEnvironment, returning true if the rules conditions pass, false if they do not.

Specified by:
evaluate in interface Rule
Parameters:
environment - ExecutionEnvironment
Returns:
true if given ExecutionEnvironment the rule's conditions pass, false if they do not

shouldExecuteAction

protected boolean shouldExecuteAction(boolean ruleExecutionResult)
Based on the ruleExecutionResult should the Action be executed? Default behavior is to return the given ruleExecutionResult. Over-writable by subclasses.

Parameters:
ruleExecutionResult - the result of the engines evaluation method.
Returns:
boolean should the action execute

getName

public String getName()
Return the Rule name

Returns:
name Rule name

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2005-2014 The Kuali Foundation. All Rights Reserved.