Class DelegatingSchemaReader
- All Implemented Interfaces:
SchemaReader
DelegatingSchemaReader
implements SchemaReader
by
delegating all methods to an underlying SchemaReader
.
It is a convenient base class if you want to override just a few of
SchemaReader
's methods.
- Since:
- Feb 26, 2003
- Author:
- jhyde
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
DelegatingSchemaReader
(SchemaReader schemaReader) Creates a DelegatingSchemaReader. -
Method Summary
Modifier and TypeMethodDescriptionint
compareMembersHierarchically
(Member m1, Member m2) Compares a pair ofMember
s according to their order in a prefix traversal.getCalculatedMember
(List<Id.Segment> nameParts) Looks up a calculated member by name.Returns the list of calculated members.getCalculatedMembers
(Hierarchy hierarchy) Returns a list of calculated members in a given hierarchy.getCalculatedMembers
(Level level) Returns a list of calculated members in a given level.int
getChildrenCountFromCache
(Member member) Returns number of children parent of a member, if the information can be retrieved from cache, otherwise -1.getCube()
Returns the default cube in which to look for dimensions etc.getCubeDimensions
(Cube cube) Returns the accessible dimensions of a cube.Cube[]
getCubes()
Returns the list of accessible cubes.Returns the data source.getDimensionHierarchies
(Dimension dimension) Returns the accessible hierarchies of a dimension.getElementChild
(OlapElement parent, Id.Segment name) Looks up the child ofparent
name
, returning null if no element is found.getElementChild
(OlapElement parent, Id.Segment name, MatchType matchType) Looks up the child ofparent
calledname
, or an approximation according tomatchType
, returning null if no element is found.getHierarchyDefaultMember
(Hierarchy hierarchy) Returns the default member of a hierarchy.getHierarchyLevels
(Hierarchy hierarchy) Returns the accessible levels of a hierarchy.getHierarchyRootMembers
(Hierarchy hierarchy) Returns an array of the root members ofhierarchy
.getLeadMember
(Member member, int n) Returns a membern
further along in the same level frommember
.int
getLevelCardinality
(Level level, boolean approximate, boolean materialize) Returns the number of members in a level, returning an approximation if acceptable.getLevelMembers
(Level level, boolean includeCalculated) Returns the members of a level, optionally including calculated members.getLevelMembers
(Level level, Evaluator context) Returns the members of a level, optionally filtering out members which are empty.void
getMemberAncestors
(Member member, List<Member> ancestorList) Returns a list of ancestors ofmember
, in depth order.final Member
getMemberByUniqueName
(List<Id.Segment> uniqueNameParts, boolean failIfNotFound) Finds a member based upon its unique name, requiring an exact match.getMemberByUniqueName
(List<Id.Segment> uniqueNameParts, boolean failIfNotFound, MatchType matchType) Finds a member based upon its unique name.getMemberChildren
(List<Member> members) Returns direct children of each element ofmembers
.getMemberChildren
(List<Member> members, Evaluator context) Returns direct children of each element ofmembers
which is not empty incontext
.getMemberChildren
(Member member) Returns direct children ofmember
.getMemberChildren
(Member member, Evaluator context) Returns direct children ofmember
, optimized for NON EMPTY.getMemberChildrenWithDetails
(Member member, Evaluator evaluator) Similar toSchemaReader.getMemberChildren(Member, Evaluator)
but returns a map of the grand-children and their access details and costs more to invoke because of the access controls.int
getMemberDepth
(Member member) Returns the depth of a member.getMemberParent
(Member member) Returns the parent ofmember
.void
Appends tolist
all members betweenstartMember
andendMember
(inclusive) which belong tolevel
.getNamedSet
(List<Id.Segment> nameParts) Looks up a set by name.Returns a list of namespaces to search when resolving elements by name.getNativeSetEvaluator
(FunDef fun, Exp[] args, Evaluator evaluator, Calc calc) Returns an object which can evaluate an expression in native SQL, or null if this is not possible.getParameter
(String name) Returns the definition of a parameter with a given name, or null if not found.void
getParentChildContributingChildren
(Member dataMember, Hierarchy hierarchy, List<Member> list) Returns a list of contributing children of a member of a parent-child hierarchy.getRole()
Returns the access-control profile that thisSchemaReader
is implementing.Returns the schema.boolean
isDrillable
(Member member) Returns whether a member has visible children.boolean
Returns whether a member is visible.final OlapElement
lookupCompound
(OlapElement parent, List<Id.Segment> names, boolean failIfNotFound, int category) Looks up an MDX object by name.final OlapElement
lookupCompound
(OlapElement parent, List<Id.Segment> names, boolean failIfNotFound, int category, MatchType matchType) Looks up an MDX object by name, specifying how to match if no object exactly matches the name.lookupCompoundInternal
(OlapElement parent, List<Id.Segment> names, boolean failIfNotFound, int category, MatchType matchType) lookupMemberChildByName
(Member member, Id.Segment memberName, MatchType matchType) Finds a child of a member with a given name.lookupMemberChildrenByNames
(Member parent, List<Id.NameSegment> childNames, MatchType matchType) Finds a list of child members with the given names.substitute
(Member member) Substitutes a member with an equivalent member which enforces the access control policy of this SchemaReader.Returns a schema reader that automatically assigns a locus to each operation.Returns a similar schema reader that has no access control.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface mondrian.olap.SchemaReader
countMemberChildren
-
Field Details
-
schemaReader
-
-
Constructor Details
-
DelegatingSchemaReader
Creates a DelegatingSchemaReader.- Parameters:
schemaReader
- Parent reader to delegate unhandled calls to
-
-
Method Details
-
getSchema
Description copied from interface:SchemaReader
Returns the schema.- Specified by:
getSchema
in interfaceSchemaReader
- Returns:
- Schema, never null
-
getRole
Description copied from interface:SchemaReader
Returns the access-control profile that thisSchemaReader
is implementing.- Specified by:
getRole
in interfaceSchemaReader
-
getCube
Description copied from interface:SchemaReader
Returns the default cube in which to look for dimensions etc.- Specified by:
getCube
in interfaceSchemaReader
- Returns:
- Default cube
-
getCubeDimensions
Description copied from interface:SchemaReader
Returns the accessible dimensions of a cube.- Specified by:
getCubeDimensions
in interfaceSchemaReader
-
getDimensionHierarchies
Description copied from interface:SchemaReader
Returns the accessible hierarchies of a dimension.- Specified by:
getDimensionHierarchies
in interfaceSchemaReader
-
getHierarchyRootMembers
Description copied from interface:SchemaReader
Returns an array of the root members ofhierarchy
.- Specified by:
getHierarchyRootMembers
in interfaceSchemaReader
- Parameters:
hierarchy
- Hierarchy- See Also:
-
getMemberParent
Description copied from interface:SchemaReader
Returns the parent ofmember
.- Specified by:
getMemberParent
in interfaceSchemaReader
- Parameters:
member
- Member- Returns:
- null if member is a root member
-
substitute
Description copied from interface:SchemaReader
Substitutes a member with an equivalent member which enforces the access control policy of this SchemaReader.- Specified by:
substitute
in interfaceSchemaReader
-
getMemberChildren
Description copied from interface:SchemaReader
Returns direct children ofmember
.- Specified by:
getMemberChildren
in interfaceSchemaReader
-
getMemberChildren
Description copied from interface:SchemaReader
Returns direct children of each element ofmembers
.- Specified by:
getMemberChildren
in interfaceSchemaReader
- Parameters:
members
- Array of members- Returns:
- array of child members
-
getParentChildContributingChildren
public void getParentChildContributingChildren(Member dataMember, Hierarchy hierarchy, List<Member> list) Description copied from interface:SchemaReader
Returns a list of contributing children of a member of a parent-child hierarchy.- Specified by:
getParentChildContributingChildren
in interfaceSchemaReader
- Parameters:
dataMember
- Data member for a member of the parent-child hierarcyhierarchy
- Hierarchylist
- List of members to populate
-
getMemberDepth
Description copied from interface:SchemaReader
Returns the depth of a member.This may not be the same as
member.
for three reasons:getLevel
().getDepth
()- Access control. The most senior visible member has level 0. If the client is not allowed to see the "All" and "Nation" levels of the "Store" hierarchy, then members of the "State" level will have depth 0.
- Parent-child hierarchies. Suppose Fred reports to Wilma, and Wilma reports to no one. "All Employees" has depth 0, Wilma has depth 1, and Fred has depth 2. Fred and Wilma are both in the "Employees" level, which has depth 1.
- Ragged hierarchies. If Israel has only one, hidden, province then the depth of Tel Aviv, Israel is 2, whereas the depth of another city, San Francisco, CA, USA is 3.
- Specified by:
getMemberDepth
in interfaceSchemaReader
-
getMemberByUniqueName
Description copied from interface:SchemaReader
Finds a member based upon its unique name, requiring an exact match.This method is equivalent to calling
SchemaReader.getMemberByUniqueName(java.util.List, boolean, MatchType)
withMatchType.EXACT
.- Specified by:
getMemberByUniqueName
in interfaceSchemaReader
- Parameters:
uniqueNameParts
- Unique name of memberfailIfNotFound
- Whether to throw an error, as opposed to returningnull
, if there is no such member.- Returns:
- The member, or null if not found
-
getMemberByUniqueName
public Member getMemberByUniqueName(List<Id.Segment> uniqueNameParts, boolean failIfNotFound, MatchType matchType) Description copied from interface:SchemaReader
Finds a member based upon its unique name.- Specified by:
getMemberByUniqueName
in interfaceSchemaReader
- Parameters:
uniqueNameParts
- Unique name of memberfailIfNotFound
- Whether to throw an error, as opposed to returningnull
, if there is no such member.matchType
- indicates the match mode; if not specified, EXACT- Returns:
- The member, or null if not found
-
lookupCompound
public final OlapElement lookupCompound(OlapElement parent, List<Id.Segment> names, boolean failIfNotFound, int category) Description copied from interface:SchemaReader
Looks up an MDX object by name.Resolves a name such as '[Products].[Product Department].[Produce]' by resolving the components ('Products', and so forth) one at a time.
- Specified by:
lookupCompound
in interfaceSchemaReader
- Parameters:
parent
- Parent element to search innames
- Exploded compound name, such as {"Products", "Product Department", "Produce"}failIfNotFound
- If the element is not found, determines whether to return null or throw an errorcategory
- Type of returned element, aCategory
value;Category.Unknown
if it doesn't matter.
-
lookupCompound
public final OlapElement lookupCompound(OlapElement parent, List<Id.Segment> names, boolean failIfNotFound, int category, MatchType matchType) Description copied from interface:SchemaReader
Looks up an MDX object by name, specifying how to match if no object exactly matches the name.Resolves a name such as '[Products].[Product Department].[Produce]' by resolving the components ('Products', and so forth) one at a time.
- Specified by:
lookupCompound
in interfaceSchemaReader
- Parameters:
parent
- Parent element to search innames
- Exploded compound name, such as {"Products", "Product Department", "Produce"}failIfNotFound
- If the element is not found, determines whether to return null or throw an errorcategory
- Type of returned element, aCategory
value;Category.Unknown
if it doesn't matter.matchType
- indicates the match mode; if not specified, EXACT
-
getNamespaces
Description copied from interface:SchemaReader
Returns a list of namespaces to search when resolving elements by name.For example, a schema reader from the perspective of a cube will return cube and schema namespaces.
- Specified by:
getNamespaces
in interfaceSchemaReader
- Returns:
- List of namespaces
-
lookupCompoundInternal
public OlapElement lookupCompoundInternal(OlapElement parent, List<Id.Segment> names, boolean failIfNotFound, int category, MatchType matchType) -
getCalculatedMember
Description copied from interface:SchemaReader
Looks up a calculated member by name. If the name is not found in the current scope, returns null.- Specified by:
getCalculatedMember
in interfaceSchemaReader
-
getNamedSet
Description copied from interface:SchemaReader
Looks up a set by name. If the name is not found in the current scope, returns null.- Specified by:
getNamedSet
in interfaceSchemaReader
-
getMemberRange
Description copied from interface:SchemaReader
Appends tolist
all members betweenstartMember
andendMember
(inclusive) which belong tolevel
.- Specified by:
getMemberRange
in interfaceSchemaReader
-
getLeadMember
Description copied from interface:SchemaReader
Returns a membern
further along in the same level frommember
.- Specified by:
getLeadMember
in interfaceSchemaReader
-
compareMembersHierarchically
Description copied from interface:SchemaReader
Compares a pair ofMember
s according to their order in a prefix traversal. (that is, it is an ancestor or a earlier), is a sibling, or comes later in a prefix traversal.- Specified by:
compareMembersHierarchically
in interfaceSchemaReader
- Returns:
- A negative integer if
m1
is an ancestor, an earlier sibling of an ancestor, or a descendent of an earlier sibling, ofm2
; zero ifm1
is a sibling ofm2
; a positive integer ifm1
comes later in the prefix traversal thenm2
.
-
getElementChild
Description copied from interface:SchemaReader
Looks up the child ofparent
name
, returning null if no element is found.Always equivalent to
getElementChild(parent, name, MatchType.EXACT)
.- Specified by:
getElementChild
in interfaceSchemaReader
- Parameters:
parent
- Parent element to search inname
- Compound in compound name, such as "[Product]" or "&[1]"- Returns:
- Element with given name, or null
-
getElementChild
Description copied from interface:SchemaReader
Looks up the child ofparent
calledname
, or an approximation according tomatchType
, returning null if no element is found.- Specified by:
getElementChild
in interfaceSchemaReader
- Parameters:
parent
- Parent element to search inname
- Compound in compound name, such as "[Product]" or "&[1]"matchType
- Match type- Returns:
- Element with given name, or null
-
getLevelMembers
Description copied from interface:SchemaReader
Returns the members of a level, optionally including calculated members.- Specified by:
getLevelMembers
in interfaceSchemaReader
-
getHierarchyLevels
Description copied from interface:SchemaReader
Returns the accessible levels of a hierarchy.- Specified by:
getHierarchyLevels
in interfaceSchemaReader
- Parameters:
hierarchy
- Hierarchy
-
getHierarchyDefaultMember
Description copied from interface:SchemaReader
Returns the default member of a hierarchy. If the default member is in an inaccessible level, returns the nearest ascendant/descendant member.- Specified by:
getHierarchyDefaultMember
in interfaceSchemaReader
- Parameters:
hierarchy
- Hierarchy- Returns:
- Default member of hierarchy
-
isDrillable
Description copied from interface:SchemaReader
Returns whether a member has visible children.- Specified by:
isDrillable
in interfaceSchemaReader
-
isVisible
Description copied from interface:SchemaReader
Returns whether a member is visible.- Specified by:
isVisible
in interfaceSchemaReader
-
getCubes
Description copied from interface:SchemaReader
Returns the list of accessible cubes.- Specified by:
getCubes
in interfaceSchemaReader
-
getCalculatedMembers
Description copied from interface:SchemaReader
Returns a list of calculated members in a given hierarchy.- Specified by:
getCalculatedMembers
in interfaceSchemaReader
-
getCalculatedMembers
Description copied from interface:SchemaReader
Returns a list of calculated members in a given level.- Specified by:
getCalculatedMembers
in interfaceSchemaReader
-
getCalculatedMembers
Description copied from interface:SchemaReader
Returns the list of calculated members.- Specified by:
getCalculatedMembers
in interfaceSchemaReader
-
getChildrenCountFromCache
Description copied from interface:SchemaReader
Returns number of children parent of a member, if the information can be retrieved from cache, otherwise -1.- Specified by:
getChildrenCountFromCache
in interfaceSchemaReader
-
getLevelCardinality
Description copied from interface:SchemaReader
Returns the number of members in a level, returning an approximation if acceptable.- Specified by:
getLevelCardinality
in interfaceSchemaReader
- Parameters:
level
- Levelapproximate
- Whether an approximation is acceptablematerialize
- Whether to go to disk if no approximation for the count is available and the members are not in cache. If false, returnsInteger.MIN_VALUE
if value is not in cache.
-
getLevelMembers
Description copied from interface:SchemaReader
Returns the members of a level, optionally filtering out members which are empty.- Specified by:
getLevelMembers
in interfaceSchemaReader
- Parameters:
level
- Levelcontext
- Context for filtering- Returns:
- Members of this level
-
getMemberChildren
Description copied from interface:SchemaReader
Returns direct children ofmember
, optimized for NON EMPTY.If
context == null
then there is no context and all members are returned - then its identical toSchemaReader.getMemberChildren(Member)
. Ifcontext
is not null, the resulting members may be restricted to those members that have a non empty row in the fact table forcontext
. Wether or not optimization is possible depends on the SchemaReader implementation.- Specified by:
getMemberChildren
in interfaceSchemaReader
-
getMemberChildren
Description copied from interface:SchemaReader
Returns direct children of each element ofmembers
which is not empty incontext
.- Specified by:
getMemberChildren
in interfaceSchemaReader
- Parameters:
members
- Array of memberscontext
- Evaluation context- Returns:
- array of child members
-
getMemberAncestors
Description copied from interface:SchemaReader
Returns a list of ancestors ofmember
, in depth order.For example, for [Store].[USA].[CA], returns {[Store].[USA], [Store].[All Stores]}.
- Specified by:
getMemberAncestors
in interfaceSchemaReader
- Parameters:
member
- MemberancestorList
- List of ancestors
-
lookupMemberChildByName
Description copied from interface:SchemaReader
Finds a child of a member with a given name.- Specified by:
lookupMemberChildByName
in interfaceSchemaReader
-
lookupMemberChildrenByNames
public List<Member> lookupMemberChildrenByNames(Member parent, List<Id.NameSegment> childNames, MatchType matchType) Description copied from interface:SchemaReader
Finds a list of child members with the given names.- Specified by:
lookupMemberChildrenByNames
in interfaceSchemaReader
-
getNativeSetEvaluator
public NativeEvaluator getNativeSetEvaluator(FunDef fun, Exp[] args, Evaluator evaluator, Calc calc) Description copied from interface:SchemaReader
Returns an object which can evaluate an expression in native SQL, or null if this is not possible.- Specified by:
getNativeSetEvaluator
in interfaceSchemaReader
- Parameters:
fun
- Functionargs
- Arguments to the functionevaluator
- Evaluator, provides contextcalc
- the calc to be natively evaluated
-
getParameter
Description copied from interface:SchemaReader
Returns the definition of a parameter with a given name, or null if not found.- Specified by:
getParameter
in interfaceSchemaReader
-
getDataSource
Description copied from interface:SchemaReader
Returns the data source.- Specified by:
getDataSource
in interfaceSchemaReader
- Returns:
- data source
-
withoutAccessControl
Description copied from interface:SchemaReader
Returns a similar schema reader that has no access control.- Specified by:
withoutAccessControl
in interfaceSchemaReader
- Returns:
- Schema reader that has a similar perspective (e.g. cube) but no access control
-
withLocus
Description copied from interface:SchemaReader
Returns a schema reader that automatically assigns a locus to each operation.It is less efficient; use this only if the operation is occurring outside the context of a statement. If you get the internal error "no locus", that's a sign you should use this method.
- Specified by:
withLocus
in interfaceSchemaReader
- Returns:
- Schema reader that assigns a locus to each operation
-
getMemberChildrenWithDetails
public Map<? extends Member,Access> getMemberChildrenWithDetails(Member member, Evaluator evaluator) Description copied from interface:SchemaReader
Similar toSchemaReader.getMemberChildren(Member, Evaluator)
but returns a map of the grand-children and their access details and costs more to invoke because of the access controls. Called byRolapHierarchy
when determining the lowest access level of a Role within a hierarchy.- Specified by:
getMemberChildrenWithDetails
in interfaceSchemaReader
-