com.bea.p13n.rules.model
Class RuleModel

java.lang.Object
  extended by com.bea.p13n.model.Model
      extended by com.bea.p13n.model.XmlObjectModel
          extended by com.bea.p13n.rules.model.ClauseModel
              extended by com.bea.p13n.rules.model.RuleModel
All Implemented Interfaces
BoundVariableProvider, Serializable, Cloneable

public class RuleModel
extends ClauseModel
implements BoundVariableProvider

The model representing a rule.

This will always have 2 children, in order, a ConditionsModel and a ActionsModel. Those will contain the various ClauseModels of the rule.

The clauseType of a RuleModel will be its ruleType identifier. It will be kept uptodate with the actions. Therefore, adding and removing clauses from the conditions and actions will possibly fire 'clauseType' change events.

See Also
Serialized Form

Nested Class Summary
static class RuleModel.ActionsModel
          A clause model to hold the action clauses of the rule.
static class RuleModel.ConditionsModel
          A clause model to hold the condition clauses of the rule.
static class RuleModel.Recongizer
          An object which recognizes Xmlobjects that can be loaded into a RuleModel.
 
Nested classes/interfaces inherited from class com.bea.p13n.model.Model
Model.ChangeEvent, Model.ChangeListener, Model.ChangeSupport, Model.Debug
 
Field Summary
static String GENERIC_RULE_TYPE
           
 
Fields inherited from class com.bea.p13n.rules.model.ClauseModel
clauseType
 
Fields inherited from class com.bea.p13n.model.XmlObjectModel
copyRootXmlObject, instanceUri, isComplete
 
Fields inherited from class com.bea.p13n.model.Model
childrenModels, docModel, parentModel, roChildrenModels
 
Constructor Summary
RuleModel()
           
 
Method Summary
 void clearCachedData()
          Clear out any cached data where holding so we'll get it from the Rule next time.
 org.apache.xmlbeans.XmlObject createNewXmlObject(String clauseType)
          Return a new, empty Rule object with no conditions or actions.
protected  void determineClauseType()
          Update our clauseType to be the ruleType.
protected  boolean determineIsComplete()
          Determine if the RuleModel is currently complete.
 RuleModel.ActionsModel getActionsModel()
          Get the actions.
 Collection<MethodCallModel.VariableArgument> getBoundVariables()
          Return the name/type pairs of all variables bound into the rule conditions.
 RuleModel.ConditionsModel getConditionsModel()
          Get the conditions.
 String getDescription()
          Get the rule description.
 String getName()
          Get the rule name.
 com.bea.p13n.rules.schema.RuleDocument.Rule getRule()
          Get the underlying Rule object.
 void setDescription(String desc)
          Set the rule description.
protected  void setIsComplete(boolean isComplete)
          Override to set on our rule object also.
 void setName(String name)
          Set the rule name.
 void setXmlObject(String clauseType, org.apache.xmlbeans.XmlObject clause)
          Initialize this model from the specified clause structure.
 
Methods inherited from class com.bea.p13n.rules.model.ClauseModel
addBranch, addLiteral, addMethod, addMethodOrOperator, addOperator, addVariable, addVariableBinding, copy, getClauseType, getContainingRuleModel, getCopyXmlObject, initializeNew, isInActions, isInConditions, isValidTypeAlias, isValidVariableName, makeSafeCopy, toString
 
Methods inherited from class com.bea.p13n.model.XmlObjectModel
checkElement, childAdded, childRemoved, fixQName, getApplicationInstanceUri, getChild, getDocument, getLocalName, getParent, getQName, getRootXmlObject, isComplete, isNil, preRemove, propertyChanged, removeAllChildren, removeChild, setApplicationInstanceUri, setIsComplete, setParent, setRootXmlObject
 
Methods inherited from class com.bea.p13n.model.Model
addChangeListener, addChild, addChild, clone, doubleEquals, equals, getChildren, getDebug, getDebug, getDocument, getParent, longEquals, removeChangeListener, removeChild, removeChild, removeEmpties, setDocument
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GENERIC_RULE_TYPE

public static final String GENERIC_RULE_TYPE
See Also
Constants Summary
Constructor Detail

RuleModel

public RuleModel()
Method Detail

setXmlObject

public void setXmlObject(String clauseType,
                         org.apache.xmlbeans.XmlObject clause)
                  throws IllegalArgumentException
Initialize this model from the specified clause structure.

Overrides:
setXmlObject in class ClauseModel
Parameters
clauseType - the clause type of the clause.
clause - the root xml object of the clause.
Throws
IllegalArgumentException - if clause is not a RuleDocument.Rule instance.

determineClauseType

protected void determineClauseType()
Update our clauseType to be the ruleType.


createNewXmlObject

public org.apache.xmlbeans.XmlObject createNewXmlObject(String clauseType)
Return a new, empty Rule object with no conditions or actions.

Specified by:
createNewXmlObject in class ClauseModel
Parameters
clauseType - the clause type of the clause.
Returns
a new, empty initialize root object.

clearCachedData

public void clearCachedData()
Clear out any cached data where holding so we'll get it from the Rule next time.

Specified by:
clearCachedData in class XmlObjectModel

getRule

public com.bea.p13n.rules.schema.RuleDocument.Rule getRule()
Get the underlying Rule object.


setIsComplete

protected void setIsComplete(boolean isComplete)
Override to set on our rule object also.

Overrides:
setIsComplete in class XmlObjectModel

determineIsComplete

protected boolean determineIsComplete()
Determine if the RuleModel is currently complete. RuleModels are complete if:

Overrides:
determineIsComplete in class XmlObjectModel

getName

public String getName()
Get the rule name. This will never be null; it will be empty string for no name or if not set.


setName

public void setName(String name)
Set the rule name.


getDescription

public String getDescription()
Get the rule description.

Returns
the description, or null if none.

setDescription

public void setDescription(String desc)
Set the rule description.


getBoundVariables

public Collection<MethodCallModel.VariableArgument> getBoundVariables()
Return the name/type pairs of all variables bound into the rule conditions. These can then be referenced in the rule actions. The resulting list can be modified; it will be recreated with each call.

Specified by:
getBoundVariables in interface BoundVariableProvider
Returns
the bound variable information, null or empty for none.

getConditionsModel

public RuleModel.ConditionsModel getConditionsModel()
Get the conditions.


getActionsModel

public RuleModel.ActionsModel getActionsModel()
Get the actions.



Copyright © 2011, Oracle. All rights reserved.