org.modeshape.jcr.api.query.qom
Interface QueryObjectModelFactory

All Superinterfaces:
QueryObjectModelConstants, QueryObjectModelFactory

public interface QueryObjectModelFactory
extends QueryObjectModelFactory

An extension to the standard JCR QueryObjectModelFactory interface, with methods to create additional components for more powerful queries.


Field Summary
 
Fields inherited from interface javax.jcr.query.qom.QueryObjectModelConstants
JCR_JOIN_TYPE_INNER, JCR_JOIN_TYPE_LEFT_OUTER, JCR_JOIN_TYPE_RIGHT_OUTER, JCR_OPERATOR_EQUAL_TO, JCR_OPERATOR_GREATER_THAN, JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO, JCR_OPERATOR_LESS_THAN, JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO, JCR_OPERATOR_LIKE, JCR_OPERATOR_NOT_EQUAL_TO, JCR_ORDER_ASCENDING, JCR_ORDER_DESCENDING
 
Method Summary
 ArithmeticOperand add(DynamicOperand left, DynamicOperand right)
          Create an arithmetic dynamic operand that adds the numeric value of the two supplied operand(s).
 Between between(DynamicOperand operand, StaticOperand lowerBound, StaticOperand upperBound, boolean includeLowerBound, boolean includeUpperBound)
          Tests that the value (or values) defined by the supplied dynamic operand are within a specified range.
 ArithmeticOperand divide(DynamicOperand left, DynamicOperand right)
          Create an arithmetic dynamic operand that divides the numeric value of the first operand by the numeric value of the second.
 SetQuery except(QueryCommand left, QueryCommand right, Ordering[] orderings, Limit limit, boolean all)
          Creates a query command that returns all rows that are in the result of the left-hand query but not in the result of the right-hand query.
 SetCriteria in(DynamicOperand operand, StaticOperand... values)
          Tests that the value (or values) defined by the supplied dynamic operand are found within the specified set of values.
 SetQuery intersect(QueryCommand left, QueryCommand right, Ordering[] orderings, Limit limit, boolean all)
          Creates a query command that returns all rows that are both in the result of the left-hand query and in the result of the right-hand query.
 Limit limit(int rowLimit, int offset)
          Evaluates to a limit on the maximum number of tuples in the results and the number of rows that are skipped before the first tuple in the results.
 ArithmeticOperand multiply(DynamicOperand left, DynamicOperand right)
          Create an arithmetic dynamic operand that multplies the numeric value of the first operand by the numeric value of the second.
 NodeDepth nodeDepth(String selectorName)
          Evaluates to a LONG value equal to the depth of a node in the specified selector.
 NodePath nodePath(String selectorName)
          Evaluates to a PATH value equal to the prefix-qualified path of a node in the specified selector.
 ReferenceValue referenceValue(String selectorName)
          Creates a dynamic operand that evaluates to the REFERENCE value of the any property on the specified selector.
 ReferenceValue referenceValue(String selectorName, String propertyName)
          Creates a dynamic operand that evaluates to the REFERENCE value of the specified property on the specified selector.
 SelectQuery select(Source source, Constraint constraint, Ordering[] orderings, Column[] columns, Limit limit, boolean isDistinct)
          Creates a query with one or more selectors.
 Subquery subquery(QueryCommand subqueryCommand)
          Creates a subquery that can be used as a StaticOperand in another query.
 ArithmeticOperand subtract(DynamicOperand left, DynamicOperand right)
          Create an arithmetic dynamic operand that subtracts the numeric value of the second operand from the numeric value of the first.
 SetQuery union(QueryCommand left, QueryCommand right, Ordering[] orderings, Limit limit, boolean all)
          Creates a query command that effectively appends the results of the right-hand query to those of the left-hand query.
 
Methods inherited from interface javax.jcr.query.qom.QueryObjectModelFactory
and, ascending, bindVariable, childNode, childNodeJoinCondition, column, comparison, createQuery, descendantNode, descendantNodeJoinCondition, descending, equiJoinCondition, fullTextSearch, fullTextSearchScore, join, length, literal, lowerCase, nodeLocalName, nodeName, not, or, propertyExistence, propertyValue, sameNode, sameNodeJoinCondition, selector, upperCase
 

Method Detail

select

SelectQuery select(Source source,
                   Constraint constraint,
                   Ordering[] orderings,
                   Column[] columns,
                   Limit limit,
                   boolean isDistinct)
                   throws InvalidQueryException,
                          RepositoryException
