Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.pivot.olap
Class OlapUtils

java.lang.Object
  extended by com.citra.pivot.olap.OlapUtils

public class OlapUtils
extends Object

OlapUtils is a collection of utility static methods for searching within schemas and selecting members from a DataSource.


Method Summary
static MemberList extractMembers(OlapSet set)
          Retrieves the members from a set.
static MemberList extractMembers(OlapSet set, int index)
          Retrieves the members from a set.
static MemberList extractMembers(OlapSet set, int index, boolean distinct)
          Retrieves the members from a set.
static MemberList extractMembers(SetSelection set, Connection connection)
          Retrieves the members from a set selection.
static OlapCube findCubeByName(OlapSchema schema, String name)
          Finds a cube by name within a schema.
static OlapDimension findDimensionByID(OlapCube cube, String id)
          Finds a dimension by id within a cube.
static OlapDimension findDimensionByName(OlapCube cube, String name)
          Finds a dimension by name within a cube.
static OlapHierarchy findHierarchyByID(OlapCube cube, String id)
          Finds a hierarchy by id within a cube.
static OlapHierarchy findHierarchyByID(OlapDimension dimension, String id)
          Finds a hierarchy by id within a dimension.
static OlapHierarchy findHierarchyByID(OlapSchema schema, String id)
          Finds a hierarchy by id within a schema.
static OlapHierarchy findHierarchyByName(OlapCube cube, String name)
          Finds a hierarchy by name within a cube.
static OlapHierarchy findHierarchyByName(OlapDimension dimension, String name)
          Finds a hierarchy by name within a dimension.
static OlapLevel findLevelByID(OlapDimension dimension, String id)
          Finds a level by id within a dimension.
static OlapLevel findLevelByID(OlapHierarchy hierarchy, String id)
          Finds a level by id within a hierarchy.
static OlapLevel findLevelByName(OlapDimension dimension, String name)
          Finds a level by name within a dimension.
static OlapLevel findLevelByName(OlapHierarchy hierarchy, String name)
          Finds a level by name within a hierarchy.
static OlapMeasure findMeasureByName(OlapCube cube, String name)
          Finds a measure by name within a cube.
static MemberList getChildrenMembers(OlapMember member, Connection connection)
          Retrieves the children of a member, by querying the datasource.
static int getLevelIndex(OlapMember member)
          Returns the level depth of a given member.
static MemberList getMembers(OlapMember member, int operators, Connection connection)
          Retrieves a list of members, based on a given member and a selection operator mask, by querying the datasource.
static OlapMember retrieveMember(String[] memberPath, Connection connection)
          Retrieves a member from a cube.
static MemberList retrieveMembers(String[] memberPath, int operators, Connection connection)
          Retrieves a list of members from a cube.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

extractMembers

public static MemberList extractMembers(OlapSet set)
Retrieves the members from a set. The members are found on the first index in the tuples.

Parameters:
set - the set whose members are retrieved
Returns:
a list of members

extractMembers

public static MemberList extractMembers(OlapSet set,
                                        int index,
                                        boolean distinct)
Retrieves the members from a set. The members are found in the location defined by index in the tuples. When distinct is true, duplicate members are removed.

Parameters:
set - the set whose members are retrieved
index - the location of the members in the tuples
distinct - when true, duplicate members are removed
Returns:
a list of members

extractMembers

public static MemberList extractMembers(OlapSet set,
                                        int index)
Retrieves the members from a set. The members are found in the location defined by index in the tuples.

Parameters:
set - the set whose members are retrieved
index - the location of the members in the tuples
Returns:
a list of members

extractMembers

public static MemberList extractMembers(SetSelection set,
                                        Connection connection)
                                 throws DataSourceException
Retrieves the members from a set selection. The members are found on the first index in the tuples.

Parameters:
set - the set whose members are retrieved
connection - the datasource connection
Returns:
a list of members
Throws:
DataSourceException

findCubeByName

public static OlapCube findCubeByName(OlapSchema schema,
                                      String name)
Finds a cube by name within a schema.

Parameters:
schema - the schema to search
name - the name of the cube to look for
Returns:
the found cube, or null if no such cube exists

findDimensionByID

public static OlapDimension findDimensionByID(OlapCube cube,
                                              String id)
Finds a dimension by id within a cube.

Parameters:
cube - the cube to search
id - the id of the dimension to look for
Returns:
the found dimension, or null if no such dimension exists

findDimensionByName

public static OlapDimension findDimensionByName(OlapCube cube,
                                                String name)
Finds a dimension by name within a cube.

Parameters:
cube - the cube to search
name - the name of the dimension to look for
Returns:
the found dimension, or null if no such dimension exists

findHierarchyByID

public static OlapHierarchy findHierarchyByID(OlapCube cube,
                                              String id)
Finds a hierarchy by id within a cube.

Parameters:
cube - the cube to search
id - the id of the hierarchy to look for
Returns:
the found hierarchy, or null if no such hierarchy exists

