Package org.apache.cayenne.util

## Class ObjectContextQueryAction

- java.lang.Object
- - org.apache.cayenne.util.ObjectContextQueryAction

-     public abstract class ObjectContextQueryAction
      extends Object

  A helper class that implements `DataChannel.onQuery(ObjectContext, Query)` logic on behalf of an ObjectContext.

  Intended for internal use only.

  Since:
    1.2

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected ObjectContext` | `actingContext` |
    `protected static boolean` | `DONE` |
    `protected QueryMetadata` | `metadata` |
    `protected Query` | `query` |
    `protected boolean` | `queryOriginator` |
    `protected QueryResponse` | `response` |
    `protected ObjectContext` | `targetContext` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ObjectContextQueryAction​(ObjectContext actingContext, ObjectContext targetContext, Query query)` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `QueryResponse` | `execute()` | Worker method that performs internal query.
    `protected QueryCacheEntryFactory` | `getCacheObjectFactory()` |
    `protected QueryCache` | `getQueryCache()` |
    `protected boolean` | `interceptInternalQuery()` |
    `protected boolean` | `interceptLocalCache()` |
    `protected void` | `interceptObjectConversion()` | Transfers fetched objects into the target context if it is different from "acting" context.
    `protected boolean` | `interceptOIDQuery()` |
    `protected abstract boolean` | `interceptPaginatedQuery()` |
    `protected abstract boolean` | `interceptRefreshQuery()` |
    `protected boolean` | `interceptRelationshipQuery()` |
    `protected Object` | `polymorphicObjectFromCache​(ObjectId superOid)` |
    `protected void` | `runQuery()` | Fetches data from the channel.

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

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

- - ### Field Detail

    - #### DONE

          protected static final boolean DONE

      See Also:
        Constant Field Values

    - #### targetContext

          protected ObjectContext targetContext

    - #### actingContext

          protected ObjectContext actingContext

    - #### query

          protected Query query

    - #### metadata

          protected QueryMetadata metadata

    - #### queryOriginator

          protected boolean queryOriginator

    - #### response

          protected transient QueryResponse response

  - ### Constructor Detail

    - #### ObjectContextQueryAction

          public ObjectContextQueryAction​(ObjectContext actingContext,
                                          ObjectContext targetContext,
                                          Query query)

  - ### Method Detail

    - #### execute

          public QueryResponse execute()

      Worker method that performs internal query.

    - #### interceptObjectConversion

          protected void interceptObjectConversion()

      Transfers fetched objects into the target context if it is different from "acting" context. Note that when this method is invoked, result objects are already registered with acting context by the parent channel.

    - #### interceptInternalQuery

          protected boolean interceptInternalQuery()

    - #### interceptOIDQuery

          protected boolean interceptOIDQuery()

    - #### polymorphicObjectFromCache

          protected Object polymorphicObjectFromCache​(ObjectId superOid)

    - #### interceptRelationshipQuery

          protected boolean interceptRelationshipQuery()

    - #### interceptPaginatedQuery

          protected abstract boolean interceptPaginatedQuery()

      Since:
        3.0

    - #### interceptRefreshQuery

          protected abstract boolean interceptRefreshQuery()

      Since:
        3.0

    - #### interceptLocalCache

          protected boolean interceptLocalCache()

      Since:
        3.0

    - #### getQueryCache

          protected QueryCache getQueryCache()

      Since:
        3.0

    - #### getCacheObjectFactory

          protected QueryCacheEntryFactory getCacheObjectFactory()

      Since:
        3.0

    - #### runQuery

          protected void runQuery()

      Fetches data from the channel.