Creates a query with one or more selectors.

Parameters:
source - the node-tuple source; non-null
constraint - the constraint, or null if none
orderings - zero or more orderings; null is equivalent to a zero-length array
columns - the columns; null is equivalent to a zero-length array
limit - the limit; null is equivalent to having no limit
isDistinct - true if the query should return distinct values; or false if no duplicate removal should be performed
Returns:
the select query; non-null
Throws:
InvalidQueryException - if a particular validity test is possible on this method, the implemention chooses to perform that test and the parameters given fail that test. See the individual QOM factory methods for the validity criteria of each query element.
RepositoryException - if another error occurs.

union

SetQuery union(QueryCommand left,
               QueryCommand right,
               Ordering[] orderings,
               Limit limit,
               boolean all)
               throws InvalidQueryException,
                      RepositoryException
Creates a query command that effectively appends the results of the right-hand query to those of the left-hand query.

Parameters:
left - the query command that represents left-side of the set operation; non-null and must have columns that are equivalent and union-able to those of the right-side query
right - the query command that represents right-side of the set operation; non-null and must have columns that are equivalent and union-able to those of the left-side query
orderings - zero or more orderings; null is equivalent to a zero-length array
limit - the limit; null is equivalent to having no limit
all - true if duplicate rows in the left- and right-hand side results should be included, or false if duplicate rows should be eliminated
Returns:
the select query; non-null
Throws:
InvalidQueryException - if a particular validity test is possible on this method, the implemention chooses to perform that test and the parameters given fail that test. See the individual QOM factory methods for the validity criteria of each query element.
RepositoryException - if another error occurs.

intersect

SetQuery intersect(QueryCommand left,
                   QueryCommand right,
                   Ordering[] orderings,
                   Limit limit,
                   boolean all)
                   throws InvalidQueryException,
                          RepositoryException
Creates a query command that returns all rows that are both in the result of the left-hand query and in the result of the right-hand query.

Parameters:
left - the query command that represents left-side of the set operation; non-null and must have columns that are equivalent and union-able to those of the right-side query
right - the query command that represents right-side of the set operation; non-null and must have columns that are equivalent and union-able to those of the left-side query
orderings - zero or more orderings; null is equivalent to a zero-length array
limit - the limit; null is equivalent to having no limit
all - true if duplicate rows in the left- and right-hand side results should be included, or false if duplicate rows should be eliminated
Returns:
the select query; non-null
Throws:
InvalidQueryException - if a particular validity test is possible on this method, the implemention chooses to perform that test and the parameters given fail that test. See the individual QOM factory methods for the validity criteria of each query element.
RepositoryException - if another error occurs.

except

SetQuery except(QueryCommand left,
                QueryCommand right,
                Ordering[] orderings,
                Limit limit,
                boolean all)
                throws InvalidQueryException,
                       RepositoryException
Creates a query command that returns all rows that are in the result of the left-hand query but not in the result of the right-hand query.

Parameters:
left - the query command that represents left-side of the set operation; non-null and must have columns that are equivalent and union-able to those of the right-side query
right - the query command that represents right-side of the set operation; non-null and must have columns that are equivalent and union-able to those of the left-side query
orderings - zero or more orderings; null is equivalent to a zero-length array
limit - the limit; null is equivalent to having no limit
all - true if duplicate rows in the left- and right-hand side results should be included, or false if duplicate rows should be eliminated
Returns:
the select query; non-null
Throws:
InvalidQueryException - if a particular validity test is possible on this method, the implemention chooses to perform that test and the parameters given fail that test. See the individual QOM factory methods for the validity criteria of each query element.
RepositoryException - if another error occurs.

nodeDepth

NodeDepth nodeDepth(String selectorName)
                    throws InvalidQueryException,
                           RepositoryException
Evaluates to a LONG value equal to the depth of a node in the specified selector.

The query is invalid if selector is not the name of a selector in the query.

Parameters:
selectorName - the selector name; non-null
Returns:
the operand; non-null
Throws:
InvalidQueryException - if a particular validity test is possible on this method, the implemention chooses to perform that test (and not leave it until later, on QueryObjectModelFactory.createQuery(javax.jcr.query.qom.Source, javax.jcr.query.qom.Constraint, javax.jcr.query.qom.Ordering[], javax.jcr.query.qom.Column[])), and the parameters given fail that test
RepositoryException - if the operation otherwise fails

nodePath

