org.apache.cayenne.map
Class QueryBuilder

java.lang.Object
  extended by org.apache.cayenne.map.QueryBuilder

public abstract class QueryBuilder
extends java.lang.Object

A builder that constructs Cayenne queries from abstract configuration information defined in cayenne-data-map*.dtd. This abstract builder supports values declared in the DTD, allowing subclasses to define their own Query creation logic.

Since:
1.1
Author:
Andrei Adamchik

Field Summary
protected  java.util.Map adapterSql
           
static java.lang.String DATA_MAP_ROOT
           
protected  DataMap dataMap
           
static java.lang.String DB_ENTITY_ROOT
           
static java.lang.String JAVA_CLASS_ROOT
           
protected  java.lang.String name
           
static java.lang.String OBJ_ENTITY_ROOT
           
protected  java.util.List orderings
           
protected  java.util.List prefetches
           
static java.lang.String PROCEDURE_ROOT
           
protected  java.util.Map properties
           
protected  Expression qualifier
           
protected  java.util.List resultColumns
           
protected  java.lang.String resultEntity
           
protected  java.lang.String rootName
           
protected  java.lang.String rootType
           
protected  boolean selecting
          Deprecated. since 1.2 as "selecting" query property is no longer relevant.
protected  java.lang.String sql
           
 
Constructor Summary
QueryBuilder()
           
 
Method Summary
 void addOrdering(java.lang.String path, java.lang.String descending, java.lang.String ignoreCase)
           
 void addPrefetch(java.lang.String path)
           
 void addProperty(java.lang.String name, java.lang.String value)
           
 void addResultColumn(java.lang.String label, java.lang.String dbType, java.lang.String objectType)
          Deprecated. since 1.2 unused.
 void addSql(java.lang.String sql, java.lang.String adapterClass)
          Adds raw sql.
abstract  Query getQuery()
          Builds a Query object based on internal configuration information.
protected  java.lang.Object getRoot()
          Determines query root based on configuration info, falls back to a DataMap root if the data is invalid.
 void setName(java.lang.String name)
           
 void setQualifier(java.lang.String qualifier)
           
 void setResultEntity(java.lang.String resultEntity)
           
 void setResultType(java.lang.String resultType)
          Deprecated. since 1.2
 void setRoot(DataMap dataMap, java.lang.String rootType, java.lang.String rootName)
          Sets the information pertaining to the root of the query.
 void setSelecting(java.lang.String selecting)
          Deprecated. since 1.2 as "selecting" query property is no longer relevant.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OBJ_ENTITY_ROOT

public static final java.lang.String OBJ_ENTITY_ROOT
See Also:
Constant Field Values

DB_ENTITY_ROOT

public static final java.lang.String DB_ENTITY_ROOT
See Also:
Constant Field Values

PROCEDURE_ROOT

public static final java.lang.String PROCEDURE_ROOT
See Also:
Constant Field Values

DATA_MAP_ROOT

public static final java.lang.String DATA_MAP_ROOT
See Also:
Constant Field Values

JAVA_CLASS_ROOT

public static final java.lang.String JAVA_CLASS_ROOT
See Also:
Constant Field Values

name

protected java.lang.String name

properties

protected java.util.Map properties

resultColumns

protected java.util.List resultColumns

sql

protected java.lang.String sql

adapterSql

protected java.util.Map adapterSql

qualifier

protected Expression qualifier

orderings

protected java.util.List orderings

prefetches

protected java.util.List prefetches

dataMap

protected DataMap dataMap

rootType

protected java.lang.String rootType

rootName

protected java.lang.String rootName

selecting

protected boolean selecting
Deprecated. since 1.2 as "selecting" query property is no longer relevant.

resultEntity

protected java.lang.String resultEntity
Constructor Detail

QueryBuilder

public QueryBuilder()
Method Detail

getQuery

public abstract Query getQuery()
Builds a Query object based on internal configuration information.


setName

public void setName(java.lang.String name)

getRoot

protected java.lang.Object getRoot()
Determines query root based on configuration info, falls back to a DataMap root if the data is invalid.

Throws:
CayenneRuntimeException - if a valid root can't be established.

setSelecting

public void setSelecting(java.lang.String selecting)
Deprecated. since 1.2 as "selecting" query property is no longer relevant.


setResultType

public void setResultType(java.lang.String resultType)
Deprecated. since 1.2


setResultEntity

public void setResultEntity(java.lang.String resultEntity)

setRoot

public void setRoot(DataMap dataMap,
                    java.lang.String rootType,
                    java.lang.String rootName)
Sets the information pertaining to the root of the query.


addSql

public void addSql(java.lang.String sql,
                   java.lang.String adapterClass)
Adds raw sql. If adapterClass parameter is not null, sets the SQL string to be adapter-specific. Otherwise it is used as a default SQL string.


setQualifier

public void setQualifier(java.lang.String qualifier)

addProperty

public void addProperty(java.lang.String name,
                        java.lang.String value)

addResultColumn

public void addResultColumn(java.lang.String label,
                            java.lang.String dbType,
                            java.lang.String objectType)
Deprecated. since 1.2 unused.


addOrdering

public void addOrdering(java.lang.String path,
                        java.lang.String descending,
                        java.lang.String ignoreCase)

addPrefetch

public void addPrefetch(java.lang.String path)


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