org.objectweb.medor.query.lib
Class Nest
java.lang.Object
BasicCloneable
org.objectweb.medor.lib.BasicTupleStructure
org.objectweb.medor.query.lib.BasicQueryTree
org.objectweb.medor.query.lib.BasicQueryNode
org.objectweb.medor.query.lib.Nest
- All Implemented Interfaces:
- AnnotationsHolder, java.lang.Cloneable, Cloneable, FilteredQueryTree, NestQueryNode, QueryNode, QueryTree, java.io.Serializable, TupleStructure
- Direct Known Subclasses:
- AggregateRdbQueryNode
- public class Nest
- extends BasicQueryNode
- implements NestQueryNode
- Author:
- Sebastien Chassande-Barrioz
- See Also:
- Serialized Form
Constructor Summary |
Nest()
|
Nest(QueryTreeField[] groupedFields,
java.lang.String groupedFieldName,
QueryTreeField[] groupByFields,
java.lang.String nodeName)
Creates a QueryNode corresponding to a nest operation (group by). |
Methods inherited from class org.objectweb.medor.query.lib.BasicQueryNode |
addCalculatedField, addChild, addField, addPropagatedField, getChildren, getFieldName, getQueryFilter, getTupleLoader, isOuter, removeField, replace, setOuter, setTupleLoader, updateCalculatedField, updateChildren, updatePropagatedField |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.objectweb.medor.query.api.QueryNode |
addCalculatedField, addPropagatedField, getChildren, getTupleLoader, isOuter, removeField, replace, setOuter, setTupleLoader, updateCalculatedField, updatePropagatedField |
Methods inherited from interface org.objectweb.medor.api.Cloneable |
clone |
myGroupByFields
protected PropagatedField[] myGroupByFields
- It lists the fields which have been grouped.
theGroupByFields
protected QueryTreeField[] theGroupByFields
nestedField
protected NestedField nestedField
Nest
public Nest()
Nest
public Nest(QueryTreeField[] groupedFields,
java.lang.String groupedFieldName,
QueryTreeField[] groupByFields,
java.lang.String nodeName)
throws MedorException
- Creates a QueryNode corresponding to a nest operation (group by).
The Fields that are grouped and those that are used for the grouping
must come from one single (child) QueryTree.
- Parameters:
groupedFields
- is the array of Fields which are nested by the
operator. These are Fields of the child QueryTree.groupedFieldName
- is the name of the Field corresponding to the
nesting.groupByFields
- is the array of Fields which are used for defining
the group to be nested (equivalent to SQL GROUP BY). These are Fields of
the child QueryTree. They are also called NestingFields.
clone
public java.lang.Object clone(java.lang.Object clone,
java.util.Map obj2clone)
throws java.lang.CloneNotSupportedException
- Overrides:
clone
in class BasicQueryNode
- Throws:
java.lang.CloneNotSupportedException
replaceNestedField
public NestedField replaceNestedField(java.lang.String name,
Field[] grouped)
throws MedorException
- Creates and adds a NestedField to the TupleStructure of the
QueryNode.
- Specified by:
replaceNestedField
in interface NestQueryNode
- Parameters:
name
- is the name of the Field to be added.grouped
- are the grouped Fields for the NestedField to be created.
- Returns:
- the newly created NestedField
- Throws:
MedorException
- when a Field with the same name already exists.
setQueryFilter
public void setQueryFilter(Expression e)
- Description copied from interface:
FilteredQueryTree
- Sets the filter associated to the FilteredQueryTree. This filter is
represented by an Expression.
For a QueryNode:
This method also updates the list of QueryTree children of the current
QueryNode according to the FieldOperands present in the Expression.
Usage constraint: if the QueryNode already has an associated
Expression, and if this Expression has been modified, the user is
requested to call the setQueryFilter method after the modification.
For a RbdQueryLeaf:
It sets the filter associated to the RbdQueryLeaf. This filter is
represented by an Expression. Unlike the filter of a QueryNode, is
applies to its own Fields, instead of the Fields of its children.
- Specified by:
setQueryFilter
in interface FilteredQueryTree
- Overrides:
setQueryFilter
in class BasicQueryNode
getNestingFields
public QueryTreeField[] getNestingFields()
- Description copied from interface:
NestQueryNode
- Gives the the fields which will be used to define groups.
Typically, this corresponds to the "group by" clause of SQL.
Other fields can be used to construct a TupleCollection, containing
all values of such fields for a given group.
- Specified by:
getNestingFields
in interface NestQueryNode
- Returns:
- an array of field giving the grouping fields.
getNestingField
public QueryTreeField getNestingField(java.lang.String fieldName)
- Specified by:
getNestingField
in interface NestQueryNode
getNestedField
public NestedField getNestedField()
- Description copied from interface:
NestQueryNode
- Gives the new NestedField
- Specified by:
getNestedField
in interface NestQueryNode
replaceNestingField
public QueryTreeField replaceNestingField(QueryTreeField old,
QueryTreeField neo)
- Specified by:
replaceNestingField
in interface NestQueryNode
getType
public short getType()
- Description copied from interface:
QueryNode
- It retrieves the operation type of the current QueryNode.
- Specified by:
getType
in interface QueryNode
- Specified by:
getType
in class BasicQueryNode