ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.rules
Class AbleRuleTemplate

java.lang.Object
  |
  +--com.ibm.able.rules.AbleRuleTemplate
All Implemented Interfaces:
AbleTemplate, java.io.Serializable

public class AbleRuleTemplate
extends java.lang.Object
implements AbleTemplate, java.io.Serializable

This class allows a user to customize an AbleRule object using a template metaphor. Template variables are used to alter the base rule object and to provide the customized object

See Also:
Serialized Form

Field Summary
protected  java.util.Hashtable myGeneratedRules
          The list if generated rules
protected  AbleRule myRule
          The underlying AbleRule object (with the template attribute) used to generate new customized AbleRule object instances.
protected  AbleRuleBlock myRuleBlock
          The ruleblock object which this rule would be added to
protected  AbleRuleSet myRuleSet
          The ruleset object which provides the context for this template.
protected  java.util.Vector myTemplateVars
          The list of template variables referenced by the underlying AbleRule object used to provide customized values for generating new AblRule objects.
 
Fields inherited from interface com.ibm.able.rules.AbleTemplate
serialVersionUID
 
Constructor Summary
AbleRuleTemplate(AbleRuleSet theRuleSet, AbleRuleBlock theRuleBlock, AbleRule theRule)
          Construct a rule template object from a base rule object
 
Method Summary
 void addGeneratedRule(AbleRule theGeneratedRule)
           
 AbleRule createInstance()
          Given a list of bound template variables, construct an instance of a new AbleRule object from the template rule.
protected  AbleRule createOrReplaceInstance(boolean theReplacementMode)
          Given a list of bound template variables, construct an instance of a new AbleRule object from the template rule.
protected  void ctorInitTemplateVarList()
          Prepend 2 template variables, one for the rule label, and one for the rule comment The rule comment is the first {0} replacement variable The rule label is the second {1} replacement variable
 java.lang.String getArlString()
          Retrieve the ARL text string (of the underlying rule object)
 java.lang.String getComment()
          Retrieve the description or comment field of the template (of the underlying ruleset or rule object)
 java.util.Vector getGeneratedRules()
           
 java.lang.String getName()
          Retrieve the name of the template (of the underlying rule object)
 java.lang.String getPromptString()
          Retrieve the name of the template (of the underlying rule object)
 AbleRuleBlock getRuleBlock()
          Retrieve the ruleblock that this template belongs to
 java.lang.Object[] getTemplateVars()
          Retrieve the template variables for this template object
 void removeGeneratedRule(AbleRule theGeneratedRule)
           
 AbleRule replaceInstance()
          Given a list of bound template variables, construct an instance of a new AbleRule object from the template rule and replace an existing rule with the same label.
 void resetTemplateVars()
          Calls reset on all template vars to insure they hold the initial values as coded in the ruleset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myRule

protected AbleRule myRule
The underlying AbleRule object (with the template attribute) used to generate new customized AbleRule object instances.

myRuleSet

protected AbleRuleSet myRuleSet
The ruleset object which provides the context for this template.

myRuleBlock

protected AbleRuleBlock myRuleBlock
The ruleblock object which this rule would be added to

myTemplateVars

protected java.util.Vector myTemplateVars
The list of template variables referenced by the underlying AbleRule object used to provide customized values for generating new AblRule objects.

myGeneratedRules

protected java.util.Hashtable myGeneratedRules
The list if generated rules
Constructor Detail

AbleRuleTemplate

public AbleRuleTemplate(AbleRuleSet theRuleSet,
                        AbleRuleBlock theRuleBlock,
                        AbleRule theRule)
                 throws AbleDataException
Construct a rule template object from a base rule object
Method Detail

ctorInitTemplateVarList

protected void ctorInitTemplateVarList()
                                throws AbleDataException
Prepend 2 template variables, one for the rule label, and one for the rule comment The rule comment is the first {0} replacement variable The rule label is the second {1} replacement variable

createOrReplaceInstance

protected AbleRule createOrReplaceInstance(boolean theReplacementMode)
                                    throws AbleParException
Given a list of bound template variables, construct an instance of a new AbleRule object from the template rule.
Parameters:
theTemplateVars - A hashtable containing bound template variables
theReplacementMode - A boolean true value if we are replacing an existing rule, or false if it is a new rule
See Also:
createInstance()

createInstance

public AbleRule createInstance()
                        throws AbleParException
Given a list of bound template variables, construct an instance of a new AbleRule object from the template rule.

replaceInstance

public AbleRule replaceInstance()
                         throws AbleParException
Given a list of bound template variables, construct an instance of a new AbleRule object from the template rule and replace an existing rule with the same label.

getTemplateVars

public java.lang.Object[] getTemplateVars()
                                   throws AbleDataException
Description copied from interface: AbleTemplate
Retrieve the template variables for this template object
Specified by:
getTemplateVars in interface AbleTemplate

resetTemplateVars

public void resetTemplateVars()
                       throws AbleDataException
Calls reset on all template vars to insure they hold the initial values as coded in the ruleset.

getName

public java.lang.String getName()
                         throws AbleDataException
Retrieve the name of the template (of the underlying rule object)
Specified by:
getName in interface AbleTemplate

getComment

public java.lang.String getComment()
                            throws java.rmi.RemoteException
Retrieve the description or comment field of the template (of the underlying ruleset or rule object)
Specified by:
getComment in interface AbleTemplate

getPromptString

public java.lang.String getPromptString()
                                 throws AbleDataException
Retrieve the name of the template (of the underlying rule object)

getArlString

public java.lang.String getArlString()
                              throws AbleDataException
Retrieve the ARL text string (of the underlying rule object)
Specified by:
getArlString in interface AbleTemplate

getRuleBlock

public AbleRuleBlock getRuleBlock()
Retrieve the ruleblock that this template belongs to

addGeneratedRule

public void addGeneratedRule(AbleRule theGeneratedRule)
                      throws AbleDataException

removeGeneratedRule

public void removeGeneratedRule(AbleRule theGeneratedRule)
                         throws AbleDataException

getGeneratedRules

public java.util.Vector getGeneratedRules()

ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003