Class QueryAxis
Query.
An axis has a location (columns, rows, etc) and has zero or more dimensions that are placed on it.
- Since:
- May 29, 2007
- Author:
- jdixon, Luc Boudreau
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDimension(int index, QueryDimension dimension) Places aQueryDimensionobject on this axis at a specific index.voidaddDimension(QueryDimension dimension) Places aQueryDimensionobject on this axis.voidvoidReturns a specified number of items from the bottom of the axis set.voidClears the filter condition for this axis.voidClears the limit parameters of that axis.voidClears the sort parameters from this axis.voidFilter the axis using the given condition before TopCount / Order are applied.Returns a list of the dimensions placed on this QueryAxis.Returns the Filter Condition used to filter the axis set.Returns the current sort literal being used by the limit functionMight return null of none is currently specified.Returns the location of thisQueryAxisin the query;nullif unused.getName()Returns the name of this QueryAxis.Returns the current sort evaluation expression, or null if none are currently defined.Returns the current sort order in which this axis will be sorted.booleanReturns whether this QueryAxis filters out empty rows.voidlimit(LimitFunction function, BigDecimal n, String limitSortLiteral) Limit the axis set to a specified number of items depending on the limitSortLiteral andLimitFunction.protected voidSubclasses should call this helper method to notify it's listeners that children were added.protected voidnotifyAdd(org.olap4j.query.QueryNode child, int index) Subclasses should call this helper method to notify its listeners that a child was added.protected voidnotifyChange(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 voidnotifyChange(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 voidnotifyRemove(Map<Integer, org.olap4j.query.QueryNode> children) Subclasses should call this helper method to notify its listeners that children were added.protected voidnotifyRemove(org.olap4j.query.QueryNode child, int index) Subclasses should call this helper method to notify its listeners that a child was removed.voidpullUp(int index) Places a QueryDimension object one position before in the list of current dimensions.voidpushDown(int index) Places a QueryDimension object one position lower in the list of current dimensions.voidremoveDimension(QueryDimension dimension) Removes aQueryDimensionobject on this axis.voidvoidsetHierarchizeMode(QueryDimension.HierarchizeMode hierarchizeMode) voidsetNonEmpty(boolean nonEmpty) Sets whether this QueryAxis filters out empty rows.voidSorts the axis according to the supplied order.voidSorts the axis according to the supplied order and evaluation expression.voidsort(SortOrder order, List<IdentifierSegment> nameParts) Sorts the axis according to the supplied order and member unique name.voidSorts the axis according to the supplied order and member.voidReturns a specified number of items from the top of the axis set.
-
Field Details
-
dimensions
-
location
-
-
Constructor Details
-
QueryAxis
Creates a QueryAxis.- Parameters:
query- Query that the axis belongs tolocation- Location of axis (e.g. ROWS, COLUMNS)
-
-
Method Details
-
getLocation
Returns the location of thisQueryAxisin the query;nullif unused.- Returns:
- location of this axis in the query
-
getDimensions
Returns a list of the dimensions placed on this QueryAxis.Be aware that modifications to this list might have unpredictable consequences.
- Returns:
- list of dimensions
-
getName
Returns the name of this QueryAxis.- Returns:
- the name of this axis, for example "ROWS", "COLUMNS".
-
pullUp
public void pullUp(int index) Places a QueryDimension object one position before in the list of current dimensions. Uses a 0 based index. For example, to place the 5th dimension on the current axis one position before, one would need to call pullUp(4), so the dimension would then use axis index 4 and the previous dimension at that position gets pushed down one position.- Parameters:
index- The index of the dimension to move up one notch. It uses a zero based index.
-
pushDown
public void pushDown(int index) Places a QueryDimension object one position lower in the list of current dimensions. Uses a 0 based index. For example, to place the 4th dimension on the current axis one position lower, one would need to call pushDown(3), so the dimension would then use axis index 4 and the previous dimension at that position gets pulled up one position.- Parameters:
index- The index of the dimension to move down one notch. It uses a zero based index.
-
addDimension
Places aQueryDimensionobject on this axis.- Parameters:
dimension- TheQueryDimensionobject to add to this axis.
-
addDimension
Places aQueryDimensionobject on this axis at a specific index.- Parameters:
index- The position (0 based) onto which to place the QueryDimensiondimension- TheQueryDimensionobject to add to this axis.
-
removeDimension
Removes aQueryDimensionobject on this axis.- Parameters:
dimension- TheQueryDimensionobject to remove from this axis.
-
isNonEmpty
public boolean isNonEmpty()Returns whether this QueryAxis filters out empty rows. If true, axis filters out empty rows, and the MDX to evaluate the axis will be generated with the "NON EMPTY" expression.- Returns:
- Whether this axis should filter out empty rows
- See Also:
-
setNonEmpty
public void setNonEmpty(boolean nonEmpty) Sets whether this QueryAxis filters out empty rows.- Parameters:
nonEmpty- Whether this axis should filter out empty rows- See Also:
-
getHierarchizeMode
-
setHierarchizeMode
-
sort
Sorts the axis according to the supplied order. The sort evaluation expression will be the default member of the default hierarchy of the dimension named "Measures".
- Parameters:
order- TheSortOrderto apply- Throws:
OlapException- If an error occurs while resolving the default measure of the underlying cube.
-
sort
Sorts the axis according to the supplied order and member unique name.Using this method will try to resolve the supplied name parts from the underlying cube and find the corresponding member. This member will then be passed as a sort evaluation expression.
- Parameters:
order- TheSortOrderin which to sort the axis.nameParts- The unique name parts of the sort evaluation expression.- Throws:
OlapException- If the supplied member cannot be resolved withCube.lookupMember(java.util.List)
-
sort
Sorts the axis according to the supplied order and member.
This method is most commonly called by passing it a
Measure.- Parameters:
order- TheSortOrderin which to sort the axis.member- The member that will be used as a sort evaluation expression.
-
sort
Sorts the axis according to the supplied order and evaluation expression.
The string value passed as the sortEvaluationLitteral parameter will be used literally as a sort evaluator.
- Parameters:
order- TheSortOrderin which to sort the axis.sortEvaluationLiteral- The literal expression that will be used to sort against.
-
clearSort
public void clearSort()Clears the sort parameters from this axis. -
getSortOrder
Returns the current sort order in which this axis will be sorted. Might return null of none is currently specified.- Returns:
- The
SortOrder
-
getSortIdentifierNodeName
Returns the current sort evaluation expression, or null if none are currently defined.- Returns:
- The string literal that will be used in the MDX Order() function.
-
topCount
Returns a specified number of items from the top of the axis set.- Parameters:
n-
-
bottomCount
Returns a specified number of items from the bottom of the axis set.- Parameters:
n-
-
limit
Limit the axis set to a specified number of items depending on the limitSortLiteral andLimitFunction.- Parameters:
n- - number of items/cumulative sum/percentage
-
clearLimitFunction
public void clearLimitFunction()Clears the limit parameters of that axis. -
getLimitFunction
- Returns:
- The
LimitFunction
-
getLimitFunctionN
- Returns:
- The number of items or cumulative sum or percentage
being used by the
LimitFunction.
-
getLimitFunctionSortLiteral
Returns the current sort literal being used by the limit functionMight return null of none is currently specified.- Returns:
- sort literal of the limit function
-
filter
Filter the axis using the given condition before TopCount / Order are applied.- Parameters:
filterCondition- - the condition used for Filter()
-
getFilterCondition
Returns the Filter Condition used to filter the axis set.- Returns:
- filter condition
-
clearFilter
public void clearFilter()Clears the filter condition for this axis. -
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
-