org.apache.cayenne.query
Class RefreshQuery

java.lang.Object
  extended by org.apache.cayenne.query.RefreshQuery
All Implemented Interfaces:
Serializable, Query

public class RefreshQuery
extends Object
implements Query

A query that allows to explicitly clear both object and list caches either via refetch (eager refresh) or invalidate (lazy refresh).

Since:
3.0
See Also:
Serialized Form

Field Summary
protected  String[] groupKeys
           
protected  Collection<?> objects
           
protected  Query query
           
 
Constructor Summary
RefreshQuery()
          Creates a RefreshQuery that does full refresh of all registered objects, cascading refresh all the way to the shared cache.
RefreshQuery(Collection<?> objects)
          Creates a RefreshQuery that refreshes a collection of objects, including invalidation of their relationships.
RefreshQuery(Persistent object)
          Creates a RefreshQuery that refreshes a single object, including invalidation of its relationships.
RefreshQuery(Query query)
          Creates a RefreshQuery that refreshes results of a query and individual objects in the result.
RefreshQuery(String... groupKeys)
          Creates a RefreshQuery that refreshes query results identified by group keys.
 
Method Summary
 SQLAction createSQLAction(SQLActionVisitor visitor)
          A callback method invoked by Cayenne during the final execution phase of the query run.
 String[] getGroupKeys()
           
 QueryMetadata getMetaData(EntityResolver resolver)
          Returns query runtime parameters.
 String getName()
          Returns a symbolic name of the query.
 Collection<?> getObjects()
           
 Query getQuery()
          Returns an internal query, overriding cache policy to force a refresh.
 boolean isRefreshAll()
           
 void route(QueryRouter router, EntityResolver resolver, Query substitutedQuery)
          A callback method invoked by Cayenne during the routing phase of the query execution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objects

protected Collection<?> objects

query

protected Query query

groupKeys

protected String[] groupKeys
Constructor Detail

RefreshQuery

public RefreshQuery()
Creates a RefreshQuery that does full refresh of all registered objects, cascading refresh all the way to the shared cache.


RefreshQuery

public RefreshQuery(Collection<?> objects)
Creates a RefreshQuery that refreshes a collection of objects, including invalidation of their relationships.


RefreshQuery

public RefreshQuery(Persistent object)
Creates a RefreshQuery that refreshes a single object, including invalidation of its relationships.


RefreshQuery

public RefreshQuery(Query query)
Creates a RefreshQuery that refreshes results of a query and individual objects in the result.


RefreshQuery

public RefreshQuery(String... groupKeys)
Creates a RefreshQuery that refreshes query results identified by group keys.

Method Detail

getMetaData

public QueryMetadata getMetaData(EntityResolver resolver)
Description copied from interface: Query
Returns query runtime parameters. The method is called at various stages of the execution by Cayenne access stack to retrieve query parameters. EntityResolver instance is passed to this method, meaning that the query doesn't need to store direct references to Cayenne mapping objects and can resolve them at runtime.

Specified by:
getMetaData in interface Query

getName

public 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

route

public void route(QueryRouter router,
                  EntityResolver resolver,
                  Query substitutedQuery)
Description copied from interface: Query
A callback method invoked by Cayenne during the routing phase of the query execution. Mapping of DataNodes is provided by QueryRouter. Query should use a QueryRouter.route(QueryEngine, Query, Query) callback method to route itself. Query can create one or more substitute queries or even provide its own QueryEngine to execute itself.

Specified by:
route in interface Query

createSQLAction

public SQLAction createSQLAction(SQLActionVisitor visitor)
Description copied from interface: Query
A callback method invoked by Cayenne during the final execution phase of the query run. A concrete query implementation is given a chance to decide how it should be handled. Implementors can pick an appropriate method of the SQLActionVisitor to handle itself, create a custom SQLAction of its own, or substitute itself with another query that should be used for SQLAction construction.

Specified by:
createSQLAction in interface Query

isRefreshAll

public boolean isRefreshAll()

getGroupKeys

public String[] getGroupKeys()

getObjects

public Collection<?> getObjects()

getQuery

public Query getQuery()
Returns an internal query, overriding cache policy to force a refresh. Returns null if no query was set.



Copyright © 2001-2011 Apache Cayenne. All Rights Reserved.