findHierarchyByID

public static OlapHierarchy findHierarchyByID(OlapDimension dimension,
                                              String id)
Finds a hierarchy by id within a dimension.

Parameters:
dimension - the dimension to search
id - the id of the hierarchy to look for
Returns:
the found hierarchy, or null if no such hierarchy exists

findHierarchyByID

public static OlapHierarchy findHierarchyByID(OlapSchema schema,
                                              String id)
Finds a hierarchy by id within a schema.

Parameters:
schema - the schema to search
id - the id of the hierarchy to look for
Returns:
the found hierarchy, or null if no such hierarchy exists

findHierarchyByName

public static OlapHierarchy findHierarchyByName(OlapCube cube,
                                                String name)
Finds a hierarchy by name within a cube.

Parameters:
cube - the cube to search
name - the name of the hierarchy to look for
Returns:
the found hierarchy, or null if no such hierarchy exists

findHierarchyByName

public static OlapHierarchy findHierarchyByName(OlapDimension dimension,
                                                String name)
Finds a hierarchy by name within a dimension.

Parameters:
dimension - the dimension to search
name - the name of the hierarchy to look for
Returns:
the found hierarchy, or null if no such hierarchy exists

findLevelByID

public static OlapLevel findLevelByID(OlapHierarchy hierarchy,
                                      String id)
Finds a level by id within a hierarchy.

Parameters:
hierarchy - the hierarchy to search
id - the id of the level to look for
Returns:
the found level, or null if no such level exists

findLevelByName

public static OlapLevel findLevelByName(OlapHierarchy hierarchy,
                                        String name)
Finds a level by name within a hierarchy.

Parameters:
hierarchy - the hierarchy to search
name - the name of the level to look for
Returns:
the found level, or null if no such level exists

findMeasureByName

public static OlapMeasure findMeasureByName(OlapCube cube,
                                            String name)
Finds a measure by name within a cube.

Parameters:
cube - the cube to search
name - the name of the measure to look for
Returns:
the found measure, or null if no such measure exists

getChildrenMembers

public static MemberList getChildrenMembers(OlapMember member,
                                            Connection connection)
                                     throws DataSourceException
Retrieves the children of a member, by querying the datasource.

Parameters:
member - the member whose children are returned
connection - the datasource connection
Returns:
the children members
Throws:
DataSourceException

getLevelIndex

public static int getLevelIndex(OlapMember member)
Returns the level depth of a given member.

Parameters:
member - the member whose level depth is returned
Returns:
the member's level depth in a hierarchy of levels

getMembers

public static MemberList getMembers(OlapMember member,
                                    int operators,
                                    Connection connection)
                             throws DataSourceException
Retrieves a list of members, based on a given member and a selection operator mask, by querying the datasource.

Parameters:
member - the member which serves as the basis for the selection
operators - a selection operator mask, as defined in SelectionConstants
connection - the datasource connection
Returns:
a list of members
Throws:
DataSourceException

retrieveMember

public static OlapMember retrieveMember(String[] memberPath,
                                        Connection connection)
                                 throws DataSourceException
Retrieves a member from a cube.
The member's path is supplied as a string array as follows:
First, the dimension name is given. Then the path names from the root member to the given member follow.
For example, "Time", "All Years", "2010", "Q4-2010"
will select the "Q4-2010" member in the time dimension.

Parameters:
memberPath - the path to the member starting from the dimension and the root member
connection - the datasource connection
Returns:
the member
Throws:
DataSourceException

retrieveMembers

public static MemberList retrieveMembers(String[] memberPath,
                                         int operators,
                                         Connection connection)
                                  throws DataSourceException
Retrieves a list of members from a cube.
An operator mask is supplied from SelectionConstants, in order to select the members, with respect to the member's path.
The member's path is supplied as a string array as follows:
First, the dimension name is given. Then the path names from the root member to the given member follow.
For example, "Time", "All Years", "2010", "Q4-2010"
will select the "Q4-2010" member in the time dimension.
Then, using an operator mask as SelectionConstants.SIBLINGS | SelectionConstants.CHILDREN will select the siblings and children of the "Q4-2010" member.

Parameters:
memberPath - the path to the member starting from the dimension and the root member
operators - an or'ed selection operator mask
connection - the datasource connection
Returns:
a list of members
Throws:
DataSourceException

findLevelByID

public static OlapLevel findLevelByID(OlapDimension dimension,
                                      String id)
Finds a level by id within a dimension.

Parameters:
dimension - the dimension to search
id - the id of the level to look for
Returns:
the found level, or null if no such level exists

findLevelByName

public static OlapLevel findLevelByName(OlapDimension dimension,
                                        String name)
Finds a level by name within a dimension.

Parameters:
dimension - the dimension to search
name - the name of the level to look for
Returns:
the found level, or null if no such level exists

Copyright © 2011 Citra Technologies. All Rights Reserved.