Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.pivot.olap
Class DefaultOlapProvider

java.lang.Object
  extended by com.citra.pivot.olap.DefaultOlapProvider
All Implemented Interfaces:
OlapProvider

public class DefaultOlapProvider
extends Object
implements OlapProvider

DefaultOlapProvider is the default OlapProvider implementation. The row and column headers returned from this provider are based on the pivoting performed with the use of a OlapDefinition.


Field Summary
static int ASSIGN_TO_MEMBER
          constant used for assigning a name to a member of a OlapTableModel
static int ASSIGN_TO_NODE
          constant used for assigning a name to a node of a OlapTableModel
protected  Connection connection
          the connection
protected  DataSource dataSource
          the underlying datasource
protected  EventListenerList listeners
          a list of listeners
protected  OlapDefinition olapDefinition
          the currently used olap definition
protected  boolean showColumnGrandTotal
          whether to show the column grand total
protected  boolean showEmptyColumnCells
          whether to show the empty column cells
protected  boolean showEmptyRowCells
          whether to show the row empty cells
protected  boolean showRootMembers
          whether to show the root member(s)
protected  boolean showRowGrandTotal
          whether to show the row grand total
protected  boolean useVisualTotals
          whether to show the visual totals or the normal aggregates
 
Constructor Summary
DefaultOlapProvider(DataSource ctx, OlapCube cube)
          Constructs a DefaultOlapProvider.
DefaultOlapProvider(DataSource ctx, OlapDefinition olapDefinition)
          Constructs a DefaultOlapProvider.
 
Method Summary
 void addOlapProviderListener(OlapProviderListener x)
          Adds a listener that is notified when the row, column header or filter area of an olap provider have changed.
 void assignSlicingMember(OlapMember slicingMember)
          Assigns a member to use for slicing the measure data.
 void clearCache()
          Clears the cache from all values.
 void drill(OlapTableModel model, TreePath path, boolean up)
          Performs a drill operation on the cell specified by the model and path.
 OlapColumnAdapter getColumnAdapter()
          Retrieves the column header model.
 OlapDefinition getCompiledOlapDefinition()
          Retrieves the currently compiled olap definition.
 Connection getConnection()
          Retrieves the underlying datasource connection
 OlapCube getCube()
          Retrieves the associated cube.
 DataSource getDataSource()
          Returns the underlying datasource.
 Object getDataValueAt(TreePath[] rowPaths, TreePath[] columnPaths)
          Retrieves the data value at the specfied row and column paths.
 OlapMeasure getDefaultMeasure()
          Retrieves the default measure used, when the measure dimension does not appear in either the row or column headers.
 OlapFilter getFilter(OlapHierarchy hierarchy)
          Returns the filter that is applied on a certain hierarchy.
 OlapTableModel getModel(OlapHierarchy hierarchy)
          Returns the model that was created for a certain hierarchy.
 OlapDefinition getOlapDefinition()
          Retrieves a modifiable olap definition.
 OlapRowAdapter getRowAdapter()
          Retrieves the row header model.
 boolean getShowColumnGrandTotal()
          Determines whether to show the column grand total.
 boolean getShowEmptyCells()
          Determines whether to show the empty row and column cells.
 boolean getShowEmptyColumnCells()
          Determines whether to show the empty column cells.
 boolean getShowEmptyRowCells()
          Determines whether to show the empty row cells.
 boolean getShowGrandTotals()
          Determines whether to show the row and column grand totals.
 boolean getShowRootMembers()
          Determines whether to show the root member(s).
 boolean getShowRowGrandTotal()
          Determines whether to show the row grand total.
 boolean getShowSubTotal(OlapLevel level)
          Determines whether to show the sub totals for a given level.
 boolean getShowSubTotal(OlapMember member)
          Determines whether to show the sub totals for a given member.
 TupleSelection getSlicingMembers()
          Retrieves a list of members that are used for slicing when querying the datasource.
 OlapSort getSort(OlapLevel level)
          Returns the sorting that is applied on a certain level.
 OlapTopBottom getTopBottom(OlapLevel level)
          Returns the top/bottom that is applied on a certain level.
 boolean getUseVisualTotals()
          Determines whether to show the visual totals.
 boolean hasDrill(OlapTableModel model, TreePath path)
          Determines whether a path on a model was previously drilled.
 boolean isDataValueCached(TreePath[] rowPaths, TreePath[] columnPaths)
          Determines whether a data value has been retrieved from the underlying datasource.
 void removeOlapProviderListener(OlapProviderListener x)
          Removes a listener that is notified when the row, column header or filter area of an olap provider have changed.
 void removeSlicingMember(OlapHierarchy hierarchy)
          Removes a member that was previously assigned as the slice member for the dimension.
 void removeValueFromCache(MemberList members)
          Removes a given cell value from the cache.
 void setDataSource(DataSource dataSource)
          Assigns the underlying datasource.
 void setFilter(OlapFilter filter, OlapHierarchy hierarchy)
          Assigns the filter that is applied on a certain hierarchy.
 void setInitialQuery(QuerySelection query)
          Assigns the initial query from which a pivot table is formed.
 void setName(OlapTableModel model, Object node, String name, int mode)
          Assigns the display value of a certain node in a model.
 void setOlapDefinition(OlapDefinition olapDefinition)
          Assigns a new olap definition.
 void setShowColumnGrandTotal(boolean show)
          Determines whether to show the column grand total.
 void setShowEmptyCells(boolean show)
          Determines whether to show the empty row and column cells.
 void setShowEmptyColumnCells(boolean show)
          Determines whether to show the empty column cells.
 void setShowEmptyRowCells(boolean show)
          Determines whether to show the empty row cells.
 void setShowGrandTotals(boolean show)
          Determines whether to show the row and column grand totals.
 void setShowRootMembers(boolean show)
          Determines whether to show the root member(s).
 void setShowRowGrandTotal(boolean show)
          Determines whether to show the row grand total.
 void setShowSubTotal(OlapLevel level, boolean show)
          Determines whether to show the sub totals for a given level.
 void setSort(OlapLevel level, int mode, OlapMeasure measure, OlapTuple tuple)
          Assigns the sorting that is applied on a certain level.
 void setTopBottom(OlapLevel level, int mode, OlapMeasure measure, int count)
          Assigns the top/bottom transform that is applied on a certain level.
 void setUseVisualTotals(boolean use)
          Determines whether to show the visual totals.
 void swapAxes()
          Performs a swap of the current axes, so that the models pivoted on the row header move to the column header and vice versa.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataSource

