|
|||||||||||
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.OrNode
Represents a logical or
for a query.
To find all rules with classification of "gold" or "silver" you need
to combine two ClassificationNode
s using a logical or
.
The following example performs this query:
IRuleFolder root = RuleMgmtHelper.getRootFolder(); ClassificationNode gold = new ClassificationNode("gold", ClassificationNode.EQUAL); ClassificationNode silver = new ClassificationNode("silver", ClassificationNode.EQUAL); OrNode orNode = new OrNode(gold, silver); Collection coll = root.findRules(orNode, true, IRule.TYPE_COPY);
OrNode
allows you to pass many nodes to be combined together.
The following forms a query that combines three nodes into the OrNode
:
IRuleFolder root = RuleMgmtHelper.getRootFolder(); ClassificationNode gold = new ClassificationNode("gold", ClassificationNode.EQUAL); ClassificationNode silver = new ClassificationNode("silver", ClassificationNode.EQUAL); ClassificationNode bronze = new ClassificationNode("bronze", ClassificationNode.EQUAL); OrNode orNode = new OrNode(new QueryNode[] {gold, silver, bronze}); Collection coll = root.findRules(orNode, true, IRule.TYPE_COPY);
OrNode
s and AndNode
s can be combined together as well.
For example suppose I 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, bronze}); AndNode andNode = new AndNode(nameNode, orNode); Collection coll = root.findRules(andNode, true, IRule.TYPE_COPY);
AndNode
,
Serialized FormConstructor Summary | |
---|---|
OrNode(QueryNode[] nodesIn)
Constructs an OrNode with an arbitrary
number of sub-nodes. |
|
OrNode(QueryNode left,
QueryNode right)
Constructs an OrNode 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 OrNode(QueryNode[] nodesIn)
OrNode
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 OrNode(QueryNode left, QueryNode right)
OrNode
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 |