to.etc.webapp.query
Class QCriteriaQueryBase<T>

java.lang.Object
  extended by to.etc.webapp.query.QRestrictor<T>
      extended by to.etc.webapp.query.QCriteriaQueryBase<T>
Direct Known Subclasses:
QCriteria, QSelection

public class QCriteriaQueryBase<T>
extends QRestrictor<T>

Base class representing most of the query structure, just not the public interface part.

Author:
Frits Jalvingh Created on Jun 21, 2009

Constructor Summary
protected QCriteriaQueryBase(java.lang.Class<T> clz)
           
protected QCriteriaQueryBase(ICriteriaTableDef<T> meta)
           
 
Method Summary
 QCriteriaQueryBase<T> add(QOrder r)
          Add an order clause to the list of sort items.
protected  void addColumn(QSelectionItem item, java.lang.String alias)
          Add a column selector to the selection list.
protected  void addPropertySelection(QSelectionFunction f, java.lang.String prop, java.lang.String alias)
          Add a simple property selector to the list.
 QCriteriaQueryBase<T> ascending(java.lang.String property)
          Add a property to do an ascending sort on.
protected  QCriteriaQueryBase<T> avg(java.lang.String property)
          Select the average value of a property in the set.
protected  QCriteriaQueryBase<T> avg(java.lang.String property, java.lang.String alias)
          Select the average value of a property in the set.
protected  QCriteriaQueryBase<T> count(java.lang.String property)
          Select a count over the result set.
protected  QCriteriaQueryBase<T> count(java.lang.String property, java.lang.String alias)
          Select a count over the result set.
protected  QCriteriaQueryBase<T> countDistinct(java.lang.String property)
          Select a count of the distinct values over the result set.
protected  QCriteriaQueryBase<T> countDistinct(java.lang.String property, java.lang.String alias)
          Select a count of the distinct values over the result set.
 QCriteriaQueryBase<T> descending(java.lang.String property)
          Add a property to do a descending sort on.
protected  QCriteriaQueryBase<T> distinct(java.lang.String property)
          Select of the distinct values over the result set.
protected  QCriteriaQueryBase<T> distinct(java.lang.String property, java.lang.String alias)
          Select of the distinct values over the result set.
 java.util.List<QSelectionColumn> getColumnList()
          Returns all selected columns.
 int getLimit()
          Returns the limit.
 java.lang.Object getOption(java.lang.String name)
          Get the value stored for a given option.
 java.util.List<QOrder> getOrder()
          Returns the order-by list.
 QOperatorNode getRestrictions()
           
 int getStart()
          Returns the start index set.
 int getTimeout()
           
 boolean hasOption(java.lang.String name)
          Returns T if the specified option is present.
 QCriteriaQueryBase<T> limit(int limit)
          Limit the #of rows to the specified count.
protected  QCriteriaQueryBase<T> max(java.lang.String property)
          Select the max of a property in the set.
protected  QCriteriaQueryBase<T> max(java.lang.String property, java.lang.String alias)
          Select the max of a property in the set.
protected  QCriteriaQueryBase<T> min(java.lang.String property)
          Select the minimal value of a property in the set.
protected  QCriteriaQueryBase<T> min(java.lang.String property, java.lang.String alias)
          Select the minimal value of a property in the set.
protected  QCriteriaQueryBase<T> selectProperty(java.lang.String property)
          Select a property value from the base property in the result set.
protected  QCriteriaQueryBase<T> selectProperty(java.lang.String property, java.lang.String alias)
          Select a property value from the base property in the result set.
 void setOption(java.lang.String name, java.lang.Object val)
          Set an option for the query or some of it's listeners.
 void setRestrictions(QOperatorNode restrictions)
           
 void setTimeout(int timeout)
          Set the query timeout, in seconds.
 QCriteriaQueryBase<T> start(int start)
          Start returning rows at the specified index in the result set (0-based).
protected  QCriteriaQueryBase<T> sum(java.lang.String property)
          Select the sum of a property in the set.
protected  QCriteriaQueryBase<T> sum(java.lang.String property, java.lang.String alias)
          Select the sum of a property in the set.
 
Methods inherited from class to.etc.webapp.query.QRestrictor
add, and, between, eq, eq, eq, exists, ge, ge, ge, getBaseClass, getMetaTable, getReturnClass, gt, gt, gt, hasRestrictions, ilike, internalAdd, isnotnull, isnull, le, le, le, like, lt, lt, lt, ne, ne, ne, or, or, sqlCondition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QCriteriaQueryBase

protected QCriteriaQueryBase(java.lang.Class<T> clz)

QCriteriaQueryBase

protected QCriteriaQueryBase(ICriteriaTableDef<T> meta)
Method Detail

getRestrictions

public QOperatorNode getRestrictions()
Specified by:
getRestrictions in class QRestrictor<T>

setRestrictions

public void setRestrictions(QOperatorNode restrictions)
Specified by:
setRestrictions in class QRestrictor<T>

getColumnList

public java.util.List<QSelectionColumn> getColumnList()
Returns all selected columns.

Returns:

setOption

public void setOption(java.lang.String name,
                      java.lang.Object val)
Set an option for the query or some of it's listeners.

Parameters:
name -
val -

hasOption

public boolean hasOption(java.lang.String name)
Returns T if the specified option is present.

Parameters:
name -
Returns:

getOption

public java.lang.Object getOption(java.lang.String name)
Get the value stored for a given option.

