Class QueryAxis
- java.lang.Object
-
- org.olap4j.query.QueryAxis
-
public class QueryAxis extends java.lang.Object
An axis within an OLAPQuery
.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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDimension(int index, QueryDimension dimension)
Places aQueryDimension
object on this axis at a specific index.void
addDimension(QueryDimension dimension)
Places aQueryDimension
object on this axis.void
addQueryNodeListener(QueryNodeListener l)
void
bottomCount(java.math.BigDecimal n)
Returns a specified number of items from the bottom of the axis set.void
clearFilter()
Clears the filter condition for this axis.void
clearLimitFunction()
Clears the limit parameters of that axis.void
clearSort()
Clears the sort parameters from this axis.void
filter(java.lang.String filterCondition)
Filter the axis using the given condition before TopCount / Order are applied.java.util.List<QueryDimension>
getDimensions()
Returns a list of the dimensions placed on this QueryAxis.java.lang.String
getFilterCondition()
Returns the Filter Condition used to filter the axis set.LimitFunction
getLimitFunction()
java.math.BigDecimal
getLimitFunctionN()
java.lang.String
getLimitFunctionSortLiteral()
Returns the current sort literal being used by the limit functionMight return null of none is currently specified.Axis
getLocation()
Returns the location of thisQueryAxis
in the query;null
if unused.java.lang.String
getName()
Returns the name of this QueryAxis.java.lang.String
getSortIdentifierNodeName()
Returns the current sort evaluation expression, or null if none are currently defined.SortOrder
getSortOrder()
Returns the current sort order in which this axis will be sorted.boolean
isNonEmpty()
Returns whether this QueryAxis filters out empty rows.void
limit(LimitFunction function, java.math.BigDecimal n, java.lang.String limitSortLiteral)
Limit the axis set to a specified number of items depending on the limitSortLiteral andLimitFunction
.void
pullUp(int index)
Places a QueryDimension object one position before in the list of current dimensions.void
pushDown(int index)
Places a QueryDimension object one position lower in the list of current dimensions.void
removeDimension(QueryDimension dimension)
Removes aQueryDimension
object on this axis.void
removeQueryNodeListener(QueryNodeListener l)
void
setNonEmpty(boolean nonEmpty)
Sets whether this QueryAxis filters out empty rows.void
sort(SortOrder order)
Sorts the axis according to the supplied order.void
sort(SortOrder order, java.lang.String sortEvaluationLiteral)
Sorts the axis according to the supplied order and evaluation expression.void
sort(SortOrder order, java.util.List<IdentifierSegment> nameParts)
Sorts the axis according to the supplied order and member unique name.void
sort(SortOrder order, Member member)
Sorts the axis according to the supplied order and member.void
topCount(java.math.BigDecimal n)
Returns a specified number of items from the top of the axis set.
-
-
-
Method Detail
-
getLocation
public Axis getLocation()
Returns the location of thisQueryAxis
in the query;null
if unused.- Returns:
- location of this axis in the query
-
getDimensions
public java.util.List<QueryDimension> 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
public java.lang.String 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
public void addDimension(QueryDimension dimension)
Places aQueryDimension
object on this axis.- Parameters:
dimension
- TheQueryDimension
object to add to this axis.
-
addDimension
public void addDimension(int index, QueryDimension dimension)
Places aQueryDimension
object on this axis at a specific index.- Parameters:
dimension
- TheQueryDimension
object to add to this axis.index
- The position (0 based) onto which to place the QueryDimension
-
removeDimension
public void removeDimension(QueryDimension dimension)
Removes aQueryDimension
object on this axis.- Parameters:
dimension
- TheQueryDimension
object 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(boolean)
-
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:
isNonEmpty()
-
sort
public void sort(SortOrder order) throws OlapException
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
- TheSortOrder
to apply- Throws:
OlapException
- If an error occurs while resolving the default measure of the underlying cube.
-
sort
public void sort(SortOrder order, java.util.List<IdentifierSegment> nameParts) throws OlapException
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
- TheSortOrder
in 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
public void sort(SortOrder order, Member member)
Sorts the axis according to the supplied order and member.
This method is most commonly called by passing it a
Measure
.- Parameters:
order
- TheSortOrder
in which to sort the axis.member
- The member that will be used as a sort evaluation expression.
-
sort
public void sort(SortOrder order, java.lang.String sortEvaluationLiteral)
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
- TheSortOrder
in 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
public SortOrder 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
public java.lang.String 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
public void topCount(java.math.BigDecimal n)
Returns a specified number of items from the top of the axis set.- Parameters:
n
-
-
bottomCount
public void bottomCount(java.math.BigDecimal n)
Returns a specified number of items from the bottom of the axis set.- Parameters:
n
-
-
limit
public void limit(LimitFunction function, java.math.BigDecimal n, java.lang.String limitSortLiteral)
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
public LimitFunction getLimitFunction()
- Returns:
- The
LimitFunction
-
getLimitFunctionN
public java.math.BigDecimal getLimitFunctionN()
- Returns:
- The number of items or cumulative sum or percentage
being used by the
LimitFunction
.
-
getLimitFunctionSortLiteral
public java.lang.String 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
public void filter(java.lang.String filterCondition)
Filter the axis using the given condition before TopCount / Order are applied.- Parameters:
filterCondition
- - the condition used for Filter()
-
getFilterCondition
public java.lang.String 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
public void addQueryNodeListener(QueryNodeListener l)
-
removeQueryNodeListener
public void removeQueryNodeListener(QueryNodeListener l)
-
-