org.objectweb.medor.query.rdb.lib

Class AggregateRdbQueryNode

Implemented Interfaces:
Cloneable, Cloneable, FilteredQueryTree, NestQueryNode, QueryLeaf, QueryNode, QueryTree, RdbQueryLeaf, TupleStructure

public class AggregateRdbQueryNode
extends Nest
implements RdbQueryLeaf, NestQueryNode

This class represents a QueryLeaf which contains aggregate functions.

It is built on top of a RbdQueryLeaf.

Field Summary

protected DataStore
ds
protected RdbExpField
groupByField
protected String
query
protected RdbExpQueryLeaf
subRdbQL

Fields inherited from class org.objectweb.medor.query.lib.Nest

myGroupByFields, nestedField

Fields inherited from class org.objectweb.medor.query.lib.BasicQueryNode

children, filter, indexes, inner, tupleLoader

Fields inherited from class org.objectweb.medor.query.lib.BasicQueryTree

distinct, indexes, name, orderfields

Fields inherited from class org.objectweb.medor.lib.BasicTupleStructure

fields, logger, name2field

Constructor Summary

AggregateRdbQueryNode()
AggregateRdbQueryNode(QueryTreeField[] groupedFields, String groupedFieldName, QueryTreeField[] groupByFields, BasicRdbExpQueryLeaf subQL, DataStore ds, String nodeName)
Constructs a RDB QueryNode for an aggregation.

Method Summary

Object
clone(Object clone, Map obj2clone)
DataStore
getDataStore()
Expression
getQueryFilter()
Redefines getQueryFilter using the filter of the subquery.
String
getSelectList(String selectList, ArrayList selectFields, boolean qualified)
String
getSqlRequest(ParameterOperand[] pos, ArrayList al, int rangeStartAt, int rangeSize)
String
getSqlRequest(ParameterOperand[] pos, int rangeStartAt, int rangeSize)
Builds and returns the SQL query as a String corresponding to the current RdbExpQueryLeaf.
boolean
isSubquery()
void
setIsSubquery(boolean subquery)

Methods inherited from class org.objectweb.medor.query.lib.Nest

clone, getNestedField, getNestingFields, getType, replaceNestedField, setQueryFilter

Methods inherited from class org.objectweb.medor.query.lib.BasicQueryNode

addCalculatedField, addChild, addField, addPropagatedField, clone, getChildren, getFieldName, getQueryFilter, getTupleLoader, getType, isOuter, removeField, replace, setOuter, setQueryFilter, setTupleLoader, updateCalculatedField, updateChildren, updatePropagatedField

Methods inherited from class org.objectweb.medor.query.lib.BasicQueryTree

clone, getDistinct, getName, getOrderBy, getTupleStructure, setDistinct, setOrderBy

Methods inherited from class org.objectweb.medor.lib.BasicTupleStructure

clone, contains, contains, getField, getField, getFieldRank, getFields, getSize

Field Details

ds

protected DataStore ds


groupByField

protected RdbExpField groupByField


query

protected String query


subRdbQL

protected RdbExpQueryLeaf subRdbQL

Constructor Details

AggregateRdbQueryNode

public AggregateRdbQueryNode()


AggregateRdbQueryNode

public AggregateRdbQueryNode(QueryTreeField[] groupedFields,
                             String groupedFieldName,
                             QueryTreeField[] groupByFields,
                             BasicRdbExpQueryLeaf subQL,
                             DataStore ds,
                             String nodeName)
            throws MedorException
Constructs a RDB QueryNode for an aggregation.

The SQL request (string) will be calculated.

Parameters:
ds - is the DataStore associated to the QueryLeaf to be created

Method Details

clone

public Object clone(Object clone,
                    Map obj2clone)
            throws CloneNotSupportedException
Overrides:
clone in interface Nest


getDataStore

public DataStore getDataStore()
Specified by:
getDataStore in interface QueryLeaf


getQueryFilter

public Expression getQueryFilter()
Redefines getQueryFilter using the filter of the subquery.
Specified by:
getQueryFilter in interface FilteredQueryTree
Overrides:
getQueryFilter in interface BasicQueryNode

Returns:
the filter of the subquery.


getSelectList

public String getSelectList(String selectList,
                            ArrayList selectFields,
                            boolean qualified)
            throws MedorException
Specified by:
getSelectList in interface RdbQueryLeaf


getSqlRequest

public String getSqlRequest(ParameterOperand[] pos,
                            ArrayList al,
                            int rangeStartAt,
                            int rangeSize)
            throws MedorException,
                   ExpressionException
Specified by:
getSqlRequest in interface RdbQueryLeaf


getSqlRequest

public String getSqlRequest(ParameterOperand[] pos,
                            int rangeStartAt,
                            int rangeSize)
            throws MedorException,
                   ExpressionException
Builds and returns the SQL query as a String corresponding to the current RdbExpQueryLeaf.

The SQL query is computed using the aggregate fields and relies on the child RdbQueryLeaf.

Specified by:
getSqlRequest in interface RdbQueryLeaf

Returns:
the SQL query as a String.


isSubquery

public boolean isSubquery()
Specified by:
isSubquery in interface RdbQueryLeaf


setIsSubquery

public void setIsSubquery(boolean subquery)
Specified by:
setIsSubquery in interface RdbQueryLeaf