static class RoleImpl.CachingHierarchyAccess extends RoleImpl.DelegatingHierarchyAccess
Role.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.
hierarchyAccess
Constructor and Description |
---|
CachingHierarchyAccess(Role.HierarchyAccess hierarchyAccess)
Creates a CachingHierarchyAccess.
|
Modifier and Type | Method and 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)
Returns
true if at least one of the descendants of the
given Member is inaccessible to this Role. |
public CachingHierarchyAccess(Role.HierarchyAccess hierarchyAccess)
hierarchyAccess
- Underlying hierarchy accesspublic Access getAccess(Member member)
Role.HierarchyAccess
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.
getAccess
in interface Role.HierarchyAccess
getAccess
in class RoleImpl.DelegatingHierarchyAccess
member
- Member.public int getTopLevelDepth()
Role.HierarchyAccess
getTopLevelDepth
in interface Role.HierarchyAccess
getTopLevelDepth
in class RoleImpl.DelegatingHierarchyAccess
public int getBottomLevelDepth()
Role.HierarchyAccess
getBottomLevelDepth
in interface Role.HierarchyAccess
getBottomLevelDepth
in class RoleImpl.DelegatingHierarchyAccess
public Role.RollupPolicy getRollupPolicy()
Role.HierarchyAccess
getRollupPolicy
in interface Role.HierarchyAccess
getRollupPolicy
in class RoleImpl.DelegatingHierarchyAccess
public boolean hasInaccessibleDescendants(Member member)
Role.HierarchyAccess
true
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.
hasInaccessibleDescendants
in interface Role.HierarchyAccess
hasInaccessibleDescendants
in class RoleImpl.DelegatingHierarchyAccess
member
- Member