org.olap4j.query
Class QueryDimension

java.lang.Object
  extended by org.olap4j.query.QueryDimension

public class QueryDimension
extends java.lang.Object

Usage of a dimension for an OLAP query.

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
Version:
$Id: QueryDimension.java 277 2009-08-18 18:50:30Z lucboudreau $
Author:
jdixon, jhyde, Luc Boudreau

Nested Class Summary
static class QueryDimension.HierarchizeMode
          Defines in which way the hierarchize operation should be performed.
 
Constructor Summary
QueryDimension(Query query, Dimension dimension)
           
 
Method Summary
 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 hierarchyze it's included selections.
 void clearInclusions()
          Clears the current member inclusions from this query dimension.
 void clearSelection()
          Deprecated. This method is deprecated in favor of clearInclusions()
 void clearSort()
          Clears the current sorting settings.
 void exclude(Member member)
          Selects members and excludes them from the query.
 void exclude(Selection.Operator operator, Member member)
          Selects members and excludes them from the query.
 void exclude(Selection.Operator operator, java.lang.String... nameParts)
          Selects members and excludes them from the query.
 void exclude(java.lang.String... nameParts)
          Selects members and excludes them from the query.
 QueryAxis getAxis()
           
 Dimension getDimension()
          Returns the underlying dimension object onto which this query dimension is based.
 java.util.List<Selection> getExclusions()
          Returns a list of the exclusions within this dimension.
 QueryDimension.HierarchizeMode getHierarchizeMode()
          Returns the current mode of hierarchyzation, or null if no hierarchyzation is currently performed.
 java.util.List<Selection> getInclusions()
          Returns a list of the inclusions within this dimension.
 java.lang.String getName()
           
static java.lang.String[] getNameParts(java.lang.String sel)
           
 Query getQuery()
           
 java.util.List<Selection> getSelections()
          Deprecated. Use getInclusions()
 SortOrder getSortOrder()
          Returns the current order in which the dimension members are sorted.
 void include(Member member)
          Selects members and includes them in the query.
 void include(Selection.Operator operator, Member member)
          Selects members and includes them in the query.
 void include(Selection.Operator operator, java.lang.String... nameParts)
          Selects members and includes them in the query.
 void include(java.lang.String... nameParts)
          Selects members and includes them in the query.
 void removeQueryNodeListener(QueryNodeListener l)
          De-registers a new listener for a QueryNode.
 java.util.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 select(Member member)
          Deprecated. 
 void select(Selection.Operator operator, Member member)
          Deprecated. 
 void select(Selection.Operator operator, java.lang.String... nameParts)
          Deprecated. 
 void select(java.lang.String... nameParts)
          Deprecated. 
 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 sort(SortOrder order)
          Sorts the dimension members by name in the order supplied as a parameter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryDimension

public QueryDimension(Query query,
                      Dimension dimension)
Method Detail

getQuery

public Query getQuery()

setAxis

public void setAxis(QueryAxis axis)

getAxis

public QueryAxis getAxis()

getName

public java.lang.String getName()

select

@Deprecated
public void select(java.lang.String... nameParts)
            throws OlapException
Deprecated. 

Throws:
OlapException

select

@Deprecated
public void select(Selection.Operator operator,
                              java.lang.String... nameParts)
            throws OlapException
Deprecated. 

Throws:
OlapException

select

@Deprecated
public void select(Member member)
Deprecated. 


select

@Deprecated
public void select(Selection.Operator operator,
                              Member member)
Deprecated. 


clearSelection

@Deprecated
public void clearSelection()
Deprecated. This method is deprecated in favor of clearInclusions()

Clears the current member inclusions from this query dimension.


include

public void include(java.lang.String... nameParts)
             throws OlapException
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.

include

public void include(Selection.Operator operator,
                    java.lang.String... nameParts)
             throws OlapException
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.
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.

include

public void include(Member member)
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.

include

public void include(Selection.Operator operator,
                    Member member)
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

public void exclude(java.lang.String... nameParts)
             throws OlapException
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,
                    java.lang.String... nameParts)
             throws OlapException
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.
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

public void exclude(Member member)
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

public void exclude(Selection.Operator operator,
                    Member member)
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.


getNameParts

public static java.lang.String[] getNameParts(java.lang.String sel)

resolve

public java.util.List<Member> resolve(Selection selection)
                               throws OlapException
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.

getSelections

@Deprecated
public java.util.List<Selection> getSelections()
Deprecated. Use 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

getInclusions

public java.util.List<Selection> 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

public java.util.List<Selection> 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

public Dimension 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

public void setDimension(Dimension dimension)
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

public void sort(SortOrder order)
Sorts the dimension members by name in the order supplied as a parameter.

Parameters:
order - The SortOrder to use.

getSortOrder

public SortOrder 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

public QueryDimension.HierarchizeMode getHierarchizeMode()
Returns the current mode of hierarchyzation, or null if no hierarchyzation is currently performed.

Returns:
Either a hierarchyzation mode value or null if no hierarchyzation is currently performed.

setHierarchizeMode

public void setHierarchizeMode(QueryDimension.HierarchizeMode hierarchizeMode)
Triggers the hierarchization of the included members within this QueryDimension.

The dimension inclusions will be wrapped in an MDX Hierarchize function call.

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 hierarchyze it's included selections.


addQueryNodeListener

public void addQueryNodeListener(QueryNodeListener l)
Registers a new listener for a QueryNode.

Parameters:
l - The new listener object, implementation of QueryNodeListener
See Also:
QueryNodeListener

removeQueryNodeListener

public void removeQueryNodeListener(QueryNodeListener l)
De-registers a new listener for a QueryNode. If the listener object passed as a parameter was not registered, the method will return silently.

Parameters:
l - The listener object to de-register.
See Also:
QueryNodeListener

SourceForge.net_Logo