NodePath nodePath(String selectorName)
                  throws InvalidQueryException,
                         RepositoryException
Evaluates to a PATH value equal to the prefix-qualified path of a node in the specified selector.

The query is invalid if selector is not the name of a selector in the query.

Parameters:
selectorName - the selector name; non-null
Returns:
the operand; non-null
Throws:
InvalidQueryException - if a particular validity test is possible on this method, the implemention chooses to perform that test (and not leave it until later, on QueryObjectModelFactory.createQuery(javax.jcr.query.qom.Source, javax.jcr.query.qom.Constraint, javax.jcr.query.qom.Ordering[], javax.jcr.query.qom.Column[])), and the parameters given fail that test
RepositoryException - if the operation otherwise fails

limit

Limit limit(int rowLimit,
            int offset)
            throws InvalidQueryException,
                   RepositoryException
Evaluates to a limit on the maximum number of tuples in the results and the number of rows that are skipped before the first tuple in the results.

Parameters:
rowLimit - the maximum number of rows; must be a positive number, or Integer.MAX_VALUE if there is to be a non-zero offset but no limit
offset - the number of rows to skip before beginning the results; must be 0 or a positive number
Returns:
the operand; non-null
Throws:
InvalidQueryException - if a particular validity test is possible on this method, the implemention chooses to perform that test (and not leave it until later, on QueryObjectModelFactory.createQuery(javax.jcr.query.qom.Source, javax.jcr.query.qom.Constraint, javax.jcr.query.qom.Ordering[], javax.jcr.query.qom.Column[])), and the parameters given fail that test
RepositoryException - if the operation otherwise fails

between

Between between(DynamicOperand operand,
                StaticOperand lowerBound,
                StaticOperand upperBound,
                boolean includeLowerBound,
                boolean includeUpperBound)
                throws InvalidQueryException,
                       RepositoryException
Tests that the value (or values) defined by the supplied dynamic operand are within a specified range. The range is specified by a lower and upper bound, and whether each of the boundary values is included in the range.

Parameters:
operand - the dynamic operand describing the values that are to be constrained
lowerBound - the lower bound of the range
upperBound - the upper bound of the range
includeLowerBound - true if the lower boundary value is not be included
includeUpperBound - true if the upper boundary value is not be included
Returns:
the constraint; non-null
Throws:
InvalidQueryException - if a particular validity test is possible on this method, the implemention chooses to perform that test (and not leave it until later, on QueryObjectModelFactory.createQuery(javax.jcr.query.qom.Source, javax.jcr.query.qom.Constraint, javax.jcr.query.qom.Ordering[], javax.jcr.query.qom.Column[])), and the parameters given fail that test
RepositoryException - if the operation otherwise fails

in

SetCriteria in(DynamicOperand operand,
               StaticOperand... values)
               throws InvalidQueryException,
                      RepositoryException
Tests that the value (or values) defined by the supplied dynamic operand are found within the specified set of values.

Parameters:
operand - the dynamic operand describing the values that are to be constrained
values - the static operand values; may not be null or empty
Returns:
the constraint; non-null
Throws:
InvalidQueryException - if a particular validity test is possible on this method, the implemention chooses to perform that test (and not leave it until later, on QueryObjectModelFactory.createQuery(javax.jcr.query.qom.Source, javax.jcr.query.qom.Constraint, javax.jcr.query.qom.Ordering[], javax.jcr.query.qom.Column[])), and the parameters given fail that test
RepositoryException - if the operation otherwise fails

subquery

Subquery subquery(QueryCommand subqueryCommand)
                  throws InvalidQueryException,
                         RepositoryException
Creates a subquery that can be used as a StaticOperand in another query.

Parameters:
subqueryCommand - the query command that is to be used as the subquery
Returns:
the constraint; non-null
Throws:
InvalidQueryException - if a particular validity test is possible on this method, the implemention chooses to perform that test (and not leave it until later, on QueryObjectModelFactory.createQuery(javax.jcr.query.qom.Source, javax.jcr.query.qom.Constraint, javax.jcr.query.qom.Ordering[], javax.jcr.query.qom.Column[])), and the parameters given fail that test
RepositoryException - if the operation otherwise fails

add

ArithmeticOperand add(DynamicOperand left,
                      DynamicOperand right)
                      throws InvalidQueryException,
                             RepositoryException
Create an arithmetic dynamic operand that adds the numeric value of the two supplied operand(s).

