org.modeshape.jcr.query.model

## Class QueryObjectModelFactory

- java.lang.Object
- - org.modeshape.jcr.query.model.QueryObjectModelFactory

- All Implemented Interfaces:
    QueryObjectModelConstants, QueryObjectModelFactory

      public class QueryObjectModelFactory
      extends Object
      implements QueryObjectModelFactory

  An implementation of the JCR `QueryObjectModelFactory`. Note that this implementation constructs the query components but does not validate any of the parameters or the resulting query definition. All validation is performed when the query is `executed`.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `LANGUAGE`

    - ### 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`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `QueryObjectModelFactory(JcrQueryContext context)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ArithmeticOperand` | `add(DynamicOperand left, DynamicOperand right)` Create an arithmetic dynamic operand that adds the numeric value of the two supplied operand(s).
    `And` | `and(Constraint constraint1, Constraint constraint2)`
    `ArithmeticOperand` | `arithmeticOperand(DynamicOperand left, ArithmeticOperator operator, DynamicOperand right)`
    `Ordering` | `ascending(DynamicOperand operand)` Orders by the value of the specified operand, in ascending order.
    `Ordering` | `ascendingNullsFirst(DynamicOperand operand)` Orders by the value of the specified operand, in ascending order.
    `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.
    `BindVariableValue` | `bindVariable(String bindVariableName)`
    `ChildCount` | `childCount(String selectorName)` Evaluates to a `LONG` value equal to the number of children for each of the node(s) in the specified selector.
    `ChildNode` | `childNode(String selectorName, String path)`
    `ChildNodeJoinCondition` | `childNodeJoinCondition(String childSelectorName, String parentSelectorName)`
    `Column` | `column(String selectorName, String propertyName, String columnName)`
    `Comparison` | `comparison(DynamicOperand operand1, String operator, StaticOperand operand2)`
    `QueryObjectModel` | `createQuery(SelectQuery command)` Creates a query for a select query command.
    `SetQueryObjectModel` | `createQuery(SetQuery command)` Creates a set query.
    `QueryObjectModel` | `createQuery(Source source, Constraint constraint, Ordering[] orderings, Column[] columns)`
    `DescendantNode` | `descendantNode(String selectorName, String path)`
    `DescendantNodeJoinCondition` | `descendantNodeJoinCondition(String descendantSelectorName, String ancestorSelectorName)`
    `Ordering` | `descending(DynamicOperand operand)` Orders by the value of the specified operand, in descending order.
    `Ordering` | `descendingNullsLast(DynamicOperand operand)` Orders by the value of the specified operand, in descending order.
    `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.
    `EquiJoinCondition` | `equiJoinCondition(String selector1Name, String property1Name, String selector2Name, String property2Name)`
    `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.
    `FullTextSearch` | `fullTextSearch(String selectorName, String propertyName, StaticOperand fullTextSearchExpression)`
    `FullTextSearchScore` | `fullTextSearchScore(String selectorName)`
    `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.
    `Join` | `join(Source left, Source right, String joinType, JoinCondition joinCondition)`
    `Length` | `length(PropertyValue propertyValue)`
    `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.
    `LiteralValue` | `literal(Value literalValue)`
    `LowerCase` | `lowerCase(DynamicOperand operand)`
    `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.
    `NodeLocalName` | `nodeLocalName(String selectorName)`
    `NodeName` | `nodeName(String selectorName)`
    `NodePath` | `nodePath(String selectorName)` Evaluates to a `PATH` value equal to the prefix-qualified path of a node in the specified selector.
    `Not` | `not(Constraint constraint)`
    `Or` | `or(Constraint constraint1, Constraint constraint2)`
    `PropertyExistence` | `propertyExistence(String selectorName, String propertyName)`
    `PropertyValue` | `propertyValue(String selectorName, String propertyName)`
    `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.
    `Relike` | `relike(StaticOperand operand1, PropertyValue operand2)` Filters node-tuples based on reverse like operation.
    `SameNode` | `sameNode(String selectorName, String path)`
    `SameNodeJoinCondition` | `sameNodeJoinCondition(String selector1Name, String selector2Name, String selector2Path)`
    `SelectQuery` | `select(Source source, Constraint constraint, Ordering[] orderings, Column[] columns, Limit limit, boolean distinct)` Creates a query with one or more selectors.
    `NamedSelector` | `selector(String nodeTypeName, String selectorName)`
    `protected SelectorName` | `selectorName(String name)`
    `SetQuery` | `setQuery(QueryCommand left, SetQuery.Operation operation, QueryCommand right, Ordering[] orderings, Limit limit, boolean all)`
    `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.
    `UpperCase` | `upperCase(DynamicOperand operand)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### LANGUAGE

          public static final String LANGUAGE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### QueryObjectModelFactory

          public QueryObjectModelFactory(JcrQueryContext context)

  - ### Method Detail

    - #### selectorName

          protected SelectorName selectorName(String name)

    - #### createQuery

          public QueryObjectModel createQuery(Source source,
                                     Constraint constraint,
                                     Ordering[] orderings,
                                     Column[] columns)

      Specified by:
        `createQuery` in interface `QueryObjectModelFactory`

    - #### createQuery

          public SetQueryObjectModel createQuery(SetQuery command)

      Description copied from interface: `QueryObjectModelFactory`
      Creates a set query.
      Parameters:
        `command` - set query; non-null
      Returns:
        the executable query; non-null

    - #### createQuery

          public QueryObjectModel createQuery(SelectQuery command)

      Description copied from interface: `QueryObjectModelFactory`
      Creates a query for a select query command.
      Parameters:
        `command` - select query; non-null
      Returns:
        the executable query; non-null

    - #### select

          public SelectQuery select(Source source,
                           Constraint constraint,
                           Ordering[] orderings,
                           Column[] columns,
                           Limit limit,
                           boolean distinct)

      Description copied from interface: `QueryObjectModelFactory`
      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
        `distinct` - true if the query should return distinct values; or false if no duplicate removal should be performed
      Returns:
        the select query; non-null

    - #### union

          public SetQuery union(QueryCommand left,
                       QueryCommand right,
                       Ordering[] orderings,
                       Limit limit,
                       boolean all)

      Description copied from interface: `QueryObjectModelFactory`
      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

    - #### intersect

          public SetQuery intersect(QueryCommand left,
                           QueryCommand right,
                           Ordering[] orderings,
                           Limit limit,
                           boolean all)

      Description copied from interface: `QueryObjectModelFactory`
      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

    - #### except

          public SetQuery except(QueryCommand left,
                        QueryCommand right,
                        Ordering[] orderings,
                        Limit limit,
                        boolean all)

      Description copied from interface: `QueryObjectModelFactory`
      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

    - #### setQuery

          public SetQuery setQuery(QueryCommand left,
                          SetQuery.Operation operation,
                          QueryCommand right,
                          Ordering[] orderings,
                          Limit limit,
                          boolean all)

    - #### selector

          public NamedSelector selector(String nodeTypeName,
                               String selectorName)

      Specified by:
        `selector` in interface `QueryObjectModelFactory`

    - #### column

          public Column column(String selectorName,
                      String propertyName,
                      String columnName)

      Specified by:
        `column` in interface `QueryObjectModelFactory`

    - #### ascending

          public Ordering ascending(DynamicOperand operand)

      Description copied from interface: `QueryObjectModelFactory`
      Orders by the value of the specified operand, in ascending order. The query is invalid if `operand` does not evaluate to a scalar value. Null values are returned last; use `QueryObjectModelFactory.ascendingNullsFirst(DynamicOperand)` for other behavior.
      Specified by:
        `ascending` in interface `QueryObjectModelFactory`
      Parameters:
        `operand` - the operand by which to order; non-null
      Returns:
        the ordering

    - #### ascendingNullsFirst

          public Ordering ascendingNullsFirst(DynamicOperand operand)

      Description copied from interface: `QueryObjectModelFactory`
      Orders by the value of the specified operand, in ascending order. The query is invalid if `operand` does not evaluate to a scalar value.
      Parameters:
        `operand` - the operand by which to order; non-null
      Returns:
        the ordering

    - #### descending

          public Ordering descending(DynamicOperand operand)

      Description copied from interface: `QueryObjectModelFactory`
      Orders by the value of the specified operand, in descending order. The query is invalid if `operand` does not evaluate to a scalar value. Null values are returned first; use `QueryObjectModelFactory.descendingNullsLast(DynamicOperand)` for other behavior.
      Specified by:
        `descending` in interface `QueryObjectModelFactory`
      Parameters:
        `operand` - the operand by which to order; non-null
      Returns:
        the ordering

    - #### descendingNullsLast

          public Ordering descendingNullsLast(DynamicOperand operand)

      Description copied from interface: `QueryObjectModelFactory`
      Orders by the value of the specified operand, in descending order. The query is invalid if `operand` does not evaluate to a scalar value.
      Parameters:
        `operand` - the operand by which to order; non-null
      Returns:
        the ordering

    - #### and

          public And and(Constraint constraint1,
                Constraint constraint2)

      Specified by:
        `and` in interface `QueryObjectModelFactory`

    - #### bindVariable

          public BindVariableValue bindVariable(String bindVariableName)

      Specified by:
        `bindVariable` in interface `QueryObjectModelFactory`

    - #### childNode

          public ChildNode childNode(String selectorName,
                            String path)

      Specified by:
        `childNode` in interface `QueryObjectModelFactory`

    - #### childNodeJoinCondition

          public ChildNodeJoinCondition childNodeJoinCondition(String childSelectorName,
                                                      String parentSelectorName)

      Specified by:
        `childNodeJoinCondition` in interface `QueryObjectModelFactory`

    - #### comparison

          public Comparison comparison(DynamicOperand operand1,
                              String operator,
                              StaticOperand operand2)

      Specified by:
        `comparison` in interface `QueryObjectModelFactory`

    - #### descendantNode

          public DescendantNode descendantNode(String selectorName,
                                      String path)

      Specified by:
        `descendantNode` in interface `QueryObjectModelFactory`

    - #### descendantNodeJoinCondition

          public DescendantNodeJoinCondition descendantNodeJoinCondition(String descendantSelectorName,
                                                                String ancestorSelectorName)

      Specified by:
        `descendantNodeJoinCondition` in interface `QueryObjectModelFactory`

    - #### equiJoinCondition

          public EquiJoinCondition equiJoinCondition(String selector1Name,
                                            String property1Name,
                                            String selector2Name,
                                            String property2Name)

      Specified by:
        `equiJoinCondition` in interface `QueryObjectModelFactory`

    - #### fullTextSearch

          public FullTextSearch fullTextSearch(String selectorName,
                                      String propertyName,
                                      StaticOperand fullTextSearchExpression)
                                        throws RepositoryException

      Specified by:
        `fullTextSearch` in interface `QueryObjectModelFactory`
      Throws:
        `RepositoryException`

    - #### fullTextSearchScore

          public FullTextSearchScore fullTextSearchScore(String selectorName)

      Specified by:
        `fullTextSearchScore` in interface `QueryObjectModelFactory`

    - #### join

          public Join join(Source left,
                  Source right,
                  String joinType,
                  JoinCondition joinCondition)

      Specified by:
        `join` in interface `QueryObjectModelFactory`

    - #### length

          public Length length(PropertyValue propertyValue)

      Specified by:
        `length` in interface `QueryObjectModelFactory`

    - #### literal

          public LiteralValue literal(Value literalValue)
                               throws RepositoryException

      Specified by:
        `literal` in interface `QueryObjectModelFactory`
      Throws:
        `RepositoryException`

    - #### lowerCase

          public LowerCase lowerCase(DynamicOperand operand)

      Specified by:
        `lowerCase` in interface `QueryObjectModelFactory`

    - #### nodeLocalName

          public NodeLocalName nodeLocalName(String selectorName)

      Specified by:
        `nodeLocalName` in interface `QueryObjectModelFactory`

    - #### nodeName

          public NodeName nodeName(String selectorName)

      Specified by:
        `nodeName` in interface `QueryObjectModelFactory`

    - #### not

          public Not not(Constraint constraint)

      Specified by:
        `not` in interface `QueryObjectModelFactory`

    - #### or

          public Or or(Constraint constraint1,
              Constraint constraint2)

      Specified by:
        `or` in interface `QueryObjectModelFactory`

    - #### propertyExistence

          public PropertyExistence propertyExistence(String selectorName,
                                            String propertyName)

      Specified by:
        `propertyExistence` in interface `QueryObjectModelFactory`

    - #### propertyValue

          public PropertyValue propertyValue(String selectorName,
                                    String propertyName)

      Specified by:
        `propertyValue` in interface `QueryObjectModelFactory`

    - #### sameNode

          public SameNode sameNode(String selectorName,
                          String path)

      Specified by:
        `sameNode` in interface `QueryObjectModelFactory`

    - #### sameNodeJoinCondition

          public SameNodeJoinCondition sameNodeJoinCondition(String selector1Name,
                                                    String selector2Name,
                                                    String selector2Path)

      Specified by:
        `sameNodeJoinCondition` in interface `QueryObjectModelFactory`

    - #### upperCase

          public UpperCase upperCase(DynamicOperand operand)

      Specified by:
        `upperCase` in interface `QueryObjectModelFactory`

    - #### nodePath

          public NodePath nodePath(String selectorName)

      Description copied from interface: `QueryObjectModelFactory`
      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

    - #### childCount

          public ChildCount childCount(String selectorName)

      Description copied from interface: `QueryObjectModelFactory`
      Evaluates to a `LONG` value equal to the number of children for each of the node(s) 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

    - #### nodeDepth

          public NodeDepth nodeDepth(String selectorName)

      Description copied from interface: `QueryObjectModelFactory`
      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

    - #### limit

          public Limit limit(int rowLimit,
                    int offset)

      Description copied from interface: `QueryObjectModelFactory`
      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

    - #### between

          public Between between(DynamicOperand operand,
                        StaticOperand lowerBound,
                        StaticOperand upperBound,
                        boolean includeLowerBound,
                        boolean includeUpperBound)

      Description copied from interface: `QueryObjectModelFactory`
      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

    - #### in

          public SetCriteria in(DynamicOperand operand,
                       StaticOperand... values)

      Description copied from interface: `QueryObjectModelFactory`
      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

    - #### subquery

          public Subquery subquery(QueryCommand subqueryCommand)

      Description copied from interface: `QueryObjectModelFactory`
      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

    - #### add

          public ArithmeticOperand add(DynamicOperand left,
                              DynamicOperand right)

      Description copied from interface: `QueryObjectModelFactory`
      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

    - #### subtract

          public ArithmeticOperand subtract(DynamicOperand left,
                                   DynamicOperand right)

      Description copied from interface: `QueryObjectModelFactory`
      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

    - #### multiply

          public ArithmeticOperand multiply(DynamicOperand left,
                                   DynamicOperand right)

      Description copied from interface: `QueryObjectModelFactory`
      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

    - #### divide

          public ArithmeticOperand divide(DynamicOperand left,
                                 DynamicOperand right)

      Description copied from interface: `QueryObjectModelFactory`
      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

    - #### arithmeticOperand

          public ArithmeticOperand arithmeticOperand(DynamicOperand left,
                                            ArithmeticOperator operator,
                                            DynamicOperand right)

    - #### referenceValue

          public ReferenceValue referenceValue(String selectorName)

      Description copied from interface: `QueryObjectModelFactory`
      Creates a dynamic operand that evaluates to the REFERENCE value of the any property on the specified selector.

      The query is invalid if:

      - `selector` is not the name of a selector in the query, or
      - `property` is not a syntactically valid JCR name.
      Parameters:
        `selectorName` - the selector name; non-null
      Returns:
        the operand; non-null

    - #### referenceValue

          public ReferenceValue referenceValue(String selectorName,
                                      String propertyName)

      Description copied from interface: `QueryObjectModelFactory`
      Creates a dynamic operand that evaluates to the REFERENCE value of the specified property on the specified selector.

      The query is invalid if:

      - `selector` is not the name of a selector in the query, or
      - `property` is not a syntactically valid JCR name.
      Parameters:
        `selectorName` - the selector name; non-null
        `propertyName` - the reference property name; non-null
      Returns:
        the operand; non-null

    - #### relike

          public Relike relike(StaticOperand operand1,
                      PropertyValue operand2)

      Description copied from interface: `QueryObjectModelFactory`
      Filters node-tuples based on reverse like operation.
      Parameters:
        `operand1` - the first operand; non-null
        `operand2` - the second operand; non-null
      Returns:
        the constraint; non-null

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