org.modeshape.jcr.query

## Class JcrQuery

- java.lang.Object
- - org.modeshape.jcr.query.JcrAbstractQuery
  - - org.modeshape.jcr.query.JcrQuery

- All Implemented Interfaces:
    Query
  Direct Known Subclasses:
    QueryObjectModel, SetQueryObjectModel

      @NotThreadSafe
      public class JcrQuery
      extends JcrAbstractQuery

  Implementation of `Query` that represents a `query command`.

- - ### Field Summary

    - ### Fields inherited from class org.modeshape.jcr.query.JcrAbstractQuery

      `context, language, statement`

    - ### Fields inherited from interface org.modeshape.jcr.api.query.Query

      `FULL_TEXT_SEARCH`

    - ### Fields inherited from interface javax.jcr.query.Query

      `JCR_JQOM, JCR_SQL2, SQL, XPATH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JcrQuery(JcrQueryContext context, String statement, String language, QueryCommand query, PlanHints hints, Path storedAtPath)` Creates a new JCR `Query` by specifying the query statement itself, the language in which the query is stated, the `QueryCommand` representation and, optionally, the node from which the query was loaded.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `bindValue(String varName, Value value)`
    `boolean` | `cancel()` Signal that the query, if currently `executing`, should be cancelled and stopped (with an exception).
    `QueryResult` | `execute()`
    `QueryResult` | `explain()` Generates a plan for the this query and returns a ``QueryResult`` object that contains no results (nodes or rows) but does have a query plan.
    `QueryCommand` | `getAbstractQueryModel()` Get the underlying and immutable Abstract Query Model representation of this query.
    `String` | `getAbstractQueryModelRepresentation()` Get the underlying and immutable Abstract Query Model representation of this query.
    `String[]` | `getBindVariableNames()`
    `void` | `includeSystemContent(boolean includeSystemContent)` Specify whether the system content should be included in the query results.
    `protected QueryCommand` | `query()`
    `void` | `setLimit(long limit)`
    `void` | `setOffset(long offset)`
    `String` | `toString()`
    `protected Set<String>` | `variableNames()`

    - ### Methods inherited from class org.modeshape.jcr.query.JcrAbstractQuery

      `checkForProblems, context, getLanguage, getStatement, getStoredQueryPath, pathFor, storeAsNode`

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

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

- - ### Constructor Detail

    - #### JcrQuery

          public JcrQuery(JcrQueryContext context,
                  String statement,
                  String language,
                  QueryCommand query,
                  PlanHints hints,
                  Path storedAtPath)

      Creates a new JCR `Query` by specifying the query statement itself, the language in which the query is stated, the `QueryCommand` representation and, optionally, the node from which the query was loaded. The language must be a string from among those returned by `QueryManager#getSupportedQueryLanguages()`.
      Parameters:
        `context` - the context that was used to create this query and that will be used to execute this query; may not be null
        `statement` - the original statement as supplied by the client; may not be null
        `language` - the language obtained from the `QueryParser`; may not be null
        `query` - the parsed query representation; may not be null
        `hints` - any hints that are to be used; may be null if there are no hints
        `storedAtPath` - the path at which this query was stored, or null if this is not a stored query

  - ### Method Detail

    - #### includeSystemContent

          public void includeSystemContent(boolean includeSystemContent)

      Description copied from interface: `Query`
      Specify whether the system content should be included in the query results.
      Parameters:
        `includeSystemContent` - true if the system content should be included, or false if it should be excluded

    - #### query

          protected QueryCommand query()

    - #### getAbstractQueryModel

          public QueryCommand getAbstractQueryModel()

      Get the underlying and immutable Abstract Query Model representation of this query.
      Returns:
        the AQM representation; never null

    - #### getAbstractQueryModelRepresentation

          public String getAbstractQueryModelRepresentation()

      Description copied from interface: `Query`
      Get the underlying and immutable Abstract Query Model representation of this query.
      Returns:
        the string representation of this query's abstract query model; never null

    - #### execute

          public QueryResult execute()
                              throws RepositoryException

      Throws:
        `RepositoryException`
      See Also:
        `Query.execute()`

    - #### explain

          public QueryResult explain()
                              throws RepositoryException

      Description copied from interface: `Query`
      Generates a plan for the this query and returns a ``QueryResult`` object that contains no results (nodes or rows) but does have a query plan.

      If this `Query` contains a variable (see `BindVariableValue`) which has not been bound to a value (see `Query.bindValue(java.lang.String, javax.jcr.Value)`) then this method throws an `InvalidQueryException`.

      Returns:
        a `QueryResult` object
      Throws:
        `InvalidQueryException` - if the query contains an unbound variable.
        `RepositoryException` - if another error occurs.
      See Also:
        `Query.execute()`

    - #### cancel

          public boolean cancel()

      Description copied from interface: `Query`
      Signal that the query, if currently `executing`, should be cancelled and stopped (with an exception). This method does not block until the query is actually stopped.
      Returns:
        true if the query was executing and will be cancelled, or false if the query was no longer running (because it had finished successfully or had already been cancelled) and could not be cancelled.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`
      See Also:
        `Object.toString()`

    - #### bindValue

          public void bindValue(String varName,
                       Value value)
                         throws IllegalArgumentException,
                                RepositoryException

      Throws:
        `IllegalArgumentException`
        `RepositoryException`

    - #### getBindVariableNames

          public String[] getBindVariableNames()

    - #### variableNames

          protected final Set<String> variableNames()

    - #### setLimit

          public void setLimit(long limit)

    - #### setOffset

          public void setOffset(long offset)

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