com.tonbeller.jpivot.olap.query
Class SortRankBase

java.lang.Object
  extended by com.tonbeller.jpivot.core.ExtensionSupport
      extended by com.tonbeller.jpivot.olap.query.SortRankBase
All Implemented Interfaces:
Extension, ExpressionConstants, SortRank, QuaxChangeListener, java.util.EventListener
Direct Known Subclasses:
MondrianSortRank, XMLA_SortRank

public abstract class SortRankBase
extends ExtensionSupport
implements SortRank, QuaxChangeListener

Author:
hh Implementation base of the Sort Extension

Field Summary
protected  Quax quaxToSort
           
protected  boolean sorting
           
protected  int sortMode
           
protected  Member[] sortPosMembers
           
protected  int topBottomCount
           
 
Fields inherited from interface com.tonbeller.jpivot.olap.navi.SortRank
ID
 
Fields inherited from interface com.tonbeller.jpivot.olap.model.ExpressionConstants
ASC, BASC, BDESC, BOTTOMCOUNT, DESC, TOPCOUNT
 
Constructor Summary
SortRankBase()
           
 
Method Summary
 int activeQuaxToSort()
           
abstract  void addSortToQuery()
          apply sort to query must be implemented for specific olap sources
 int getQuaxToSort()
           
 int getSortMode()
           
 Member[] getSortPosMembers()
           
 int getTopBottomCount()
          number of members for topcount and bottomcount
 boolean isCurrentSorting(Position position)
          return true if the result is sorted by the members of the position
 boolean isSortable(Position position)
          returns true, if one of the members is a measure
 boolean isSorting()
          turns sorting on / off (off = natural sorting)
 boolean isSortOnQuery()
           
 void quaxChanged(Quax quax, java.lang.Object source, boolean changedByNavi)
          implement QuaxChangeListener
 void reset()
          reset to initial state
 void setQuaxToSort(int ordinal)
          set quax to sort
 void setSorting(boolean sorting)
           
 void setSortMode(int sortMode)
           
 void setSortPosMembers(Member[] sortPosMembers)
           
 void setTopBottomCount(int topBottomCount)
           
 void sort(Axis membersToSort, Position position)
          changes current sorting.
 
Methods inherited from class com.tonbeller.jpivot.core.ExtensionSupport
decorate, getId, getModel, modelInitialized, setId, setModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.tonbeller.jpivot.core.Extension
decorate, getId, modelInitialized, setModel
 

Field Detail

topBottomCount

protected int topBottomCount

sortMode

protected int sortMode

sorting

protected boolean sorting

sortPosMembers

protected Member[] sortPosMembers

quaxToSort

protected Quax quaxToSort
Constructor Detail

SortRankBase

public SortRankBase()
Method Detail

quaxChanged

public void quaxChanged(Quax quax,
                        java.lang.Object source,
                        boolean changedByNavi)
implement QuaxChangeListener

Specified by:
quaxChanged in interface QuaxChangeListener

getTopBottomCount

public int getTopBottomCount()
Description copied from interface: SortRank
number of members for topcount and bottomcount

Specified by:
getTopBottomCount in interface SortRank
Returns:
top/bottom count
See Also:
SortRank.getTopBottomCount()

setTopBottomCount

public void setTopBottomCount(int topBottomCount)
Specified by:
setTopBottomCount in interface SortRank
Parameters:
top/bottom - count
See Also:
com.tonbeller.jpivot.mondrian.olap.navi.SortRank#setTopBottomCount(int)

getSortMode

public int getSortMode()
Specified by:
getSortMode in interface SortRank
Returns:
sort mode (ASC,DESC,BASC,BDESC,TOPCOUNT,BOTTOMCOUNT)
See Also:
SortRank.getSortMode()

setSortMode

public void setSortMode(int sortMode)
Specified by:
setSortMode in interface SortRank
Parameters:
sort - mode (ASC,DESC,BASC,BDESC)
See Also:
SortRank.setSortMode(int)

isCurrentSorting

public boolean isCurrentSorting(Position position)
Description copied from interface: SortRank
return true if the result is sorted by the members of the position

Specified by:
isCurrentSorting in interface SortRank
Parameters:
position - to be checked
Returns:
true, if position is the current sorting position
See Also:
SortRank.isCurrentSorting(Position)

isSortable

public boolean isSortable(Position position)
returns true, if one of the members is a measure

Specified by:
isSortable in interface SortRank
Parameters:
position - the position to check for sortability
Returns:
true, if the position is sortable
See Also:
SortRank.isSortable(Position)

sort

public void sort(Axis membersToSort,
                 Position position)
Description copied from interface: SortRank
changes current sorting. If mode is TOPCOUNT or BOTTOMCOUNT the current value of topBottomCount will be used.

Specified by:
sort in interface SortRank
Parameters:
membersToSort - Axis containing the members to be sorted
position - Position on "other axis" defining the members by which the membersToSort are sorted
See Also:
SortRank.sort(Axis, Position)

isSorting

public boolean isSorting()
Description copied from interface: SortRank
turns sorting on / off (off = natural sorting)

Specified by:
isSorting in interface SortRank

setSorting

public void setSorting(boolean sorting)
Specified by:
setSorting in interface SortRank

reset

public void reset()
reset to initial state


getSortPosMembers

public Member[] getSortPosMembers()
Returns:

setSortPosMembers

public void setSortPosMembers(Member[] sortPosMembers)
Parameters:
members -

addSortToQuery

public abstract void addSortToQuery()
apply sort to query must be implemented for specific olap sources


getQuaxToSort

public int getQuaxToSort()
Returns:
ordinal of quax to sort

activeQuaxToSort

public int activeQuaxToSort()
Returns:
ordinal of quax to sort, if sorting is active

setQuaxToSort

public void setQuaxToSort(int ordinal)
set quax to sort


isSortOnQuery

public boolean isSortOnQuery()
Returns:
true, if there is a sort for the query