Class QueryDimension
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.
- Since:
- May 29, 2007
- Author:
- jdixon, jhyde, Luc Boudreau
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Defines in which way the hierarchize operation should be performed. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
Clears the current member inclusions from this query dimension.void
Tells the QueryDimension not to hierarchize its included selections.void
Clears the current member inclusions from this query dimension.void
Clears the current sorting settings.createSelection
(List<IdentifierSegment> nameParts) createSelection
(Level level) Selects level and includes all members in the query.createSelection
(Member member) createSelection
(Selection.Operator operator, List<IdentifierSegment> nameParts) createSelection
(Selection.Operator operator, Member member) Selects members and includes them in the query.void
exclude
(List<IdentifierSegment> nameParts) Selects members and excludes them from the query.void
Selects level members and excludes them from the query.void
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.getAxis()
Returns the underlying dimension object onto which this query dimension is based.Returns a list of the exclusions within this dimension.Returns the current mode of hierarchization, or null if no hierarchization is currently performed.Returns a list of the inclusions within this dimension.getName()
getQuery()
Returns the current order in which the dimension members are sorted.include
(List<IdentifierSegment> nameParts) Selects members and includes them in the query.Selects a level and includes it in the query.Selects members and includes them in the query.include
(Selection.Operator operator, List<IdentifierSegment> nameParts) Selects members and includes them in the query.include
(Selection.Operator operator, Member member) Selects members and includes them in the query.boolean
Tells the QueryDimension not to keep a consistent hierarchyprotected void
Subclasses should call this helper method to notify it's listeners that children were added.protected void
notifyAdd
(org.olap4j.query.QueryNode child, int index) Subclasses should call this helper method to notify its listeners that a child was added.protected void
notifyChange
(Map<Integer, org.olap4j.query.QueryNode> children) Subclasses should call this helper method to notify its listeners that children selections object has a new operator value.protected void
notifyChange
(org.olap4j.query.QueryNode child, int index) Subclasses should call this helper method to notify its listeners that a child selection object has a new operator value.protected void
notifyRemove
(Map<Integer, org.olap4j.query.QueryNode> children) Subclasses should call this helper method to notify its listeners that children were added.protected void
notifyRemove
(org.olap4j.query.QueryNode child, int index) Subclasses should call this helper method to notify its listeners that a child was removed.void
Resolves a selection of members into an actual list of the root member and it's relatives selected by the Selection object.void
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
Sorts the dimension members by name in the order supplied as a parameter.
-
Field Details
-
axis
-
inclusions
-
exclusions
-
dimension
-
-
Constructor Details
-
QueryDimension
-
-
Method Details
-
getQuery
-
setAxis
-
getAxis
-
getName
-
include
Selects members and includes them in the query.This method selects and includes a single member with the
Selection.Operator.MEMBER
operator.- Parameters:
nameParts
- Name of the member to select and include.- Throws:
OlapException
- If no member corresponding to the supplied name parts could be resolved in the cube.
-
createSelection
- Throws:
OlapException
-
include
public Selection include(Selection.Operator operator, List<IdentifierSegment> nameParts) throws OlapException Selects members and includes them in the query.This method selects and includes a member along with its relatives, depending on the supplied
Selection.Operator
operator.- Parameters:
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.- Throws:
OlapException
- If no member corresponding to the supplied name parts could be resolved in the cube.
-
createSelection
public Selection createSelection(Selection.Operator operator, List<IdentifierSegment> nameParts) throws OlapException - Throws:
OlapException
-
include
Selects members and includes them in the query.This method selects and includes a single member with the
Selection.Operator.MEMBER
selection operator.- Parameters:
member
- The member to select and include in the query.
-
createSelection
-
include
Selects a level and includes it in the query.This method selects and includes a all members of the given query using the
Selection.Operator.MEMBERS
selection operator.- Parameters:
level
- The level to select and include in the query.
-
createSelection
Selects members and includes them in the query.This method selects and includes a member along with it's relatives, depending on the supplied
Selection.Operator
operator.- Parameters:
operator
- Selection operator that defines what relatives of the supplied member name to include along.member
- Root member to select and include.
-
createSelection
Selects level and includes all members in the query.This method selects and includes all members of a given Level, using the MEMBERS operator
Selection.Operator
- Parameters:
level
- Root level to select and include.
-
include
Selects members and includes them in the query.This method selects and includes a member along with it's relatives, depending on the supplied
Selection.Operator
operator.- Parameters:
operator
- Selection operator that defines what relatives of the supplied member name to include along.member
- Root member to select and include.
-
clearInclusions
public void clearInclusions()Clears the current member inclusions from this query dimension. -
exclude
Selects members and excludes them from the query.This method selects and excludes a single member with the
Selection.Operator.MEMBER
operator.- Parameters:
nameParts
- Name of the member to select and exclude.- Throws:
OlapException
- If no member corresponding to the supplied name parts could be resolved in the cube.
-
exclude
public void exclude(Selection.Operator operator, List<IdentifierSegment> nameParts) throws OlapException Selects members and excludes them from the query.This method selects and excludes a member along with its relatives, depending on the supplied
Selection.Operator
operator.- Parameters:
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.- Throws:
OlapException
- If no member corresponding to the supplied name parts could be resolved in the cube.
-
exclude
Selects level members and excludes them from the query.This method selects and excludes members of a level with the
Selection.Operator.MEMBERS
selection operator.- Parameters:
level
- The level to select and exclude from the query.
-
exclude
Selects members and excludes them from the query.This method selects and excludes a single member with the
Selection.Operator.MEMBER
selection operator.- Parameters:
member
- The member to select and exclude from the query.
-
exclude
Selects members and excludes them from the query.This method selects and excludes a member along with it's relatives, depending on the supplied
Selection.Operator
operator.- Parameters:
operator
- Selection operator that defines what relatives of the supplied member name to exclude along.member
- Root member to select and exclude.
-
clearExclusions
public void clearExclusions()Clears the current member inclusions from this query dimension. -
resolve
Resolves a selection of members into an actual list of the root member and it's relatives selected by the Selection object.- Parameters:
selection
- The selection of members to resolve.- Returns:
- A list of the actual members selected by the selection object.
- Throws:
OlapException
- If resolving the selections triggers an exception while looking up members in the underlying cube.
-
getInclusions
Returns a list of the inclusions within this dimension.Be aware that modifications to this list might have unpredictable consequences.
- Returns:
- list of inclusions
-
getExclusions
Returns a list of the exclusions within this dimension.Be aware that modifications to this list might have unpredictable consequences.
- Returns:
- list of exclusions
-
getDimension
Returns the underlying dimension object onto which this query dimension is based.Returns a mutable object so operations on it have unpredictable consequences.
- Returns:
- The underlying dimension representation.
-
setDimension
Forces a change onto which dimension is the current base of this QueryDimension object.Forcing a change in the duimension assignment has unpredictable consequences.
- Parameters:
dimension
- The new dimension to assign to this query dimension.
-
sort
Sorts the dimension members by name in the order supplied as a parameter.- Parameters:
order
- TheSortOrder
to use.
-
getSortOrder
Returns the current order in which the dimension members are sorted.- Returns:
- A value of
SortOrder
-
clearSort
public void clearSort()Clears the current sorting settings. -
getHierarchizeMode
Returns the current mode of hierarchization, or null if no hierarchization is currently performed.This capability is only available when a single dimension is selected on an axis
- Returns:
- Either a hierarchization mode value or null if no hierarchization is currently performed.
-
setHierarchizeMode
Triggers the hierarchization of the included members within this QueryDimension.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.
- Parameters:
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.
-
clearHierarchizeMode
public void clearHierarchizeMode()Tells the QueryDimension not to hierarchize its included selections.This capability is only available when a single dimension is selected on an axis.
-
setHierarchyConsistent
public void setHierarchyConsistent(boolean consistent) Tells the QueryDimension not to keep a consistent hierarchy within the inclusions when the mdx is generated. Only members whose Ancestors are included will be included.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]})) -
isHierarchyConsistent
public boolean isHierarchyConsistent()Tells the QueryDimension not to keep a consistent hierarchy -
addQueryNodeListener
-
removeQueryNodeListener
-
notifyAdd
protected void notifyAdd(org.olap4j.query.QueryNode child, int index) Subclasses should call this helper method to notify its listeners that a child was added.- Parameters:
child
- Child that was addedindex
- The index at which it was added
-
notifyAdd
Subclasses should call this helper method to notify it's listeners that children were added.- Parameters:
children
- A map of indexes and children QueryNode objects that were added
-
notifyRemove
protected void notifyRemove(org.olap4j.query.QueryNode child, int index) Subclasses should call this helper method to notify its listeners that a child was removed.- Parameters:
child
- Child that was removedindex
- Index of child
-
notifyRemove
Subclasses should call this helper method to notify its listeners that children were added.- Parameters:
children
- A map of indexes and children QueryNode objects that were removed
-
notifyChange
protected void notifyChange(org.olap4j.query.QueryNode child, int index) Subclasses should call this helper method to notify its listeners that a child selection object has a new operator value.- Parameters:
child
- Child that was updatedindex
- The index of the child among its siblings
-
notifyChange
Subclasses should call this helper method to notify its listeners that children selections object has a new operator value.- Parameters:
children
- A map of indexes and children QueryNode objects that were updated
-