mondrian.rolap
Class RestrictedMemberReader

java.lang.Object
  extended by mondrian.rolap.DelegatingMemberReader
      extended by mondrian.rolap.RestrictedMemberReader
All Implemented Interfaces:
MemberReader, MemberSource

 class RestrictedMemberReader
extends DelegatingMemberReader

A RestrictedMemberReader reads only the members of a hierarchy allowed by a role's access profile.

Since:
Feb 26, 2003
Author:
jhyde
 

Field Summary
 
Fields inherited from class mondrian.rolap.DelegatingMemberReader
memberReader
 
Constructor Summary
RestrictedMemberReader(MemberReader memberReader, Role role)
          Creates a RestrictedMemberReader.
 
Method Summary
 RolapMember getDefaultMember()
           
 RolapMember getLeadMember(RolapMember member, int n)
          Returns the member n after member in the same level (or before, if n is negative).
 void getMemberChildren(List<RolapMember> parentMembers, List<RolapMember> children)
          Returns all members which are a child of one of the members in parentMembers, sorted by ordinal.
 void getMemberChildren(List<RolapMember> parentMembers, List<RolapMember> children, MemberChildrenConstraint constraint)
          Populates a list of the children of a given set of Members, optionally applying a constraint.
 void getMemberChildren(RolapMember parentMember, List<RolapMember> children)
          Writes all children parentMember to children.
 void getMemberChildren(RolapMember parentMember, List<RolapMember> children, MemberChildrenConstraint constraint)
          Populates a list of the children of a Member, optionally applying a constraint.
 RolapMember getMemberParent(RolapMember member)
           
 List<RolapMember> getMembersInLevel(RolapLevel level, int startOrdinal, int endOrdinal)
          Returns all of the members in level whose ordinal lies between startOrdinal and endOrdinal.
 List<RolapMember> getMembersInLevel(RolapLevel level, int startOrdinal, int endOrdinal, TupleConstraint constraint)
          Returns the members in the given Level, optionally between a range of ordinals and applying a constraint.
 List<RolapMember> getRootMembers()
          Returns all members of this hierarchy which do not have a parent, sorted by ordinal.
 boolean setCache(MemberCache cache)
          Sets the cache which this MemberSource will write to.
 
Methods inherited from class mondrian.rolap.DelegatingMemberReader
compare, desubstitute, getHierarchy, getLevelMemberCount, getMemberBuilder, getMemberCount, getMemberRange, getMembers, lookupMember, substitute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestrictedMemberReader

RestrictedMemberReader(MemberReader memberReader,
                       Role role)
Creates a RestrictedMemberReader.

There's no filtering to be done unless either the role has restrictions on this hierarchy, or the hierarchy is ragged; there's a pre-condition to this effect.

Pre-condition:
role.getAccessDetails(memberReader.getHierarchy()) != null || memberReader.getHierarchy().isRagged()
Parameters:
memberReader - Underlying (presumably unrestricted) member reader
role - Role whose access profile to obey. The role must have restrictions on this hierarchy
Method Detail

setCache

public boolean setCache(MemberCache cache)
Description copied from interface: MemberSource
Sets the cache which this MemberSource will write to.

Cache-writeback is optional (for example, SqlMemberSource supports it, and ArrayMemberSource does not), and the return value from this method indicates whether this object supports it.

If this method returns true, the MemberSource.getMembers(), MemberSource.getRootMembers() and MemberSource.getMemberChildren(mondrian.rolap.RolapMember, java.util.List) methods must write to the cache, in addition to returning members as a return value.

Specified by:
setCache in interface MemberSource
Overrides:
setCache in class DelegatingMemberReader
Parameters:
cache - The MemberCache which the caller would like this MemberSource to write to.
Returns:
Whether this MemberSource supports cache-writeback.

getLeadMember

public RolapMember getLeadMember(RolapMember member,
                                 int n)
Description copied from interface: MemberReader
Returns the member n after member in the same level (or before, if n is negative). Returns Hierarchy.getNullMember() if we run off the beginning or end of the level.

Specified by:
getLeadMember in interface MemberReader
Overrides:
getLeadMember in class DelegatingMemberReader

getMemberChildren

public void getMemberChildren(RolapMember parentMember,
                              List<RolapMember> children)
Description copied from interface: MemberSource
Writes all children parentMember to children.

If this object supports cache-writeback, also writes these members to the cache.

Specified by:
getMemberChildren in interface MemberSource
Overrides:
getMemberChildren in class DelegatingMemberReader

getMemberChildren

public void getMemberChildren(RolapMember parentMember,
                              List<RolapMember> children,
                              MemberChildrenConstraint constraint)
Description copied from interface: MemberReader
Populates a list of the children of a Member, optionally applying a constraint.

Specified by:
getMemberChildren in interface MemberReader
Overrides:
getMemberChildren in class DelegatingMemberReader
Parameters:
parentMember - Members whose children to find
children - List to populate with members
constraint - Constraint

getMemberChildren

public void getMemberChildren(List<RolapMember> parentMembers,
                              List<RolapMember> children)
Description copied from interface: MemberSource
Returns all members which are a child of one of the members in parentMembers, sorted by ordinal.

If this object supports cache-writeaback, also writes these members to the cache.

Specified by:
getMemberChildren in interface MemberSource
Overrides:
getMemberChildren in class DelegatingMemberReader

getMemberChildren

public void getMemberChildren(List<RolapMember> parentMembers,
                              List<RolapMember> children,
                              MemberChildrenConstraint constraint)
Description copied from interface: MemberReader
Populates a list of the children of a given set of Members, optionally applying a constraint.

Specified by:
getMemberChildren in interface MemberReader
Overrides:
getMemberChildren in class DelegatingMemberReader
Parameters:
parentMembers - List of members whose children to find
children - List to populate with members
constraint - Constraint

getRootMembers

public List<RolapMember> getRootMembers()
Description copied from interface: MemberSource
Returns all members of this hierarchy which do not have a parent, sorted by ordinal.

If this object supports cache-writeback, also writes these members to the cache.

Specified by:
getRootMembers in interface MemberSource
Overrides:
getRootMembers in class DelegatingMemberReader
Returns:
List of RolapMembers

getMembersInLevel

public List<RolapMember> getMembersInLevel(RolapLevel level,
                                           int startOrdinal,
                                           int endOrdinal)
Description copied from interface: MemberReader
Returns all of the members in level whose ordinal lies between startOrdinal and endOrdinal.

If this object supports cache-writeback, also writes these members to the cache.

Specified by:
getMembersInLevel in interface MemberReader
Overrides:
getMembersInLevel in class DelegatingMemberReader
Returns:
List of RolapMember

getMembersInLevel

public List<RolapMember> getMembersInLevel(RolapLevel level,
                                           int startOrdinal,
                                           int endOrdinal,
                                           TupleConstraint constraint)
Description copied from interface: MemberReader
Returns the members in the given Level, optionally between a range of ordinals and applying a constraint.

Specified by:
getMembersInLevel in interface MemberReader
Overrides:
getMembersInLevel in class DelegatingMemberReader
Parameters:
level - Level
startOrdinal - Ordinal of first member to retrieve
endOrdinal - Ordinal of last member to upper bound
constraint - Constraint
Returns:
list of members

getDefaultMember

public RolapMember getDefaultMember()
Specified by:
getDefaultMember in interface MemberReader
Overrides:
getDefaultMember in class DelegatingMemberReader

getMemberParent

public RolapMember getMemberParent(RolapMember member)
Specified by:
getMemberParent in interface MemberReader
Overrides:
getMemberParent in class DelegatingMemberReader

SourceForge.net_Logo