org.apache.cayenne.query

## Class IndirectQuery

- java.lang.Object
- - org.apache.cayenne.query.IndirectQuery

- All Implemented Interfaces:
    Serializable, Query
  Direct Known Subclasses:
    AbstractMappedQuery, FluentSelect, NamedQuery, ObjectIdQuery, ProcedureCall, RelationshipQuery, SelectById, SQLExec, SQLSelect

      public abstract class IndirectQuery
      extends Object
      implements Query

  A base superclass for queries that resolve into some other queries during the routing phase. Provides caching of a replacement query.
  Since:
    1.2
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected DataMap` | `dataMap`
    `protected EntityResolver` | `lastResolver`
    `protected String` | `name`
    `protected Query` | `replacementQuery`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IndirectQuery()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract Query` | `createReplacementQuery(EntityResolver resolver)` Creates a substitute query.
    `SQLAction` | `createSQLAction(SQLActionVisitor visitor)` Throws an exception as indirect query should not be executed directly.
    `DataMap` | `getDataMap()` Deprecated.
    `QueryMetadata` | `getMetaData(EntityResolver resolver)` Returns the metadata obtained from the replacement query.
    `String` | `getName()` Deprecated.
    `protected Query` | `getReplacementQuery(EntityResolver resolver)` Returns a replacement query, creating it on demand and caching it for reuse.
    `void` | `route(QueryRouter router, EntityResolver resolver, Query substitutedQuery)` Delegates routing to a replacement query.
    `void` | `setDataMap(DataMap dataMap)` Deprecated.
    `void` | `setName(String name)` Deprecated.

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

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

- - ### Field Detail

    - #### name

          protected String name

    - #### dataMap

          protected DataMap dataMap

      Since:
        3.1

    - #### replacementQuery

          protected transient Query replacementQuery

    - #### lastResolver

          protected transient EntityResolver lastResolver

  - ### Constructor Detail

    - #### IndirectQuery

          public IndirectQuery()

  - ### Method Detail

    - #### getDataMap

          @Deprecated
          public DataMap getDataMap()

      Deprecated.
      Specified by:
        `getDataMap` in interface `Query`
      Since:
        3.1

    - #### setDataMap

          @Deprecated
          public void setDataMap(DataMap dataMap)

      Deprecated.
      Since:
        3.1

    - #### getMetaData

          public QueryMetadata getMetaData(EntityResolver resolver)

      Returns the metadata obtained from the replacement query.
      Specified by:
        `getMetaData` in interface `Query`

    - #### getName

          @Deprecated
          public String getName()

      Deprecated.
      Description copied from interface: `Query`
      Returns a symbolic name of the query. The name is normally used as a key to find queries stored in the DataMap.
      Specified by:
        `getName` in interface `Query`

    - #### setName

          @Deprecated
          public void setName(String name)

      Deprecated.

    - #### route

          public void route(QueryRouter router,
                            EntityResolver resolver,
                            Query substitutedQuery)

      Delegates routing to a replacement query.
      Specified by:
        `route` in interface `Query`

    - #### createReplacementQuery

          protected abstract Query createReplacementQuery(EntityResolver resolver)

      Creates a substitute query. An implementor is free to provide an arbitrary replacement query.

    - #### getReplacementQuery

          protected Query getReplacementQuery(EntityResolver resolver)

      Returns a replacement query, creating it on demand and caching it for reuse.

    - #### createSQLAction

          public SQLAction createSQLAction(SQLActionVisitor visitor)

      Throws an exception as indirect query should not be executed directly.
      Specified by:
        `createSQLAction` in interface `Query`

Copyright © 2001–2018 Apache Cayenne. All rights reserved.