protected DataSource dataSource
the underlying datasource


olapDefinition

protected OlapDefinition olapDefinition
the currently used olap definition


listeners

protected EventListenerList listeners
a list of listeners


showRowGrandTotal

protected boolean showRowGrandTotal
whether to show the row grand total


showColumnGrandTotal

protected boolean showColumnGrandTotal
whether to show the column grand total


showRootMembers

protected boolean showRootMembers
whether to show the root member(s)


showEmptyRowCells

protected boolean showEmptyRowCells
whether to show the row empty cells


showEmptyColumnCells

protected boolean showEmptyColumnCells
whether to show the empty column cells


useVisualTotals

protected boolean useVisualTotals
whether to show the visual totals or the normal aggregates


ASSIGN_TO_NODE

public static final int ASSIGN_TO_NODE
constant used for assigning a name to a node of a OlapTableModel

See Also:
Constant Field Values

ASSIGN_TO_MEMBER

public static final int ASSIGN_TO_MEMBER
constant used for assigning a name to a member of a OlapTableModel

See Also:
Constant Field Values

connection

protected Connection connection
the connection

Constructor Detail

DefaultOlapProvider

public DefaultOlapProvider(DataSource ctx,
                           OlapCube cube)
Constructs a DefaultOlapProvider.


DefaultOlapProvider

public DefaultOlapProvider(DataSource ctx,
                           OlapDefinition olapDefinition)
Constructs a DefaultOlapProvider.

Method Detail

addOlapProviderListener

public void addOlapProviderListener(OlapProviderListener x)
Adds a listener that is notified when the row, column header or filter area of an olap provider have changed.

Specified by:
addOlapProviderListener in interface OlapProvider
Parameters:
x - the listener to be added

assignSlicingMember

public void assignSlicingMember(OlapMember slicingMember)
Assigns a member to use for slicing the measure data. This will effectively create a 'slice' of the data.

Parameters:
slicingMember - the member to slice with

clearCache

public void clearCache()
Clears the cache from all values.


drill

public void drill(OlapTableModel model,
                  TreePath path,
                  boolean up)
Performs a drill operation on the cell specified by the model and path. up specifies the direction of the drill.

Parameters:
model - the olap table model
path - the path to be drilled
up - drills up if true, down otherwise

getColumnAdapter

public OlapColumnAdapter getColumnAdapter()
Retrieves the column header model.

Specified by:
getColumnAdapter in interface OlapProvider
Returns:
the column header

getCompiledOlapDefinition

public OlapDefinition getCompiledOlapDefinition()
Retrieves the currently compiled olap definition. Any modifications done on the definition will have no effect whatsoever on the provider or the application, as a deep copy is always returned.

Returns:
the currently compiled olap definition

getConnection

public Connection getConnection()
Retrieves the underlying datasource connection

