com.ibm.websphere.brb.query
Class QueryNode
java.lang.Object
com.ibm.websphere.brb.query.QueryNode
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- AttributeNode, DependentRulesNode, LogicalOpNode
- public abstract class QueryNode
- extends java.lang.Object
- implements java.io.Serializable
This abstract class represents a node for a query. A node can
be a comparison, such as name = 'isEligible'
or a logical
operation, such as an and
clause.
QueryNodes are given to method
findRules
on class
IRuleFolder
. This will search for rules in
the IRuleFolder
(and optionally in subfolders) that match the query
specified in the given QueryNode
.
The best way to understand how this query framework works is to look at a few
examples. In the following example, RuleNameNode
is a class that extends from
QueryNode
. To find all rules named "isEligible", do the following:
// Initial setup to get the root rule folder
IRuleFolder root = RuleMgmtHelper.getRootFolder();
// Find rules named "isEligible" in the root folder and in subfolders
RuleNameNode nameNode = new RuleNameNode("isEligible", RuleNameNode.EQUAL);
Collection coll = root.findRules(nameNode, true, IRule.TYPE_COPY);
To find all rules named "isEligible" with classification of
"SeniorCitizen", do the following:
IRuleFolder root = RuleMgmtHelper.getRootFolder();
RuleNameNode nameNode = new RuleNameNode("isEligible", RuleNameNode.EQUAL);
ClassificationNode cNode = new ClassificationNode("SeniorCitizen", ClassificationNode.EQUAL);
AndNode andNode = new AndNode(nameNode, cNode);
Collection coll = root.findRules(andNode, true, IRule.TYPE_COPY);
Comparison nodes (AndNode
and OrNode
) allow you to pass many nodes
to be combined together. The following forms a query that combines four nodes into
the AndNode:
IRuleFolder root = RuleMgmtHelper.getRootFolder();probal
RuleNameNode nameNode = new RuleNameNode("isEligible", RuleNameNode.EQUAL);
ClassificationNode cNode = new ClassificationNode("Senior%", ClassificationNode.LIKE);
// In effect in the year 2000
StartDateNode sdNode = new StartDateNode(new Date(2000, 01, 01), StartDateNode.AFTER_INCLUSIVE);
EndDateNode edNode = new EndDateNode(new Date(2001, 01, 01), StartDateNode.BEFORE_EXCLUSIVE);
AndNode andNode = new AndNode(new QueryNode[] { nameNode, cNode, sdNode, edNode} );
Collection coll = root.findRules(andNode, true, IRule.TYPE_COPY);
- See Also:
- Serialized Form
Method Summary |
java.lang.String |
getWhereClause(java.util.Vector boundAttributes)
FOR IBM INTERNAL USE ONLY. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
QueryNode
public QueryNode()
getWhereClause
public java.lang.String getWhereClause(java.util.Vector boundAttributes)
throws BusinessRuleBeansException
- FOR IBM INTERNAL USE ONLY.
- Throws:
BusinessRuleBeansException
toString
public java.lang.String toString()