Class RuleModel

  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
Fields inherited from class com.bea.p13n.rules.model.ClauseModel
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
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


public static final String GENERIC_RULE_TYPE
See Also
Constants Summary
Constructor Detail


public RuleModel()
Method Detail


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

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


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


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
clauseType - the clause type of the clause.
a new, empty initialize root object.


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


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


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

setIsComplete in class XmlObjectModel


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

determineIsComplete in class XmlObjectModel


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


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


public String getDescription()
Get the rule description.

the description, or null if none.


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


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
the bound variable information, null or empty for none.


public RuleModel.ConditionsModel getConditionsModel()
Get the conditions.


public RuleModel.ActionsModel getActionsModel()
Get the actions.

Copyright © 2011, Oracle. All rights reserved.