Package mondrian.olap
Class RoleImpl.CachingHierarchyAccess
- java.lang.Object
-
- mondrian.olap.RoleImpl.DelegatingHierarchyAccess
-
- mondrian.olap.RoleImpl.CachingHierarchyAccess
-
- All Implemented Interfaces:
Role.HierarchyAccess
- Enclosing class:
- RoleImpl
static class RoleImpl.CachingHierarchyAccess extends RoleImpl.DelegatingHierarchyAccess
Implementation ofRole.HierarchyAccess
that caches the access of each member and level.This reduces the number of calls to the underlying HierarchyAccess, which is particularly useful for a union role which is based on many roles.
Caching uses two
WeakHashMap
objects, so should release resources if memory is scarce. However, it may use up memory and cause segments etc. to be removed from the cache when GC is triggered. For this reason, you should only use this wrapper for a HierarchyAccess which would otherwise have poor performance; currently used for union roles with 5 or more member roles.
-
-
Field Summary
-
Fields inherited from class mondrian.olap.RoleImpl.DelegatingHierarchyAccess
hierarchyAccess
-
-
Constructor Summary
Constructors Constructor Description CachingHierarchyAccess(Role.HierarchyAccess hierarchyAccess)
Creates a CachingHierarchyAccess.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Access
getAccess(Member member)
Returns the access the current role has to a given member.int
getBottomLevelDepth()
Returns the depth of the lowest level to which the current Role has access.Role.RollupPolicy
getRollupPolicy()
Returns the policy by which cell values are calculated if not all of a member's children are visible.int
getTopLevelDepth()
Returns the depth of the highest level to which the current Role has access.boolean
hasInaccessibleDescendants(Member member)
Returnstrue
if at least one of the descendants of the given Member is inaccessible to this Role.
-
-
-
Constructor Detail
-
CachingHierarchyAccess
public CachingHierarchyAccess(Role.HierarchyAccess hierarchyAccess)
Creates a CachingHierarchyAccess.- Parameters:
hierarchyAccess
- Underlying hierarchy access
-
-
Method Detail
-
getAccess
public Access getAccess(Member member)
Description copied from interface:Role.HierarchyAccess
Returns the access the current role has to a given member.Visibility is:
Access.NONE
if member is not visible,Access.ALL
if member and all children are visible,Access.CUSTOM
if some of the children are not visible.
For these purposes, children which are below the bottom level are regarded as visible.
- Specified by:
getAccess
in interfaceRole.HierarchyAccess
- Overrides:
getAccess
in classRoleImpl.DelegatingHierarchyAccess
- Parameters:
member
- Member.- Returns:
- Return current role's access to member.
-
getTopLevelDepth
public int getTopLevelDepth()
Description copied from interface:Role.HierarchyAccess
Returns the depth of the highest level to which the current Role has access. The 'all' level, if present, has a depth of zero.- Specified by:
getTopLevelDepth
in interfaceRole.HierarchyAccess
- Overrides:
getTopLevelDepth
in classRoleImpl.DelegatingHierarchyAccess
- Returns:
- Returns depth of the highest accessible level.
-
getBottomLevelDepth
public int getBottomLevelDepth()
Description copied from interface:Role.HierarchyAccess
Returns the depth of the lowest level to which the current Role has access. The 'all' level, if present, has a depth of zero.- Specified by:
getBottomLevelDepth
in interfaceRole.HierarchyAccess
- Overrides:
getBottomLevelDepth
in classRoleImpl.DelegatingHierarchyAccess
- Returns:
- Returns depth of the lowest accessible level.
-
getRollupPolicy
public Role.RollupPolicy getRollupPolicy()
Description copied from interface:Role.HierarchyAccess
Returns the policy by which cell values are calculated if not all of a member's children are visible.- Specified by:
getRollupPolicy
in interfaceRole.HierarchyAccess
- Overrides:
getRollupPolicy
in classRoleImpl.DelegatingHierarchyAccess
- Returns:
- Returns rollup policy.
-
hasInaccessibleDescendants
public boolean hasInaccessibleDescendants(Member member)
Description copied from interface:Role.HierarchyAccess
Returnstrue
if at least one of the descendants of the given Member is inaccessible to this Role.Descendants which are inaccessible because they are below the bottom level are ignored.
- Specified by:
hasInaccessibleDescendants
in interfaceRole.HierarchyAccess
- Overrides:
hasInaccessibleDescendants
in classRoleImpl.DelegatingHierarchyAccess
- Parameters:
member
- Member- Returns:
- Returns whether a descendant is inaccessible.
-
-