Specified by:
getConnection in interface OlapProvider
Returns:
the underlying datasource connection

getCube

public OlapCube getCube()
Retrieves the associated cube.

Specified by:
getCube in interface OlapProvider
Returns:
the associated cube

getDataSource

public DataSource getDataSource()
Returns the underlying datasource. The datasource is used to create the row and column headers.

Returns:
the datasource

getDataValueAt

public Object getDataValueAt(TreePath[] rowPaths,
                             TreePath[] columnPaths)
Retrieves the data value at the specfied row and column paths.

Specified by:
getDataValueAt in interface OlapProvider
Parameters:
rowPaths - the paths of the row header
columnPaths - the paths of the column header
Returns:
the value at the specified position

getDefaultMeasure

public OlapMeasure getDefaultMeasure()
Retrieves the default measure used, when the measure dimension does not appear in either the row or column headers.

Specified by:
getDefaultMeasure in interface OlapProvider
Returns:
the displayed measure, in the absence of a measure dimension pivot

getFilter

public OlapFilter getFilter(OlapHierarchy hierarchy)
Returns the filter that is applied on a certain hierarchy.

Parameters:
hierarchy - the hierarchy for which a filter is applied
Returns:
the assigned filter or null, if there is no filter

getModel

public OlapTableModel getModel(OlapHierarchy hierarchy)
Returns the model that was created for a certain hierarchy.

Parameters:
hierarchy - the hierarchy for which a model was created
Returns:
the model associated to the hierarchy

getOlapDefinition

public OlapDefinition getOlapDefinition()
Retrieves a modifiable olap definition. Once the definition has been modified, it can be assigned to the provider with the setOlapDefinition method.

Returns:
the modifiable olap definition

getRowAdapter

public OlapRowAdapter getRowAdapter()
Retrieves the row header model.

Specified by:
getRowAdapter in interface OlapProvider
Returns:
the row header

getShowColumnGrandTotal

public boolean getShowColumnGrandTotal()
Determines whether to show the column grand total.

Returns:
true if the column grand total is shown, false otherwise

getShowEmptyCells

public boolean getShowEmptyCells()
Determines whether to show the empty row and column cells.

Returns:
true if the empty row and column cells are shown, false otherwise

getShowEmptyColumnCells

public boolean getShowEmptyColumnCells()
Determines whether to show the empty column cells.

Returns:
true if the empty column cells are shown, false otherwise

getShowEmptyRowCells

public boolean getShowEmptyRowCells()
Determines whether to show the empty row cells.

Returns:
true if the empty row cells are shown, false otherwise

getShowGrandTotals

public boolean getShowGrandTotals()
Determines whether to show the row and column grand totals.

Returns:
true if the row and column grand totals are shown, false otherwise

getShowRootMembers

public boolean getShowRootMembers()
Determines whether to show the root member(s).

Returns:
true if the root member(s) are shown, false otherwise

getShowRowGrandTotal

public boolean getShowRowGrandTotal()
Determines whether to show the row grand total.

Returns:
true if the row grand total is shown, false otherwise

getShowSubTotal

public boolean getShowSubTotal(OlapLevel level)
Determines whether to show the sub totals for a given level.

Parameters:
level - the level for which sub totals are shown
Returns:
true if the sub totals are shown, false otherwise

getShowSubTotal

public boolean getShowSubTotal(OlapMember member)
Determines whether to show the sub totals for a given member.

Parameters:
member - the member for which sub totals are shown
Returns:
true if the sub totals are shown, false otherwise

getSlicingMembers

public TupleSelection getSlicingMembers()
Retrieves a list of members that are used for slicing when querying the datasource.

Specified by:
getSlicingMembers in interface OlapProvider
Returns:
a list of members used as the 'slice'

getSort

public OlapSort getSort(OlapLevel level)
Returns the sorting that is applied on a certain level.

Parameters:
level - the level for which sorting is applied
Returns:
the assigned sorting or null, if there is no sorting

getTopBottom

public OlapTopBottom getTopBottom(OlapLevel level)
Returns the top/bottom that is applied on a certain level.

Parameters:
level - the level for which a top/bottom transform is applied
Returns:
the assigned top/bottom transform or null, if there is no top/bottom for this level

getUseVisualTotals

public boolean getUseVisualTotals()
Determines whether to show the visual totals.

Returns:
true if the visual totals are shown, false otherwise

hasDrill

public boolean hasDrill(OlapTableModel model,
                        TreePath path)
Determines whether a path on a model was previously drilled.

Parameters:
model - the olap table model
path - the path to check
Returns:
true if the given path was drilled, false otherwise

isDataValueCached

public boolean isDataValueCached(TreePath[] rowPaths,
                                 TreePath[] columnPaths)