Parameters:
left - the left-hand-side operand; not null
right - the right-hand-side operand; not null
Returns:
the dynamic operand; non-null
Throws:
InvalidQueryException - if a particular validity test is possible on this method, the implemention chooses to perform that test (and not leave it until later, on QueryObjectModelFactory.createQuery(javax.jcr.query.qom.Source, javax.jcr.query.qom.Constraint, javax.jcr.query.qom.Ordering[], javax.jcr.query.qom.Column[])), and the parameters given fail that test
RepositoryException - if the operation otherwise fails

subtract

ArithmeticOperand subtract(DynamicOperand left,
                           DynamicOperand right)
                           throws InvalidQueryException,
                                  RepositoryException
Create an arithmetic dynamic operand that subtracts the numeric value of the second operand from the numeric value of the first.

Parameters:
left - the left-hand-side operand; not null
right - the right-hand-side operand; not null
Returns:
the dynamic operand; non-null
Throws:
InvalidQueryException - if a particular validity test is possible on this method, the implemention chooses to perform that test (and not leave it until later, on QueryObjectModelFactory.createQuery(javax.jcr.query.qom.Source, javax.jcr.query.qom.Constraint, javax.jcr.query.qom.Ordering[], javax.jcr.query.qom.Column[])), and the parameters given fail that test
RepositoryException - if the operation otherwise fails

multiply

ArithmeticOperand multiply(DynamicOperand left,
                           DynamicOperand right)
                           throws InvalidQueryException,
                                  RepositoryException
Create an arithmetic dynamic operand that multplies the numeric value of the first operand by the numeric value of the second.

Parameters:
left - the left-hand-side operand; not null
right - the right-hand-side operand; not null
Returns:
the dynamic operand; non-null
Throws:
InvalidQueryException - if a particular validity test is possible on this method, the implemention chooses to perform that test (and not leave it until later, on QueryObjectModelFactory.createQuery(javax.jcr.query.qom.Source, javax.jcr.query.qom.Constraint, javax.jcr.query.qom.Ordering[], javax.jcr.query.qom.Column[])), and the parameters given fail that test
RepositoryException - if the operation otherwise fails

divide

ArithmeticOperand divide(DynamicOperand left,
                         DynamicOperand right)
                         throws InvalidQueryException,
                                RepositoryException
Create an arithmetic dynamic operand that divides the numeric value of the first operand by the numeric value of the second.

Parameters:
left - the left-hand-side operand; not null
right - the right-hand-side operand; not null
Returns:
the dynamic operand; non-null
Throws:
InvalidQueryException - if a particular validity test is possible on this method, the implemention chooses to perform that test (and not leave it until later, on QueryObjectModelFactory.createQuery(javax.jcr.query.qom.Source, javax.jcr.query.qom.Constraint, javax.jcr.query.qom.Ordering[], javax.jcr.query.qom.Column[])), and the parameters given fail that test
RepositoryException - if the operation otherwise fails

referenceValue

ReferenceValue referenceValue(String selectorName)
                              throws InvalidQueryException,
                                     RepositoryException
Creates a dynamic operand that evaluates to the REFERENCE value of the any property on the specified selector.

The query is invalid if:

Parameters:
selectorName - the selector name; non-null
Returns:
the operand; non-null
Throws:
InvalidQueryException - if a particular validity test is possible on this method, the implemention chooses to perform that test (and not leave it until later, on QueryObjectModelFactory.createQuery(javax.jcr.query.qom.Source, javax.jcr.query.qom.Constraint, javax.jcr.query.qom.Ordering[], javax.jcr.query.qom.Column[])), and the parameters given fail that test
RepositoryException - if the operation otherwise fails

referenceValue

ReferenceValue referenceValue(String selectorName,
                              String propertyName)
                              throws InvalidQueryException,
                                     RepositoryException
Creates a dynamic operand that evaluates to the REFERENCE value of the specified property on the specified selector.

The query is invalid if:

Parameters:
selectorName - the selector name; non-null
propertyName - the reference property name; non-null
Returns:
the operand; non-null
Throws:
InvalidQueryException - if a particular validity test is possible on this method, the implemention chooses to perform that test (and not leave it until later, on QueryObjectModelFactory.createQuery(javax.jcr.query.qom.Source, javax.jcr.query.qom.Constraint, javax.jcr.query.qom.Ordering[], javax.jcr.query.qom.Column[])), and the parameters given fail that test
RepositoryException - if the operation otherwise fails


Copyright © 2008-2011 JBoss, a division of Red Hat. All Rights Reserved.