|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.websphere.brb.query.QueryNode
com.ibm.websphere.brb.query.LogicalOpNode
com.ibm.websphere.brb.query.AndNode
Represents a logical and
for a query.
To find all rules named "isEligible" with classification of "SeniorCitizen" you need
to combine a RuleNameNode
with a ClassificationNode
using a logical and
.
The following example performs this query:
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);
AndNode
allows 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(); 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);
OrNode
s and AndNode
s can be combined together as well.
For example suppose you want to find rules that start with "is" that have a
classification of "gold" or "silver":
IRuleFolder root = RuleMgmtHelper.getRootFolder(); RuleNameNode nameNode = new RuleNameNode("is%", RuleNameNode.LIKE); ClassificationNode gold = new ClassificationNode("gold", ClassificationNode.EQUAL); ClassificationNode silver = new ClassificationNode("silver", ClassificationNode.EQUAL); OrNode orNode = new OrNode(new QueryNode[] {gold, silver}); AndNode andNode = new AndNode(nameNode, orNode); Collection coll = root.findRules(andNode, true, IRule.TYPE_COPY);
OrNode
,
Serialized FormConstructor Summary | |
---|---|
AndNode(QueryNode[] nodesIn)
Constructs an AndNode with an arbitrary
number of sub-nodes. |
|
AndNode(QueryNode left,
QueryNode right)
Constructs an AndNode with two sub-nodes. |
Methods inherited from class com.ibm.websphere.brb.query.LogicalOpNode |
---|
buildWhereClause |
Methods inherited from class com.ibm.websphere.brb.query.QueryNode |
---|
getWhereClause, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public AndNode(QueryNode[] nodesIn)
AndNode
with an arbitrary
number of sub-nodes. The sub-nodes can be any type of QueryNode
,
including other LogicalOpNode
s or AttributeNode
s. Each
sub-node will be combined together to form a valid expression.
The input array nodesIn
must be non-null. The array
must contain at least two elements. An IllegalArgumentException
is thrown if the array does not meet this criteria.
nodesIn
- the nodes that are to be combined together.
java.lang.IllegalArgumentException
- if input array is null or if it does not contain at least two QueryNode
spublic AndNode(QueryNode left, QueryNode right)
AndNode
with two sub-nodes.
The sub-nodes can be any type of QueryNode
,
including other LogicalOpNode
s or AttributeNode
s.
The sub-nodes will be combined together to form a valid expression.
left
and right
must be non-null.
An IllegalArgumentException
is thrown if they do not meet this criteria.
left
- the node to the left of the logical operatorright
- the node to the right of the logical operator
java.lang.IllegalArgumentException
- if either input parameter is null
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |