mondrian.rolap
Class RolapMember

java.lang.Object
  extended by mondrian.olap.OlapElementBase
      extended by mondrian.olap.MemberBase
          extended by mondrian.rolap.RolapMember
All Implemented Interfaces:
Comparable, Member, OlapElement
Direct Known Subclasses:
RolapBaseCubeMeasure, RolapCalculatedMember, RolapCubeMember, RolapHierarchy.RolapNullMember, RolapVirtualCubeMeasure

public class RolapMember
extends MemberBase

A RolapMember is a member of a RolapHierarchy. There are sub-classes for RolapStoredMeasure, RolapCalculatedMember.

Since:
10 August, 2001
Author:
jhyde
 

Nested Class Summary
 
Nested classes/interfaces inherited from interface mondrian.olap.Member
Member.MemberType
 
Field Summary
 
Fields inherited from class mondrian.olap.MemberBase
flags, level, parentMember, parentUniqueName, uniqueName
 
Fields inherited from class mondrian.olap.OlapElementBase
caption
 
Constructor Summary
protected RolapMember()
          Used by RolapCubeMember.
(package private) RolapMember(RolapMember parentMember, RolapLevel level, Object value)
           
protected RolapMember(RolapMember parentMember, RolapLevel level, Object key, String name, Member.MemberType memberType)
          Creates a RolapMember
 
Method Summary
protected  boolean childLevelHasApproxRowCount()
           
 int compareTo(Object o)
          Compares this member to another RolapMember.
 boolean equals(Object o)
           
 boolean equals(OlapElement o)
           
static List<List<Member>> getAllMembers(SchemaReader schemaReader, Hierarchy hierarchy)
          This returns an array of member arrays where the first member array are the root members while the last member array are the leaf members.
 int getDepth()
          returns the depth of this member, which is not the level's depth in case of parent child dimensions
 RolapHierarchy getHierarchy()
           
static int getHierarchyCardinality(SchemaReader schemaReader, Hierarchy hierarchy)
           
 Object getKey()
           
 RolapLevel getLevel()
           
protected  org.apache.log4j.Logger getLogger()
           
 String getName()
           
 Comparable getOrderKey()
          Returns the order key of this member among its siblings.
 int getOrdinal()
          Returns the ordinal of this member within its hierarchy.
 RolapMember getParentMember()
          Returns this member's parent, or null (not the 'null member', as returned by Hierarchy.getNullMember()) if it has no parent.
 Property[] getProperties()
          Returns the definitions of the properties this member may have.
 String getPropertyFormattedValue(String propertyName)
          Returns the formatted value of the property named propertyName.
protected  Object getPropertyFromMap(String propertyName, boolean matchCase)
          Returns the value of a property by looking it up in the property map.
 Object getPropertyValue(String propertyName)
          Returns the value of the property named propertyName.
 Object getPropertyValue(String propertyName, boolean matchCase)
          Returns the value of the property named propertyName, matching according to the required case-sensitivity.
 int hashCode()
           
protected  boolean isAllMember()
           
 boolean isCalculatedInQuery()
          Returns whether this member is computed from a WITH MEMBER clause in an MDX query.
 boolean isHidden()
          Returns whether this member is 'hidden', as per the rules which define a ragged hierarchy.
protected static String keyToString(Object key)
          Converts a key to a string to be used as part of the member's name and unique name.
(package private)  void makeUniqueName(HierarchyUsage hierarchyUsage)
           
 void setName(String name)
          Only allowable if the member is part of the WITH clause of a query.
(package private)  void setOrderKey(Comparable orderKey)
           
(package private)  void setOrdinal(int ordinal)
           
static void setOrdinals(SchemaReader schemaReader, Member seedMember)
          Sets member ordinal values using a Bottom-up/Top-down algorithm.
(package private)  void setParentMember(RolapMember parentMember)
          Sets a member's parent.
 void setProperty(String name, Object value)
          Sets a property of this member to a given value.
protected  void setUniqueName(Object key)
           
 
Methods inherited from class mondrian.olap.MemberBase
computeCalculated, getAncestorMembers, getCaption, getDataMember, getDescription, getDimension, getExpression, getMemberType, getParentUniqueName, getQualifiedName, getSolveOrder, getUniqueName, isAll, isCalculated, isChildOrEqualTo, isChildOrEqualTo, isMeasure, isNull, lookupChild, lookupChild
 
Methods inherited from class mondrian.olap.OlapElementBase
clone, computeHashCode, setCaption, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RolapMember

protected RolapMember(RolapMember parentMember,
                      RolapLevel level,
                      Object key,
                      String name,
                      Member.MemberType memberType)
Creates a RolapMember

Parameters:
parentMember - Parent member
level - Level this member belongs to
key - Key to this member in the underlying RDBMS
name - Name of this member
memberType - Type of member

RolapMember

RolapMember(RolapMember parentMember,
            RolapLevel level,
            Object value)

RolapMember

protected RolapMember()
Used by RolapCubeMember. Can obsolete when RolapMember becomes a hierarchy.

Method Detail

getAllMembers

public static List<List<Member>> getAllMembers(SchemaReader schemaReader,
                                               Hierarchy hierarchy)
This returns an array of member arrays where the first member array are the root members while the last member array are the leaf members.

If you know that you will need to get all or most of the members of a hierarchy, then calling this which gets all of the hierarchy's members all at once is much faster than getting members one at a time.

Parameters:
schemaReader - Schema reader
hierarchy - Hierarchy
Returns:
List of arrays of members

getHierarchyCardinality

public static int getHierarchyCardinality(SchemaReader schemaReader,
                                          Hierarchy hierarchy)

setOrdinals

public static void setOrdinals(SchemaReader schemaReader,
                               Member seedMember)
Sets member ordinal values using a Bottom-up/Top-down algorithm.

Gets an array of members for each level and traverses array for the lowest level, setting each member's parent's parent's etc. member's ordinal if not set working back down to the leaf member and then going to the next leaf member and traversing up again.

The above algorithm only works for a hierarchy that has all of its leaf members in the same level (that is, a non-ragged hierarchy), which is the norm. After all member ordinal values have been set, traverses the array of members, making sure that all members' ordinals have been set. If one is found that is not set, then one must to a full Top-down setting of the ordinals.

The Bottom-up/Top-down algorithm is MUCH faster than the Top-down algorithm.

Parameters:
schemaReader - Schema reader
seedMember - Member

setParentMember

void setParentMember(RolapMember parentMember)
Sets a member's parent.

Can screw up the caching structure. Only to be called by CacheControl.createMoveCommand(mondrian.olap.Member, mondrian.olap.Member).

New parent must be in same level as old parent.

Parameters:
parentMember - New parent member
See Also:
getParentMember(), MemberBase.getParentUniqueName()

keyToString

protected static String keyToString(Object key)
Converts a key to a string to be used as part of the member's name and unique name.

Usually, it just calls Object.toString(). But if the key is an integer value represented in a floating-point column, we'd prefer the integer value. For example, one member of the [Sales].[Store SQFT] dimension comes out "20319.0" but we'd like it to be "20319".


getLogger

protected org.apache.log4j.Logger getLogger()
Specified by:
getLogger in class OlapElementBase

getLevel

public RolapLevel getLevel()
Specified by:
getLevel in interface Member
Overrides:
getLevel in class MemberBase

getHierarchy

public RolapHierarchy getHierarchy()
Specified by:
getHierarchy in interface Member
Specified by:
getHierarchy in interface OlapElement
Overrides:
getHierarchy in class MemberBase

getParentMember

public RolapMember getParentMember()
Description copied from interface: Member
Returns this member's parent, or null (not the 'null member', as returned by Hierarchy.getNullMember()) if it has no parent.

