|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mondrian.olap.OlapElementBase mondrian.olap.HierarchyBase mondrian.rolap.RolapHierarchy
public class RolapHierarchy
RolapHierarchy
implements Hierarchy
for a ROLAP database.
Nested Class Summary | |
---|---|
static class |
RolapHierarchy.LimitedRollupMember
Substitute for a member in a hierarchy whose rollup policy is 'partial' or 'hidden'. |
protected static class |
RolapHierarchy.RolapCalculatedMeasure
Calculated member which is also a measure (that is, a member of the [Measures] dimension). |
(package private) static class |
RolapHierarchy.RolapNullMember
A RolapNullMember is the null member of its hierarchy. |
Field Summary | |
---|---|
(package private) Type |
memberType
Type for members of this hierarchy. |
protected RolapLevel |
nullLevel
The level that the null member belongs too. |
protected MondrianDef.RelationOrJoin |
relation
|
protected MondrianDef.Hierarchy |
xmlHierarchy
|
Fields inherited from class mondrian.olap.HierarchyBase |
---|
allLevelName, allMemberName, description, dimension, hasAll, levels, name, subName, uniqueName |
Fields inherited from class mondrian.olap.OlapElementBase |
---|
caption |
Constructor Summary | |
---|---|
RolapHierarchy(RolapDimension dimension,
MondrianDef.Hierarchy xmlHierarchy,
MondrianDef.CubeDimension xmlCubeDimension)
Creates a RolapHierarchy . |
|
RolapHierarchy(RolapDimension dimension,
String subName,
boolean hasAll)
|
Method Summary | |
---|---|
(package private) void |
addToFrom(SqlQuery query,
MondrianDef.Expression expression)
Adds to the FROM clause of the query the tables necessary to access the members of this hierarchy. |
(package private) void |
addToFrom(SqlQuery query,
RolapStar.Table table)
Adds a table to the FROM clause of the query. |
protected int |
computeHashCode()
Computes this object's hash code. |
(package private) RolapDimension |
createClosedPeerDimension(RolapLevel src,
MondrianDef.Closure clos,
MondrianDef.CubeDimension xmlDimension)
Builds a dimension which maps onto a table holding the transitive closure of the relationship for this parent-child level. |
Member |
createMember(Member parent,
Level level,
String name,
Formula formula)
Creates a member of this hierarchy. |
(package private) MemberReader |
createMemberReader(Role role)
Creates a member reader which enforces the access-control profile of role . |
boolean |
equals(Object o)
|
(package private) Exp |
getAggregateChildrenExpression()
Returns an expression which will compute a member's value by aggregating its children. |
(package private) String |
getAlias()
|
RolapMember |
getAllMember()
Returns the 'all' member. |
Member |
getDefaultMember()
Returns the default member of this hierarchy. |
protected org.apache.log4j.Logger |
getLogger()
|
(package private) MemberReader |
getMemberReader()
|
Member |
getNullMember()
Returns a special member representing the "null" value. |
MondrianDef.RelationOrJoin |
getRelation()
|
RolapSchema |
getRolapSchema()
|
String |
getSharedHierarchyName()
Returns the name of the source hierarchy, if this hierarchy is shared, otherwise null. |
(package private) MondrianDef.Relation |
getUniqueTable()
If this hierarchy has precisely one table, returns that table; if this hierarchy has no table, return the cube's fact-table; otherwise, returns null. |
MondrianDef.Hierarchy |
getXmlHierarchy()
|
(package private) void |
init(MondrianDef.CubeDimension xmlDimension)
Initializes a hierarchy within the context of a cube. |
boolean |
isRagged()
A hierarchy is ragged if it contains one or more levels with hidden members. |
(package private) RolapLevel |
newMeasuresLevel()
|
void |
setDefaultMember(Member defaultMember)
Sets default member of this Hierarchy. |
(package private) void |
setMemberReader(MemberReader memberReader)
|
(package private) boolean |
tableExists(String tableName)
|
Methods inherited from class mondrian.olap.HierarchyBase |
---|
equals, getAllLevelName, getAllMemberName, getDescription, getDimension, getHierarchy, getLevels, getName, getQualifiedName, getSubName, getUniqueName, hasAll, lookupChild, lookupChild |
Methods inherited from class mondrian.olap.OlapElementBase |
---|
clone, getCaption, hashCode, setCaption, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface mondrian.olap.OlapElement |
---|
getCaption |
Field Detail |
---|
protected MondrianDef.Hierarchy xmlHierarchy
protected MondrianDef.RelationOrJoin relation
final Type memberType
protected final RolapLevel nullLevel
Constructor Detail |
---|
RolapHierarchy(RolapDimension dimension, String subName, boolean hasAll)
RolapHierarchy(RolapDimension dimension, MondrianDef.Hierarchy xmlHierarchy, MondrianDef.CubeDimension xmlCubeDimension)
RolapHierarchy
.
dimension
- the dimension this hierarchy belongs toxmlHierarchy
- the xml object defining this hierarchyxmlCubeDimension
- the xml object defining the cube
dimension for this objectMethod Detail |
---|
protected org.apache.log4j.Logger getLogger()
getLogger
in class OlapElementBase
public boolean equals(Object o)
equals
in class OlapElementBase
protected int computeHashCode()
OlapElementBase
computeHashCode
in class OlapElementBase
void init(MondrianDef.CubeDimension xmlDimension)
void setMemberReader(MemberReader memberReader)
MemberReader getMemberReader()
RolapLevel newMeasuresLevel()
MondrianDef.Relation getUniqueTable()
boolean tableExists(String tableName)
public RolapSchema getRolapSchema()
public MondrianDef.RelationOrJoin getRelation()
public MondrianDef.Hierarchy getXmlHierarchy()
public Member getDefaultMember()
Hierarchy
If a hierarchy is subject to access-control, the default member may
not be visible, so use SchemaReader.getHierarchyDefaultMember(mondrian.olap.Hierarchy)
.
public Member getNullMember()
Hierarchy
Lead
,
NextMember
and ParentMember
walk off the end
of the hierarchy.
public RolapMember getAllMember()
public Member createMember(Member parent, Level level, String name, Formula formula)
Hierarchy
formula
must not be null.
String getAlias()
public String getSharedHierarchyName()
If this hierarchy is a public -- that is, it belongs to a dimension
which is a usage of a shared dimension -- then
sharedHierarchyName
holds the unique name of the shared
hierarchy; otherwise it is null.
Suppose this hierarchy is "Weekly" in the dimension "Order Date" of
cube "Sales", and that "Order Date" is a usage of the "Time"
dimension. Then sharedHierarchyName
will be
"[Time].[Weekly]".
void addToFrom(SqlQuery query, MondrianDef.Expression expression)
expression
is not null, adds
the tables necessary to compute that expression.
This method is idempotent: if you call it more than once, it only adds the table(s) to the FROM clause once.
query
- Query to add the hierarchy toexpression
- Level to qualify up to; if null, qualifies up to the
topmost ('all') expression, which may require more columns and more joinsvoid addToFrom(SqlQuery query, RolapStar.Table table)
table
is not null, adds the table. Otherwise, add the
relation on which this hierarchy is based on.
This method is idempotent: if you call it more than once, it only adds the table(s) to the FROM clause once.
query
- Query to add the hierarchy totable
- table to add to the queryMemberReader createMemberReader(Role role)
role
.
This method may not be efficient, so the caller should take care not to call it too often. A cache is a good idea.
public boolean isRagged()
isRagged
in class HierarchyBase
Exp getAggregateChildrenExpression()
It is efficient to share one expression between all calculated members in a parent-child hierarchy, so we only need need to validate the expression once.
RolapDimension createClosedPeerDimension(RolapLevel src, MondrianDef.Closure clos, MondrianDef.CubeDimension xmlDimension)
This method is triggered by the
MondrianDef.Closure
element
in a schema, and is only meaningful for a parent-child hierarchy.
When a Schema contains a parent-child Hierarchy that has an associated closure table, Mondrian creates a parallel internal Hierarchy, called a "closed peer", that refers to the closure table. This is indicated in the schema at the level of a Level, by including a Closure element. The closure table represents the transitive closure of the parent-child relationship.
The peer dimension, with its single hierarchy, and 3 levels (all, closure, item) really 'belong to' the parent-child level. If a single hierarchy had two parent-child levels (however unlikely this might be) then each level would have its own auxiliary dimension.
For example, in the demo schema the [HR].[Employee] dimension contains a parent-child hierarchy:
<Dimension name="Employees" foreignKey="employee_id"> <Hierarchy hasAll="true" allMemberName="All Employees" primaryKey="employee_id"> <Table name="employee"/> <Level name="Employee Id" type="Numeric" uniqueMembers="true" column="employee_id" parentColumn="supervisor_id" nameColumn="full_name" nullParentValue="0"> <Closure parentColumn="supervisor_id" childColumn="employee_id"> <Table name="employee_closure"/> </Closure> ...The internal closed peer Hierarchy has this structure:
<Dimension name="Employees" foreignKey="employee_id"> ... <Hierarchy name="Employees$Closure" hasAll="true" allMemberName="All Employees" primaryKey="employee_id" primaryKeyTable="employee_closure"> <Join leftKey="supervisor_id" rightKey="employee_id"> <Table name="employee_closure"/> <Table name="employee"/> </Join> <Level name="Closure" type="Numeric" uniqueMembers="false" table="employee_closure" column="supervisor_id"/> <Level name="Employee" type="Numeric" uniqueMembers="true" table="employee_closure" column="employee_id"/> </Hierarchy>
Note that the original Level with the Closure produces two Levels in the closed peer Hierarchy: a simple peer (Employee) and a closed peer (Closure).
src
- a parent-child Level that has a Closure clauseclos
- a Closure clause
public void setDefaultMember(Member defaultMember)
defaultMember
- Default member
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |