ABLE 2.3.0 07/13/2005 14:21:00

com.ibm.able.rules
Class AblePolicyRule

java.lang.Object
  extended bycom.ibm.able.rules.AbleRule
      extended bycom.ibm.able.rules.AblePolicyRule
All Implemented Interfaces:
java.io.Serializable

public class AblePolicyRule
extends AbleRule
implements java.io.Serializable

This class holds the business value, preconditions, and actions used in a policy rule. The precondition expression can be an arbitrarily complex boolean expression and the decision section can contain zero or more action clauses.

See Also:
Serialized Form

Field Summary
protected  java.util.Vector myPolicyDecisions
          myPolicyDecisions is a list of AbleConsequentClause objects.
protected  AbleExpression myPolicyPreconditions
          myPolicyPreconditions is an arbitrarily complex AbleExpression that must evaluate to a boolean value.
 
Fields inherited from class com.ibm.able.rules.AbleRule
myBooleanTruth, myBreakpoint, myComment, myEnabled, myFinalFlag, myFiredCount, myFiredFlag, myId, myLabel, myLocation, myPreConditions, myPriority, myPrompt, myProperties, myRdRefs, myRuleBlock, myRuleSet, myTemplateFlag, myTemplateName, myTemplateValues, myWrRefs, PriorityDefault, RuleIdInitial
 
Constructor Summary
AblePolicyRule(java.lang.String theLabel, AbleRd theBusinessValue, AbleExpression thePolicyPreconditions, java.util.Vector thePolicyDecisions)
          Create a new policy rule with the specified business value, preconditions, and decisions.
 
Method Summary
 java.lang.String arlString()
          Returns a formal Able Rule Language (ARL) string representation of the rule.
 java.lang.String armlString()
          Return a formal XML string.
 java.util.Vector getPolicyDecisions()
          Gets the rule's list of policy decisions.
 AbleExpression getPolicyPreconditions()
          Gets the rule's policy preconditions.
 java.lang.String getTemplateString(java.util.Vector theTemplateVars)
          Retrieve a text format string for use by rule templates.
 long numberOfPolicyDecisions()
          Gets the number of policy decisions in this rule.
 long numberOfPolicyPreconditions()
          Gets the number of policy preconditions in this rule.
 void reset()
          Resets the rule to its unfired state.
 java.lang.String toString()
          Retrieve a string describing (the contents of) the object.
 java.lang.String traceString(int theTraceStringFlavor)
          Gets a string that describes the contents of the object, suitable for inclusion in a trace log.
 java.lang.String xmlString()
          Returns a formal XML string representation of the rule.
 
Methods inherited from class com.ibm.able.rules.AbleRule
addHeaderRdReferences, addRdReference, addRdReferences, addWrReference, addWrReferences, arlActionBlockString, arlPreConditionsString, armlPreConditionsString, armlPriorityString, armlPropertiesString, checkTimePeriodPreConditions, clearBreakpoint, getArlComment, getBooleanTruth, getBreakpoint, getComment, getId, getIdLabelString, getLabel, getLocation, getMetaData, getPreConditions, getPriority, getPrompt, getPromptString, getProperties, getProperty, getRdReferences, getTemplateActionBlockString, getTemplateHeaderString, getTemplateName, getTemplateValues, getTemplateVars, getWrReferences, isDefaultPriority, isEnabled, isFinal, isFired, isGeneratedFromTemplate, isTemplate, logTrace, removeProperty, setBooleanTruth, setBreakpoint, setComment, setEnabled, setFinal, setFired, setId, setLocation, setMetaData, setPreConditions, setPriority, setPrompt, setProperties, setProperty, setTemplate, setTemplateName, setTemplateValues, xmlPreConditionsString, xmlPriorityString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myPolicyPreconditions

protected AbleExpression myPolicyPreconditions
myPolicyPreconditions is an arbitrarily complex AbleExpression that must evaluate to a boolean value. If the expression evaluates to true, the rule may possibly fire; otherwise, the rule will not fire.

The expression may be null, in which case the rule must be ignored by any policy engine.


myPolicyDecisions

protected java.util.Vector myPolicyDecisions
myPolicyDecisions is a list of AbleConsequentClause objects. The list may be empty, but it must never be null.

Constructor Detail

AblePolicyRule

public AblePolicyRule(java.lang.String theLabel,
                      AbleRd theBusinessValue,
                      AbleExpression thePolicyPreconditions,
                      java.util.Vector thePolicyDecisions)
Create a new policy rule with the specified business value, preconditions, and decisions.

Parameters:
theLabel - The unique label, or name, of this rule.

theBusinessValue - The business value (priority) of this rule.

thePolicyPreconditions - An arbitrarily complex AbleExpression that must evaluate to a boolean value. If the expression evaluates to true, the rule may possibly fire; otherwise, the rule will not fire. Whether the rule actually fires may depend on the business value (priority), whether the rule is enabled, and perhaps other conditions examined by a policy engine.

The specified expression may be null, in which case the rule must be ignored by any policy engine.

thePolicyDecisions - A list of AbleConsequentClause objects that define the decisions, or actions, of this rule. The list may be empty, but must not be null. The list is cloned before it is cached.

Method Detail

getPolicyPreconditions

public final AbleExpression getPolicyPreconditions()
Gets the rule's policy preconditions.

Returns:
A reference to the AbleExpression that represents the policy's preconditions. If the policy has no preconditions, this may be null.

numberOfPolicyPreconditions

public long numberOfPolicyPreconditions()
Gets the number of policy preconditions in this rule.

Returns:
The number of preconditions. This number is always one (1) unless the policy has no preconditions; in that case zero is returned.

getPolicyDecisions

public final java.util.Vector getPolicyDecisions()
Gets the rule's list of policy decisions.

Returns:
A reference to the decisions, or actions, of the rule, which is a list of AbleConsequentClause objects. If the policy has no decisions, the list is empty, but never null.

numberOfPolicyDecisions

public long numberOfPolicyDecisions()
Gets the number of policy decisions in this rule.

Returns:
The number of decisions. Note that zero is a valid number; that is, the policy may have no decisions.

reset

public void reset()
Resets the rule to its unfired state.

Overrides:
reset in class AbleRule

arlString

public java.lang.String arlString()
Returns a formal Able Rule Language (ARL) string representation of the rule.

Specified by:
arlString in class AbleRule
Returns:
A String describing the object in Able Rule Language.

xmlString

public java.lang.String xmlString()
Returns a formal XML string representation of the rule.

Specified by:
xmlString in class AbleRule
Returns:
A String describing the object in XML.

armlString

public java.lang.String armlString()
Description copied from class: AbleRule
Return a formal XML string.

Specified by:
armlString in class AbleRule
Returns:
A String describing the object in XML.

getTemplateString

public java.lang.String getTemplateString(java.util.Vector theTemplateVars)
                                   throws AbleDataException
Retrieve a text format string for use by rule templates. The string contains "{n}" strings, where the index 'n' corresponds to the template variables defined in the rule template. This string is based on the standard arlString() representation of the rule. After replacement of the template variable values, the resulting string must be a valid ARL format string that can be parsed.

Specified by:
getTemplateString in class AbleRule
Parameters:
theTemplateVars - An ordered list of template variables referenced by this rule.

Returns:
A text format string used to create a new rule instance.
Throws:
AbleDataException
See Also:
AbleRuleTemplate

toString

public java.lang.String toString()
Retrieve a string describing (the contents of) the object.

Overrides:
toString in class AbleRule
Returns:
A String containing the current contents of the object. The representation is the same as that returned by the arlString() method.

traceString

public java.lang.String traceString(int theTraceStringFlavor)
Gets a string that describes the contents of the object, suitable for inclusion in a trace log.

Specified by:
traceString in class AbleRule
Parameters:
theTraceStringFlavor - An Able.TraceStringFlavor value.

Returns:
A String containing the current contents of the object. The format of the string depends on the specified flavor:
  • FlavorHigh  -  trcString(High)
  • FlavorMedium  -  trcString(Medium)
  • FlavorLow  -  arlString()
  • FlavorArl  -  arlString()
  • FlavorXml  -  xmlString()
  • default  -  arlString()

ABLE 2.3.0 07/13/2005 14:21:00

(C) Copyright IBM Corporation 1999, 2005