In an access-control context, a member may have no visible parents, so use SchemaReader.getMemberParent(mondrian.olap.Member).

Specified by:
getParentMember in interface Member
Overrides:
getParentMember in class MemberBase

hashCode

public int hashCode()
Overrides:
hashCode in class OlapElementBase

equals

public boolean equals(Object o)
Overrides:
equals in class OlapElementBase

equals

public boolean equals(OlapElement o)
Overrides:
equals in class OlapElementBase

makeUniqueName

void makeUniqueName(HierarchyUsage hierarchyUsage)

setUniqueName

protected void setUniqueName(Object key)

isCalculatedInQuery

public boolean isCalculatedInQuery()
Description copied from interface: Member
Returns whether this member is computed from a WITH MEMBER clause in an MDX query.


getName

public String getName()
Specified by:
getName in interface OlapElement
Specified by:
getName in class MemberBase

setName

public void setName(String name)
Description copied from interface: Member
Only allowable if the member is part of the WITH clause of a query.


setProperty

public void setProperty(String name,
                        Object value)
Sets a property of this member to a given value.

WARNING: Setting system properties such as "$name" may have nasty side-effects.


getPropertyValue

public final Object getPropertyValue(String propertyName)
Description copied from interface: Member
Returns the value of the property named propertyName. Name match is case-sensitive.


getPropertyValue

public Object getPropertyValue(String propertyName,
                               boolean matchCase)
Description copied from interface: Member
Returns the value of the property named propertyName, matching according to the required case-sensitivity.


getPropertyFromMap

protected Object getPropertyFromMap(String propertyName,
                                    boolean matchCase)
Returns the value of a property by looking it up in the property map.

Parameters:
propertyName - Name of property
matchCase - Whether to match name case-sensitive
Returns:
Property value

childLevelHasApproxRowCount

protected boolean childLevelHasApproxRowCount()

isAllMember

protected boolean isAllMember()

getProperties

public Property[] getProperties()
Description copied from interface: Member
Returns the definitions of the properties this member may have.


getOrdinal

public int getOrdinal()
Description copied from class: MemberBase
Returns the ordinal of this member within its hierarchy. The default implementation returns -1.

Specified by:
getOrdinal in interface Member
Overrides:
getOrdinal in class MemberBase

getOrderKey

public Comparable getOrderKey()
Description copied from class: MemberBase
Returns the order key of this member among its siblings. The default implementation returns null.

Specified by:
getOrderKey in interface Member
Overrides:
getOrderKey in class MemberBase

setOrdinal

void setOrdinal(int ordinal)

setOrderKey

void setOrderKey(Comparable orderKey)

getKey

public Object getKey()

compareTo

public int compareTo(Object o)
Compares this member to another RolapMember.

The method first compares on keys; null keys always collate last. If the keys are equal, it compares using unique name.

This method does not consider ordinal field, because ordinal is only unique within a parent. If you want to compare members which may be at any position in the hierarchy, use FunUtil.compareHierarchically(mondrian.olap.Member, mondrian.olap.Member, boolean).

Returns:
-1 if this is less, 0 if this is the same, 1 if this is greater

isHidden

public boolean isHidden()
Description copied from interface: Member
Returns whether this member is 'hidden', as per the rules which define a ragged hierarchy.

Specified by:
isHidden in interface Member
Overrides:
isHidden in class MemberBase

getDepth

public int getDepth()
Description copied from interface: Member
returns the depth of this member, which is not the level's depth in case of parent child dimensions

Returns:
depth

getPropertyFormattedValue

public String getPropertyFormattedValue(String propertyName)
Description copied from interface: Member
Returns the formatted value of the property named propertyName.

Specified by:
getPropertyFormattedValue in interface Member
Overrides:
getPropertyFormattedValue in class MemberBase

SourceForge.net_Logo