org.castor.cpa.query.object
Class SelectQueryImpl

java.lang.Object
  extended by org.castor.cpa.query.object.AbstractQueryObject
      extended by org.castor.cpa.query.object.SelectQueryImpl
All Implemented Interfaces:
QueryObject, SelectQuery

public final class SelectQueryImpl
extends AbstractQueryObject
implements SelectQuery

Final class that implements SelectQuery.

Since:
1.3
Version:
$Revision: 7121 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
Author:
Udai Gupta, Ralf Joachim

Constructor Summary
SelectQueryImpl()
           
 
Method Summary
 void addProjection(Field field)
          Adds the projection.
 void addProjection(Field field, java.lang.String alias)
          
 void addSchema(Schema schema)
          Adds the schema.
 Literal newBoolean(boolean value)
          New boolean.
 Literal newEnum(java.lang.Enum<?> identifier)
          New enum.
 Literal newNumeric(java.math.BigDecimal value)
          New numeric.
 Literal newNumeric(double value)
          New numeric.
 Literal newNumeric(long value)
          New numeric.
 Order newOrder(Field field)
          New order.
 Order newOrder(Field field, OrderDirection direction)
          New order.
 Parameter newParameter(int position)
          Factory method to create new Parameter.
 Parameter newParameter(java.lang.String name)
          New parameter.
 Schema newSchema(java.lang.Class<?> type, java.lang.String identifier)
          Factory method to create new Schema.
 Schema newSchema(java.lang.String name, java.lang.String identifier)
          Factory method to create new Schema.
 Literal newString(java.lang.String value)
          New string.
 Expression newTemporal(TemporalType temporalType)
          New temporal.
 Expression newTemporal(TemporalType temporalType, java.util.Calendar value)
          New temporal.
 Expression newTemporal(TemporalType temporalType, java.util.Date value)
          New temporal.
 void setDistinct(boolean distinct)
          Sets the distinct.
 void setLimit(int limit)
          Sets the limit.
 void setLimit(int limit, int offset)
          Sets the limit.
 void setLimit(Parameter limit)
          Sets the limit.
 void setLimit(Parameter limit, Parameter offset)
          Sets the limit.
 void setOrder(Order order)
          Sets the order.
 void setWhere(Condition condition)
          Sets the where.
 java.lang.StringBuilder toString(java.lang.StringBuilder sb)
          Append a string representation of the object to the given StringBuilder.
 
Methods inherited from class org.castor.cpa.query.object.AbstractQueryObject
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SelectQueryImpl

public SelectQueryImpl()
Method Detail

newSchema

public Schema newSchema(java.lang.String name,
                        java.lang.String identifier)
Factory method to create new Schema.

Specified by:
newSchema in interface SelectQuery
Parameters:
name - the schema
identifier - the identifier
Returns:
the schema

newSchema

public Schema newSchema(java.lang.Class<?> type,
                        java.lang.String identifier)
Factory method to create new Schema.

Specified by:
newSchema in interface SelectQuery
Parameters:
type - the schema
identifier - the identifier
Returns:
the schema

newParameter

public Parameter newParameter(int position)
Factory method to create new Parameter.

Specified by:
newParameter in interface SelectQuery
Parameters:
position - the int
Returns:
the parameter

newParameter

public Parameter newParameter(java.lang.String name)
New parameter.

Specified by:
newParameter in interface SelectQuery
Parameters:
name - the name
Returns:
the parameter

newBoolean

public Literal newBoolean(boolean value)
New boolean.

Specified by:
newBoolean in interface SelectQuery
Parameters:
value - the value
Returns:
the literal

newNumeric

public Literal newNumeric(long value)
New numeric.

Specified by:
newNumeric in interface SelectQuery
Parameters:
value - the value
Returns:
the literal

newNumeric

public Literal newNumeric(double value)
New numeric.

Specified by:
newNumeric in interface SelectQuery
Parameters:
value - the value
Returns:
the literal

newNumeric

public Literal newNumeric(java.math.BigDecimal value)
New numeric.

Specified by:
newNumeric in interface SelectQuery
Parameters:
value - the value
Returns:
the literal

newString

public Literal newString(java.lang.String value)
New string.

Specified by:
newString in interface SelectQuery
Parameters:
value - the value
Returns:
the literal

newEnum

public Literal newEnum(java.lang.Enum<?> identifier)
New enum.

Specified by:
newEnum in interface SelectQuery
Parameters:
identifier - the identifier
Returns:
the literal

newOrder

public Order newOrder(Field field)
New order.

Specified by:
newOrder in interface SelectQuery
Parameters:
field - the field
Returns:
the order

newOrder

public Order newOrder(Field field,
                      OrderDirection direction)
New order.

Specified by:
newOrder in interface SelectQuery
Parameters:
field - the field
direction - the direction
Returns:
the order

newTemporal

public Expression newTemporal(TemporalType temporalType)
New temporal.

Specified by:
newTemporal in interface SelectQuery
Parameters:
temporalType - the temporal type
Returns:
the expression

newTemporal

public Expression newTemporal(TemporalType temporalType,
                              java.util.Date value)
New temporal.

Specified by:
newTemporal in interface SelectQuery
Parameters:
temporalType - the temporal type
value - the value
Returns:
the expression

newTemporal

public Expression newTemporal(TemporalType temporalType,
                              java.util.Calendar value)
New temporal.

Specified by:
newTemporal in interface SelectQuery
Parameters:
temporalType - the temporal type
value - the value
Returns:
the expression

setDistinct

public void setDistinct(boolean distinct)
Sets the distinct.

Specified by:
setDistinct in interface SelectQuery
Parameters:
distinct - the new distinct

addProjection

public void addProjection(Field field)
Adds the projection.

Specified by:
addProjection in interface SelectQuery
Parameters:
field - the field

addProjection

public void addProjection(Field field,
                          java.lang.String alias)


addSchema

public void addSchema(Schema schema)
Adds the schema.

Specified by:
addSchema in interface SelectQuery
Parameters:
schema - the schema

setWhere

public void setWhere(Condition condition)
Sets the where.

Specified by:
setWhere in interface SelectQuery
Parameters:
condition - the new where

setOrder

public void setOrder(Order order)
Sets the order.

Specified by:
setOrder in interface SelectQuery
Parameters:
order - the new order

setLimit

public void setLimit(int limit)
Sets the limit.

Specified by:
setLimit in interface SelectQuery
Parameters:
limit - the new limit

setLimit

public void setLimit(Parameter limit)
Sets the limit.

Specified by:
setLimit in interface SelectQuery
Parameters:
limit - the new limit

setLimit

public void setLimit(int limit,
                     int offset)
Sets the limit.

Specified by:
setLimit in interface SelectQuery
Parameters:
limit - the limit
offset - the offset

setLimit

public void setLimit(Parameter limit,
                     Parameter offset)
Sets the limit.

Specified by:
setLimit in interface SelectQuery
Parameters:
limit - the limit
offset - the offset

toString

public java.lang.StringBuilder toString(java.lang.StringBuilder sb)
Append a string representation of the object to the given StringBuilder. In general, the toString method for query objects appends a string that textually represents this object. The result should be a query string that complies to EJB QL specification as long as the query object represents a syntay element of it. It is required that all subclasses override this method. The toString method defined at class Object is overwritten and calls this method.

Specified by:
toString in interface QueryObject
Parameters:
sb - StringBuilder to append the string representation of this object to.
Returns:
Same instance of StringBuilder given as parameter.


Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com