Class QueryAxis


  • public class QueryAxis
    extends java.lang.Object
    An axis within an OLAP 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
    • Constructor Detail

      • QueryAxis

        public QueryAxis​(Query query,
                         Axis location)
        Creates a QueryAxis.
        Parameters:
        query - Query that the axis belongs to
        location - Location of axis (e.g. ROWS, COLUMNS)
    • Method Detail

      • getLocation

        public Axis getLocation()
        Returns the location of this QueryAxis 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​(int index,
                                 QueryDimension dimension)
        Places a QueryDimension object on this axis at a specific index.
        Parameters:
        dimension - The QueryDimension object to add to this axis.
        index - The position (0 based) onto which to place the QueryDimension
      • 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 - The SortOrder 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 - The SortOrder 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 with Cube.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 - The SortOrder 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 - The SortOrder 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 and LimitFunction.
        Parameters:
        n - - number of items/cumulative sum/percentage
      • clearLimitFunction

        public void clearLimitFunction()
        Clears the limit parameters of that axis.
      • 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.
      • removeQueryNodeListener

        public void removeQueryNodeListener​(QueryNodeListener l)