org.olap4j.query
public class QueryDimension extends Object
It references an Dimension
and allows the
query creator to manage the member selections for the dimension.
The state of a QueryDimension does not affect the
Dimension object in any way so a single Dimension object
can be referenced by many QueryDimension objects.
Modifier and Type | Class and Description |
---|---|
static class |
QueryDimension.HierarchizeMode
Defines in which way the hierarchize operation
should be performed.
|
Constructor and Description |
---|
QueryDimension(Query query,
Dimension dimension) |
Modifier and Type | Method and Description |
---|---|
void |
addQueryNodeListener(QueryNodeListener l)
Registers a new listener for a QueryNode.
|
void |
clearExclusions()
Clears the current member inclusions from this query dimension.
|
void |
clearHierarchizeMode()
Tells the QueryDimension not to hierarchize its included
selections.
|
void |
clearInclusions()
Clears the current member inclusions from this query dimension.
|
void |
clearSort()
Clears the current sorting settings.
|
Selection |
createSelection(Level level)
Selects level and includes all members in the query.
|
Selection |
createSelection(List<IdentifierSegment> nameParts) |
Selection |
createSelection(Member member) |
Selection |
createSelection(Selection.Operator operator,
List<IdentifierSegment> nameParts) |
Selection |
createSelection(Selection.Operator operator,
Member member)
Selects members and includes them in the query.
|
void |
exclude(Level level)
Selects level members and excludes them from the query.
|
void |
exclude(List<IdentifierSegment> nameParts)
Selects members and excludes them from the query.
|
void |
exclude(Member member)
Selects members and excludes them from the query.
|
void |
exclude(Selection.Operator operator,
List<IdentifierSegment> nameParts)
Selects members and excludes them from the query.
|
void |
exclude(Selection.Operator operator,
Member member)
Selects members and excludes them from the query.
|
QueryAxis |
getAxis() |
Dimension |
getDimension()
Returns the underlying dimension object onto which
this query dimension is based.
|
List<Selection> |
getExclusions()
Returns a list of the exclusions within this dimension.
|
QueryDimension.HierarchizeMode |
getHierarchizeMode()
Returns the current mode of hierarchization, or null
if no hierarchization is currently performed.
|
List<Selection> |
getInclusions()
Returns a list of the inclusions within this dimension.
|
String |
getName() |
Query |
getQuery() |
SortOrder |
getSortOrder()
Returns the current order in which the
dimension members are sorted.
|
Selection |
include(Level level)
Selects a level and includes it in the query.
|
Selection |
include(List<IdentifierSegment> nameParts)
Selects members and includes them in the query.
|
Selection |
include(Member member)
Selects members and includes them in the query.
|
Selection |
include(Selection.Operator operator,
List<IdentifierSegment> nameParts)
Selects members and includes them in the query.
|
Selection |
include(Selection.Operator operator,
Member member)
Selects members and includes them in the query.
|
boolean |
isHierarchyConsistent()
Tells the QueryDimension not to keep a consistent hierarchy
|
void |
removeQueryNodeListener(QueryNodeListener l)
De-registers a new listener for a QueryNode.
|
List<Member> |
resolve(Selection selection)
Resolves a selection of members into an actual list
of the root member and it's relatives selected by the Selection object.
|
void |
setAxis(QueryAxis axis) |
void |
setDimension(Dimension dimension)
Forces a change onto which dimension is the current
base of this QueryDimension object.
|
void |
setHierarchizeMode(QueryDimension.HierarchizeMode hierarchizeMode)
Triggers the hierarchization of the included members within this
QueryDimension.
|
void |
setHierarchyConsistent(boolean consistent)
Tells the QueryDimension not to keep a consistent hierarchy
within the inclusions when the mdx is generated.
|
void |
sort(SortOrder order)
Sorts the dimension members by name in the
order supplied as a parameter.
|
public QueryDimension(Query query, Dimension dimension)
public Selection include(List<IdentifierSegment> nameParts) throws OlapException
This method selects and includes a single member with the
Selection.Operator.MEMBER
operator.
nameParts
- Name of the member to select and include.OlapException
- If no member corresponding to the supplied
name parts could be resolved in the cube.public Selection createSelection(List<IdentifierSegment> nameParts) throws OlapException
OlapException
public Selection include(Selection.Operator operator, List<IdentifierSegment> nameParts) throws OlapException
This method selects and includes a member along with its
relatives, depending on the supplied Selection.Operator
operator.
operator
- Selection operator that defines what relatives of the
supplied member name to include along.nameParts
- Name of the root member to select and include.OlapException
- If no member corresponding to the supplied
name parts could be resolved in the cube.public Selection createSelection(Selection.Operator operator, List<IdentifierSegment> nameParts) throws OlapException
OlapException
public Selection include(Member member)
This method selects and includes a single member with the
Selection.Operator.MEMBER
selection operator.
member
- The member to select and include in the query.public Selection createSelection(Member member)
public Selection include(Level level)
This method selects and includes a all members of the given
query using the Selection.Operator.MEMBERS
selection operator.
level
- The level to select and include in the query.public Selection createSelection(Selection.Operator operator, Member member)
This method selects and includes a member along with it's
relatives, depending on the supplied Selection.Operator
operator.
operator
- Selection operator that defines what relatives of the
supplied member name to include along.member
- Root member to select and include.public Selection createSelection(Level level)
This method selects and includes all members of a
given Level, using the MEMBERS operator Selection.Operator
level
- Root level to select and include.public Selection include(Selection.Operator operator, Member member)
This method selects and includes a member along with it's
relatives, depending on the supplied Selection.Operator
operator.
operator
- Selection operator that defines what relatives of the
supplied member name to include along.member
- Root member to select and include.public void clearInclusions()
public void exclude(List<IdentifierSegment> nameParts) throws OlapException
This method selects and excludes a single member with the
Selection.Operator.MEMBER
operator.
nameParts
- Name of the member to select and exclude.OlapException
- If no member corresponding to the supplied
name parts could be resolved in the cube.public void exclude(Selection.Operator operator, List<IdentifierSegment> nameParts) throws OlapException
This method selects and excludes a member along with its
relatives, depending on the supplied Selection.Operator
operator.
operator
- Selection operator that defines what relatives of the
supplied member name to exclude along.nameParts
- Name of the root member to select and exclude.OlapException
- If no member corresponding to the supplied
name parts could be resolved in the cube.public void exclude(Level level)
This method selects and excludes members of a level with the
Selection.Operator.MEMBERS
selection operator.
level
- The level to select and exclude from the query.public void exclude(Member member)
This method selects and excludes a single member with the
Selection.Operator.MEMBER
selection operator.
member
- The member to select and exclude from the query.public void exclude(Selection.Operator operator, Member member)
This method selects and excludes a member along with it's
relatives, depending on the supplied Selection.Operator
operator.
operator
- Selection operator that defines what relatives of the
supplied member name to exclude along.member
- Root member to select and exclude.public void clearExclusions()
public List<Member> resolve(Selection selection) throws OlapException
selection
- The selection of members to resolve.OlapException
- If resolving the selections triggers an exception
while looking up members in the underlying cube.public List<Selection> getInclusions()
Be aware that modifications to this list might have unpredictable consequences.
public List<Selection> getExclusions()
Be aware that modifications to this list might have unpredictable consequences.
public Dimension getDimension()
Returns a mutable object so operations on it have unpredictable consequences.
public void setDimension(Dimension dimension)
Forcing a change in the duimension assignment has unpredictable consequences.
dimension
- The new dimension to assign to this
query dimension.public void sort(SortOrder order)
order
- The SortOrder
to use.public SortOrder getSortOrder()
SortOrder
public void clearSort()
public QueryDimension.HierarchizeMode getHierarchizeMode()
This capability is only available when a single dimension is selected on an axis
public void setHierarchizeMode(QueryDimension.HierarchizeMode hierarchizeMode)
The dimension inclusions will be wrapped in an MDX Hierarchize function call.
This capability is only available when a single dimension is selected on an axis.
hierarchizeMode
- If parents should be included before or after
their children. (Equivalent to the POST/PRE MDX literal for the
Hierarchize() function)
inside the Hierarchize() MDX function call.public void clearHierarchizeMode()
This capability is only available when a single dimension is selected on an axis.
public void setHierarchyConsistent(boolean consistent)
It uses the MDX function FILTER() in combination with
ANCESTOR() to produce a set like:
{[Time].[1997]},
Filter({{[Time].[Quarter].Members}},
(Ancestor([Time].CurrentMember, [Time].[Year]) IN {[Time].[1997]}))
public boolean isHierarchyConsistent()
public void addQueryNodeListener(QueryNodeListener l)
l
- The new listener object, implementation of QueryNodeListenerQueryNodeListener
public void removeQueryNodeListener(QueryNodeListener l)
l
- The listener object to de-register.QueryNodeListener