org.apache.cayenne.query
Class IndirectQuery

java.lang.Object
  extended by org.apache.cayenne.query.IndirectQuery
All Implemented Interfaces:
java.io.Serializable, Query
Direct Known Subclasses:
NamedQuery, ObjectIdQuery, RelationshipQuery

public abstract class IndirectQuery
extends java.lang.Object
implements Query

A convenience superclass of the queries that resolve into some other queries during the routing phase. Provides caching of a replacement query.

Since:
1.2
Author:
Andrus Adamchik
See Also:
Serialized Form

Field Summary
protected  EntityResolver lastResolver
           
protected  java.lang.String name
           
protected  Query replacementQuery
           
 
Constructor Summary
IndirectQuery()
           
 
Method Summary
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.
 QueryMetadata getMetaData(EntityResolver resolver)
          Returns the metadata obtained from the replacement query.
 java.lang.String getName()
          Returns a symbolic name of the query.
protected  Query getReplacementQuery(EntityResolver resolver)
          Returns a replacement query, creating it on demand and caching it for reuse.
 java.lang.Object getRoot()
          Deprecated. since 1.2
 void route(QueryRouter router, EntityResolver resolver, Query substitutedQuery)
          Delegates routing to a replacement query.
 void setName(java.lang.String name)
          Sets a symbolic name of the query.
 void setRoot(java.lang.Object root)
          Deprecated. since 1.2
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

replacementQuery

protected transient Query replacementQuery

lastResolver

protected transient EntityResolver lastResolver
Constructor Detail

IndirectQuery

public IndirectQuery()
Method Detail

getMetaData

public QueryMetadata getMetaData(EntityResolver resolver)
Returns the metadata obtained from the replacement query.

Specified by:
getMetaData in interface Query

getName

public java.lang.String getName()
Description copied from interface: Query
Returns a symbolic name of the query. The name may be used as a key to find queries stored in the DataMap. Some query implementors reuse the name as a QueryMetadata cache key. Generally the name can be null.

Specified by:
getName in interface Query

setName

public void setName(java.lang.String name)
Description copied from interface: Query
Sets a symbolic name of the query.

Specified by:
setName in interface Query

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

getRoot

public java.lang.Object getRoot()
Deprecated. since 1.2

This implementation throws an exception.

Specified by:
getRoot in interface Query

setRoot

public void setRoot(java.lang.Object root)
Deprecated. since 1.2

Throws an exception.

Specified by:
setRoot in interface Query


Copyright © 2001-2006 Apache.org All Rights Reserved.