Parameters:
name -
Returns:

addColumn

protected void addColumn(QSelectionItem item,
                         java.lang.String alias)
Add a column selector to the selection list.


addPropertySelection

protected void addPropertySelection(QSelectionFunction f,
                                    java.lang.String prop,
                                    java.lang.String alias)
Add a simple property selector to the list.

Parameters:
f -
prop -
alias -

selectProperty

protected QCriteriaQueryBase<T> selectProperty(java.lang.String property)
Select a property value from the base property in the result set.

Parameters:
property - The property whose literal value is to be selected
Returns:

selectProperty

protected QCriteriaQueryBase<T> selectProperty(java.lang.String property,
                                               java.lang.String alias)
Select a property value from the base property in the result set.

Parameters:
property - The property whose literal value is to be selected
alias - The alias for using the property in the restrictions clause.
Returns:

max

protected QCriteriaQueryBase<T> max(java.lang.String property)
Select the max of a property in the set. This will cause a group by.

Parameters:
property - The property whose literal value is to be selected
Returns:

max

protected QCriteriaQueryBase<T> max(java.lang.String property,
                                    java.lang.String alias)
Select the max of a property in the set. This will cause a group by.

Parameters:
property - The property whose literal value is to be selected
alias - The alias for using the property in the restrictions clause.
Returns:

min

protected QCriteriaQueryBase<T> min(java.lang.String property)
Select the minimal value of a property in the set. This will cause a group by.

Parameters:
property - The property whose literal value is to be selected
Returns:

min

protected QCriteriaQueryBase<T> min(java.lang.String property,
                                    java.lang.String alias)
Select the minimal value of a property in the set. This will cause a group by.

Parameters:
property - The property whose literal value is to be selected
alias - The alias for using the property in the restrictions clause.
Returns:

avg

protected QCriteriaQueryBase<T> avg(java.lang.String property)
Select the average value of a property in the set. This will cause a group by.

Parameters:
property - The property whose literal value is to be selected
Returns:

avg

protected QCriteriaQueryBase<T> avg(java.lang.String property,
                                    java.lang.String alias)
Select the average value of a property in the set. This will cause a group by.

Parameters:
property - The property whose literal value is to be selected
alias - The alias for using the property in the restrictions clause.
Returns:

sum

protected QCriteriaQueryBase<T> sum(java.lang.String property)
Select the sum of a property in the set. This will cause a group by.

Parameters:
property - The property whose literal value is to be selected
Returns:

sum

protected QCriteriaQueryBase<T> sum(java.lang.String property,
                                    java.lang.String alias)
Select the sum of a property in the set. This will cause a group by.

Parameters:
property - The property whose literal value is to be selected
alias - The alias for using the property in the restrictions clause.
Returns:

count

protected QCriteriaQueryBase<T> count(java.lang.String property)
Select a count over the result set.

Parameters:
property - The property whose literal value is to be selected
Returns:

count

protected QCriteriaQueryBase<T> count(java.lang.String property,
                                      java.lang.String alias)
Select a count over the result set.

Parameters:
property - The property whose literal value is to be selected
alias - The alias for using the property in the restrictions clause.
Returns:

countDistinct

protected QCriteriaQueryBase<T> countDistinct(java.lang.String property)
Select a count of the distinct values over the result set.

Parameters:
property - The property whose literal value is to be selected
Returns:

countDistinct

protected QCriteriaQueryBase<T> countDistinct(java.lang.String property,
                                              java.lang.String alias)
Select a count of the distinct values over the result set.

Parameters:
property - The property whose literal value is to be selected
alias - The alias for using the property in the restrictions clause.
Returns:

distinct

protected QCriteriaQueryBase<T> distinct(java.lang.String property)
Select of the distinct values over the result set.

Parameters:
property - The property whose literal value is to be selected
Returns:

distinct

protected QCriteriaQueryBase<T> distinct(java.lang.String property,
                                         java.lang.String alias)
Select of the distinct values over the result set.

Parameters:
property - The property whose literal value is to be selected
Returns:

add

public QCriteriaQueryBase<T> add(QOrder r)
Add an order clause to the list of sort items.

Parameters:
r -
Returns:

ascending

public QCriteriaQueryBase<T> ascending(java.lang.String property)
Add a property to do an ascending sort on.

Parameters:
property -
Returns:

descending

public QCriteriaQueryBase<T> descending(java.lang.String property)
Add a property to do a descending sort on.

Parameters:
property -
Returns:

limit

public QCriteriaQueryBase<T> limit(int limit)
Limit the #of rows to the specified count.

Parameters:
limit -
Returns:

start

public QCriteriaQueryBase<T> start(int start)
Start returning rows at the specified index in the result set (0-based).

Parameters:
start -
Returns:

getLimit

public final int getLimit()
Returns the limit.

Returns:

getStart

public final int getStart()
Returns the start index set.

Returns:

getOrder

public final java.util.List<QOrder> getOrder()
Returns the order-by list.

Returns:

getTimeout

public int getTimeout()

setTimeout

public void setTimeout(int timeout)
Set the query timeout, in seconds. This only works if supported by the underlying query platform, which may impose it's own query timeout on queries regardless of this setting. If implemented, the query throws a QQueryTimeoutException when the query is aborted because it ran too long. When unset the value defaults to -1 which means "use the default timeout"; 0 means "no timeout at all"; all others is the timeout in seconds.

Parameters:
timeout -