Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.objectstyle.cayenne.query
Class QueryChain

    java.lang.Object
      org.objectstyle.cayenne.query.QueryChain

All Implemented Interfaces:
  java.io.Serializable, Query

    public class QueryChain

extends java.lang.Object
implements Query

A Query decorator for a collection of other queries.

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

Field Summary
`protected java.util.Collection` | `chain`
`protected java.lang.String` | `name`

Constructor Summary
`QueryChain()` Creates an empty QueryChain.
`QueryChain(java.util.Collection queries)` Creates a new QueryChain with a collection of Queries.
`QueryChain(Query[] queries)` Creates a new QueryChain out of an array of queries.

Method Summary
`void` | `addQuery(Query query)` Adds a query to the chain.
`SQLAction` | `createSQLAction(SQLActionVisitor visitor)` Throws an exception as execution should've been delegated to the queries contained in the chain.
`QueryMetadata` | `getMetaData(EntityResolver resolver)` Returns default metadata.
`java.lang.String` | `getName()` Returns a symbolic name of the query.
`java.lang.Object` | `getRoot()` Deprecated. since 1.2
`boolean` | `isEmpty()`
`boolean` | `removeQuery(Query query)` Removes a query from the chain, returning true if the query was indeed present in the chain and was removed.
`void` | `route(QueryRouter router, EntityResolver resolver, Query substitutedQuery)` Delegates routing to each individual query in the chain.
`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

### chain

    protected java.util.Collection chain

### name

    protected java.lang.String name

Constructor Detail

### QueryChain

    public QueryChain()

  Creates an empty QueryChain.

### QueryChain

    public QueryChain(Query[] queries)

  Creates a new QueryChain out of an array of queries.

### QueryChain

    public QueryChain(java.util.Collection queries)

  Creates a new QueryChain with a collection of Queries.

Method Detail

### addQuery

    public void addQuery(Query query)

  Adds a query to the chain.

### removeQuery

    public boolean removeQuery(Query query)

  Removes a query from the chain, returning true if the query was indeed present in the chain and was removed.

### isEmpty

    public boolean isEmpty()

### route

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

  Delegates routing to each individual query in the chain. If there is no queries, this method does nothing.

  Specified by:
    `route` in interface `Query`

### createSQLAction

    public SQLAction createSQLAction(SQLActionVisitor visitor)

  Throws an exception as execution should've been delegated to the queries contained in the chain.

  Specified by:
    `createSQLAction` 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`

### getMetaData

    public QueryMetadata getMetaData(EntityResolver resolver)

  Returns default metadata.

  Specified by:
    `getMetaData` in interface `Query`

### getRoot

    public java.lang.Object getRoot()

  Deprecated. since 1.2

  Description copied from interface: `Query`
  Returns the root object of the query.

  Specified by:
    `getRoot` in interface `Query`

### setRoot

    public void setRoot(java.lang.Object root)

  Deprecated. since 1.2

  Description copied from interface: `Query`
  Sets the root of the query.

  Specified by:
    `setRoot` in interface `Query`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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