Class QueryAxis

java.lang.Object
org.olap4j.query.QueryAxis

public class QueryAxis extends 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
  • Field Details

  • Constructor Details

    • 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 Details

    • 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 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 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 a QueryDimension object on this axis.
      Parameters:
      dimension - The QueryDimension object to add to this axis.
    • addDimension

      public void addDimension(int index, QueryDimension dimension)
      Places a QueryDimension object on this axis at a specific index.
      Parameters:
      index - The position (0 based) onto which to place the QueryDimension
      dimension - The QueryDimension object to add to this axis.
    • removeDimension

      public void removeDimension(QueryDimension dimension)
      Removes a QueryDimension object on this axis.
      Parameters:
      dimension - The QueryDimension 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

      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

      public QueryDimension.HierarchizeMode getHierarchizeMode()
    • setHierarchizeMode

      public void setHierarchizeMode(QueryDimension.HierarchizeMode hierarchizeMode)
    • 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, 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, 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 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(BigDecimal n)
      Returns a specified number of items from the top of the axis set.
      Parameters:
      n -
    • bottomCount

      public void bottomCount(BigDecimal n)
      Returns a specified number of items from the bottom of the axis set.
      Parameters:
      n -
    • limit

      public void limit(LimitFunction function, BigDecimal n, 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.
    • getLimitFunction

      public LimitFunction getLimitFunction()
      Returns:
      The LimitFunction
    • getLimitFunctionN

      public BigDecimal getLimitFunctionN()
      Returns:
      The number of items or cumulative sum or percentage being used by the LimitFunction.
    • getLimitFunctionSortLiteral

      public 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(String filterCondition)
      Filter the axis using the given condition before TopCount / Order are applied.
      Parameters:
      filterCondition - - the condition used for Filter()
    • getFilterCondition

      public 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)
    • 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 added
      index - The index at which it was added
    • notifyAdd

      protected void notifyAdd(Map<Integer,org.olap4j.query.QueryNode> children)
      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 removed
      index - Index of child
    • notifyRemove

      protected void notifyRemove(Map<Integer,org.olap4j.query.QueryNode> children)
      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 updated
      index - The index of the child among its siblings
    • notifyChange

      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.
      Parameters:
      children - A map of indexes and children QueryNode objects that were updated