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.HierarchyAccessthat 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
WeakHashMapobjects, 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 AccessgetAccess(Member member)Returns the access the current role has to a given member.intgetBottomLevelDepth()Returns the depth of the lowest level to which the current Role has access.Role.RollupPolicygetRollupPolicy()Returns the policy by which cell values are calculated if not all of a member's children are visible.intgetTopLevelDepth()Returns the depth of the highest level to which the current Role has access.booleanhasInaccessibleDescendants(Member member)Returnstrueif 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.HierarchyAccessReturns the access the current role has to a given member.Visibility is:
Access.NONEif member is not visible,Access.ALLif member and all children are visible,Access.CUSTOMif some of the children are not visible.
For these purposes, children which are below the bottom level are regarded as visible.
- Specified by:
getAccessin interfaceRole.HierarchyAccess- Overrides:
getAccessin classRoleImpl.DelegatingHierarchyAccess- Parameters:
member- Member.- Returns:
- Return current role's access to member.
-
getTopLevelDepth
public int getTopLevelDepth()
Description copied from interface:Role.HierarchyAccessReturns 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:
getTopLevelDepthin interfaceRole.HierarchyAccess- Overrides:
getTopLevelDepthin classRoleImpl.DelegatingHierarchyAccess- Returns:
- Returns depth of the highest accessible level.
-
getBottomLevelDepth
public int getBottomLevelDepth()
Description copied from interface:Role.HierarchyAccessReturns 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:
getBottomLevelDepthin interfaceRole.HierarchyAccess- Overrides:
getBottomLevelDepthin classRoleImpl.DelegatingHierarchyAccess- Returns:
- Returns depth of the lowest accessible level.
-
getRollupPolicy
public Role.RollupPolicy getRollupPolicy()
Description copied from interface:Role.HierarchyAccessReturns the policy by which cell values are calculated if not all of a member's children are visible.- Specified by:
getRollupPolicyin interfaceRole.HierarchyAccess- Overrides:
getRollupPolicyin classRoleImpl.DelegatingHierarchyAccess- Returns:
- Returns rollup policy.
-
hasInaccessibleDescendants
public boolean hasInaccessibleDescendants(Member member)
Description copied from interface:Role.HierarchyAccessReturnstrueif 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:
hasInaccessibleDescendantsin interfaceRole.HierarchyAccess- Overrides:
hasInaccessibleDescendantsin classRoleImpl.DelegatingHierarchyAccess- Parameters:
member- Member- Returns:
- Returns whether a descendant is inaccessible.
-
-