Class RolapMemberBase
- java.lang.Object
-
- mondrian.olap.OlapElementBase
-
- mondrian.olap.MemberBase
-
- mondrian.rolap.RolapMemberBase
-
- All Implemented Interfaces:
Comparable,Annotated,Member,OlapElement,RolapCalculation,RolapMember
- Direct Known Subclasses:
DelegatingRolapMember,RolapBaseCubeMeasure,RolapCalculatedMember,RolapHierarchy.RolapNullMember,RolapVirtualCubeMeasure,VisualTotalsFunDef.VisualTotalMember
public class RolapMemberBase extends MemberBase implements RolapMember
Basic implementation of a member in aRolapHierarchy.- Since:
- 10 August, 2001
- Author:
- jhyde
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRolapMemberBase.DefaultPropertyValueMapFactoryDefaultRolapMemberBase.PropertyValueMapFactoryimplementation, used ifMondrianProperties.PropertyValueMapFactoryClassis not set.static interfaceRolapMemberBase.PropertyValueMapFactoryInterface definition for the pluggable factory used to decide which implementation ofMapto use to store property string/value pairs for member properties.static classRolapMemberBase.PropertyValueMapFactoryFactoryCreates the PropertyValueMapFactory which is in turn used to create property-value maps for member properties.-
Nested classes/interfaces inherited from interface mondrian.olap.Member
Member.MemberType
-
Nested classes/interfaces inherited from interface mondrian.olap.OlapElement
OlapElement.LocalizedProperty
-
-
Field Summary
-
Fields inherited from class mondrian.olap.MemberBase
flags, level, parentMember, uniqueName
-
Fields inherited from class mondrian.olap.OlapElementBase
caption, visible
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRolapMemberBase()(package private)RolapMemberBase(RolapMember parentMember, RolapLevel level, Object value)protectedRolapMemberBase(RolapMember parentMember, RolapLevel level, Object key, String name, Member.MemberType memberType)Creates a RolapMemberBase.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected booleanchildLevelHasApproxRowCount()intcompareTo(Object o)Compares this member to anotherRolapMemberBase.booleancontainsAggregateFunction()Returns whether this calculation contains an aggregate function.booleanequals(Object o)booleanequals(OlapElement o)static List<List<Member>>getAllMembers(SchemaReader schemaReader, Hierarchy hierarchy)Returns a list of member lists where the first member list is the root members while the last member array is the leaf members.Map<String,Annotation>getAnnotationMap()Returns a list of annotations.CalcgetCompiledExpression(RolapEvaluatorRoot root)Returns the compiled expression to evaluate the scalar value of the current cell.intgetDepth()returns the depth of this member, which is not the level's depth in case of parent child dimensionsRolapHierarchygetHierarchy()static intgetHierarchyCardinality(SchemaReader schemaReader, Hierarchy hierarchy)intgetHierarchyOrdinal()Returns the ordinal of this calculation; to resolve ties.ObjectgetKey()RolapLevelgetLevel()protected org.apache.log4j.LoggergetLogger()StringgetName()ComparablegetOrderKey()Returns the order key of this member among its siblings.intgetOrdinal()Returns the ordinal of this member within its hierarchy.RolapMembergetParentMember()Returns this member's parent, or null (not the 'null member', as returned byHierarchy.getNullMember()) if it has no parent.Property[]getProperties()Returns the definitions of the properties this member may have.StringgetPropertyFormattedValue(String propertyName)Returns the formatted value of the property namedpropertyName.protected ObjectgetPropertyFromMap(String propertyName, boolean matchCase)Returns the value of a property by looking it up in the property map.ObjectgetPropertyValue(String propertyName)Returns the value of the property namedpropertyName.ObjectgetPropertyValue(String propertyName, boolean matchCase)Returns the value of the property namedpropertyName, matching according to the required case-sensitivity.inthashCode()booleanisAllMember()Deprecated.UseMemberBase.isAll(); will be removed in mondrian-4.0booleanisCalculatedInQuery()Returns whether this member is computed from aWITH MEMBERclause in an MDX query.booleanisHidden()Returns whether this member is 'hidden', as per the rules which define a ragged hierarchy.booleanisParentChildLeaf()protected static StringkeyToString(Object key)Converts a key to a string to be used as part of the member's name and unique name.(package private) voidmakeUniqueName(HierarchyUsage hierarchyUsage)voidsetContextIn(RolapEvaluator evaluator)Pushes this calculated member or tuple onto the stack of evaluation contexts, and sets the context to the default member of the hierarchy.voidsetName(String name)Only allowable if the member is part of theWITHclause of a query.(package private) voidsetOrderKey(Comparable orderKey)(package private) voidsetOrdinal(int ordinal)static voidsetOrdinals(SchemaReader schemaReader, Member seedMember)Sets member ordinal values using a Bottom-up/Top-down algorithm.(package private) voidsetParentMember(RolapMember parentMember)Sets a member's parent.voidsetProperty(String name, Object value)Sets a property of this member to a given value.protected voidsetUniqueName(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, isEvaluated, isMeasure, isNull, isParentChildPhysicalMember, lookupChild
-
Methods inherited from class mondrian.olap.OlapElementBase
clone, computeHashCode, getLocalized, isVisible, setCaption, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface mondrian.olap.Member
getAncestorMembers, getDataMember, getExpression, getMemberType, getParentUniqueName, getSolveOrder, isAll, isCalculated, isChildOrEqualTo, isEvaluated, isMeasure, isNull, isParentChildPhysicalMember
-
Methods inherited from interface mondrian.olap.OlapElement
getCaption, getDescription, getDimension, getLocalized, getQualifiedName, getUniqueName, isVisible, lookupChild
-
Methods inherited from interface mondrian.rolap.RolapCalculation
getSolveOrder
-
-
-
-
Constructor Detail
-
RolapMemberBase
protected RolapMemberBase(RolapMember parentMember, RolapLevel level, Object key, String name, Member.MemberType memberType)
Creates a RolapMemberBase.- Parameters:
parentMember- Parent memberlevel- Level this member belongs tokey- Key to this member in the underlying RDBMSname- Name of this membermemberType- Type of member
-
RolapMemberBase
protected RolapMemberBase()
-
RolapMemberBase
RolapMemberBase(RolapMember parentMember, RolapLevel level, Object value)
-
-
Method Detail
-
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()
-
getLogger
protected org.apache.log4j.Logger getLogger()
- Specified by:
getLoggerin classOlapElementBase
-
getLevel
public RolapLevel getLevel()
- Specified by:
getLevelin interfaceMember- Specified by:
getLevelin interfaceRolapMember- Overrides:
getLevelin classMemberBase
-
getHierarchy
public RolapHierarchy getHierarchy()
- Specified by:
getHierarchyin interfaceMember- Specified by:
getHierarchyin interfaceOlapElement- Specified by:
getHierarchyin interfaceRolapMember- Overrides:
getHierarchyin classMemberBase
-
getParentMember
public RolapMember getParentMember()
Description copied from interface:MemberReturns this member's parent, or null (not the 'null member', as returned byHierarchy.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:
getParentMemberin interfaceMember- Specified by:
getParentMemberin interfaceRolapMember- Overrides:
getParentMemberin classMemberBase
-
getAnnotationMap
public Map<String,Annotation> getAnnotationMap()
Description copied from interface:AnnotatedReturns a list of annotations.The map may be empty, never null.
- Specified by:
getAnnotationMapin interfaceAnnotated- Returns:
- Map from annotation name to annotations.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classOlapElementBase
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classOlapElementBase
-
equals
public boolean equals(OlapElement o)
- Overrides:
equalsin classOlapElementBase
-
makeUniqueName
void makeUniqueName(HierarchyUsage hierarchyUsage)
-
setUniqueName
protected void setUniqueName(Object key)
-
isCalculatedInQuery
public boolean isCalculatedInQuery()
Description copied from interface:MemberReturns whether this member is computed from aWITH MEMBERclause in an MDX query.- Specified by:
isCalculatedInQueryin interfaceMember- Specified by:
isCalculatedInQueryin interfaceRolapCalculation- Returns:
- whether this calculation is computed in an MDX query
-
getName
public String getName()
- Specified by:
getNamein interfaceOlapElement- Specified by:
getNamein classMemberBase
-
setName
public void setName(String name)
Description copied from interface:MemberOnly allowable if the member is part of theWITHclause 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.
- Specified by:
setPropertyin interfaceMember
-
getPropertyValue
public Object getPropertyValue(String propertyName)
Description copied from interface:MemberReturns the value of the property namedpropertyName. Name match is case-sensitive.- Specified by:
getPropertyValuein interfaceMember
-
getPropertyValue
public Object getPropertyValue(String propertyName, boolean matchCase)
Description copied from interface:MemberReturns the value of the property namedpropertyName, matching according to the required case-sensitivity.- Specified by:
getPropertyValuein interfaceMember
-
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 propertymatchCase- Whether to match name case-sensitive- Returns:
- Property value
-
childLevelHasApproxRowCount
protected boolean childLevelHasApproxRowCount()
-
isAllMember
public boolean isAllMember()
Deprecated.UseMemberBase.isAll(); will be removed in mondrian-4.0- Specified by:
isAllMemberin interfaceRolapMember
-
getProperties
public Property[] getProperties()
Description copied from interface:MemberReturns the definitions of the properties this member may have.- Specified by:
getPropertiesin interfaceMember
-
getOrdinal
public int getOrdinal()
Description copied from class:MemberBaseReturns the ordinal of this member within its hierarchy. The default implementation returns -1.- Specified by:
getOrdinalin interfaceMember- Overrides:
getOrdinalin classMemberBase
-
getOrderKey
public Comparable getOrderKey()
Description copied from class:MemberBaseReturns the order key of this member among its siblings. The default implementation returns null.- Specified by:
getOrderKeyin interfaceMember- Overrides:
getOrderKeyin classMemberBase
-
setOrdinal
void setOrdinal(int ordinal)
-
setOrderKey
void setOrderKey(Comparable orderKey)
-
getKey
public Object getKey()
- Specified by:
getKeyin interfaceRolapMember
-
compareTo
public int compareTo(Object o)
Compares this member to anotherRolapMemberBase.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
ordinalfield, because ordinal is only unique within a parent. If you want to compare members which may be at any position in the hierarchy, useFunUtil.compareHierarchically(mondrian.olap.Member, mondrian.olap.Member, boolean).- Specified by:
compareToin interfaceComparable- 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:MemberReturns whether this member is 'hidden', as per the rules which define a ragged hierarchy.- Specified by:
isHiddenin interfaceMember- Overrides:
isHiddenin classMemberBase
-
getDepth
public int getDepth()
Description copied from interface:Memberreturns the depth of this member, which is not the level's depth in case of parent child dimensions
-
getPropertyFormattedValue
public String getPropertyFormattedValue(String propertyName)
Description copied from interface:MemberReturns the formatted value of the property namedpropertyName.- Specified by:
getPropertyFormattedValuein interfaceMember- Overrides:
getPropertyFormattedValuein classMemberBase
-
isParentChildLeaf
public boolean isParentChildLeaf()
- Specified by:
isParentChildLeafin interfaceMember- Overrides:
isParentChildLeafin classMemberBase- Returns:
- True when the member is a leaf member, meaning it has no children
-
getAllMembers
public static List<List<Member>> getAllMembers(SchemaReader schemaReader, Hierarchy hierarchy)
Returns a list of member lists where the first member list is the root members while the last member array is 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 readerhierarchy- 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 readerseedMember- Member
-
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".
-
containsAggregateFunction
public boolean containsAggregateFunction()
Description copied from interface:RolapCalculationReturns whether this calculation contains an aggregate function.- Specified by:
containsAggregateFunctionin interfaceRolapCalculation- Returns:
- Whether this calculation contains an aggregate function.
-
getCompiledExpression
public Calc getCompiledExpression(RolapEvaluatorRoot root)
Description copied from interface:RolapCalculationReturns the compiled expression to evaluate the scalar value of the current cell. This method will be called frequently, so the implementation should probably compile once and cache the result.- Specified by:
getCompiledExpressionin interfaceRolapCalculation- Parameters:
root- Root evaluation context- Returns:
- Compiled scalar expression
-
getHierarchyOrdinal
public int getHierarchyOrdinal()
Description copied from interface:RolapCalculationReturns the ordinal of this calculation; to resolve ties.- Specified by:
getHierarchyOrdinalin interfaceRolapCalculation- Returns:
- Ordinal or calculation
-
setContextIn
public void setContextIn(RolapEvaluator evaluator)
Description copied from interface:RolapCalculationPushes this calculated member or tuple onto the stack of evaluation contexts, and sets the context to the default member of the hierarchy.- Specified by:
setContextInin interfaceRolapCalculation- Parameters:
evaluator- Evaluator
-
-