Determines whether a data value has been retrieved from the underlying datasource.

Specified by:
isDataValueCached in interface OlapProvider
Parameters:
rowPaths - the paths of the row header
columnPaths - the paths of the column header
Returns:
true, if the value has been cached, false otherwise

removeValueFromCache

public void removeValueFromCache(MemberList members)
Removes a given cell value from the cache.

Parameters:
members - the list of members that identifies the cell value

removeOlapProviderListener

public void removeOlapProviderListener(OlapProviderListener x)
Removes a listener that is notified when the row, column header or filter area of an olap provider have changed.

Specified by:
removeOlapProviderListener in interface OlapProvider
Parameters:
x - the listener to be removed

removeSlicingMember

public void removeSlicingMember(OlapHierarchy hierarchy)
Removes a member that was previously assigned as the slice member for the dimension. The 'all' member will be then assigned.

Parameters:
hierarchy - the hierarchy from which the filter is removed

setDataSource

public void setDataSource(DataSource dataSource)
Assigns the underlying datasource. The datasource is used to create the row and column headers.

Parameters:
dataSource - the datasource to assign

setFilter

public void setFilter(OlapFilter filter,
                      OlapHierarchy hierarchy)
Assigns the filter that is applied on a certain hierarchy.

Parameters:
filter - the filter to apply
hierarchy - the hierarchy for which a filter is applied

setInitialQuery

public void setInitialQuery(QuerySelection query)
                     throws DataSourceException
Assigns the initial query from which a pivot table is formed.

Parameters:
query - the query to execute
Throws:
DataSourceException

setName

public void setName(OlapTableModel model,
                    Object node,
                    String name,
                    int mode)
Assigns the display value of a certain node in a model.

Parameters:
model - the model whose node's name is being assigned
node - the node being changed
name - the node's name
mode - the assignment node, either ASSIGN_TO_MEMBER or ASSIGN_TO_NODE

setOlapDefinition

public void setOlapDefinition(OlapDefinition olapDefinition)
                       throws DataSourceException
Assigns a new olap definition.

Parameters:
olapDefinition - the new definition to assign
Throws:
DataSourceException

setShowColumnGrandTotal

public void setShowColumnGrandTotal(boolean show)
Determines whether to show the column grand total.

Parameters:
show - true if the column grand total is shown, false otherwise

setShowEmptyCells

public void setShowEmptyCells(boolean show)
Determines whether to show the empty row and column cells.

Parameters:
show - true if the empty row and column cells are shown, false otherwise

setShowEmptyColumnCells

public void setShowEmptyColumnCells(boolean show)
Determines whether to show the empty column cells.

Parameters:
show - true if the empty column cells are shown, false otherwise

setShowEmptyRowCells

public void setShowEmptyRowCells(boolean show)
Determines whether to show the empty row cells.

Parameters:
show - true if the empty row cells are shown, false otherwise

setShowGrandTotals

public void setShowGrandTotals(boolean show)
Determines whether to show the row and column grand totals.

Parameters:
show - true if the row and column grand totals are shown, false otherwise

setShowRootMembers

public void setShowRootMembers(boolean show)
Determines whether to show the root member(s).

Parameters:
show - true if the root member(s) are shown, false otherwise

setShowRowGrandTotal

public void setShowRowGrandTotal(boolean show)
Determines whether to show the row grand total.

Parameters:
show - true if the row grand total is shown, false otherwise

setShowSubTotal

public void setShowSubTotal(OlapLevel level,
                            boolean show)
Determines whether to show the sub totals for a given level.

Parameters:
level - the level for which sub totals are shown
show - true if the sub totals are shown, false otherwise

setSort

public void setSort(OlapLevel level,
                    int mode,
                    OlapMeasure measure,
                    OlapTuple tuple)
Assigns the sorting that is applied on a certain level.

Parameters:
level - the level for which sorting is applied
mode - the sort mode
measure - the measure according to which values are sorted
tuple - the tuple to join with the level being sorted

setTopBottom

public void setTopBottom(OlapLevel level,
                         int mode,
                         OlapMeasure measure,
                         int count)
Assigns the top/bottom transform that is applied on a certain level.

Parameters:
level - the level for which a top/bottom transform is applied
mode - the top/bottom mode
measure - the measure according to which values are evaluated
count - the maximum number of members to return

setUseVisualTotals

public void setUseVisualTotals(boolean use)
Determines whether to show the visual totals.

Parameters:
use - true if the visual totals are shown, false otherwise

swapAxes

public void swapAxes()
Performs a swap of the current axes, so that the models pivoted on the row header move to the column header and vice versa.


Copyright © 2011 Citra Technologies. All Rights Reserved.