mondrian.olap
Class RoleImpl.CachingHierarchyAccess

java.lang.Object
  extended by mondrian.olap.RoleImpl.DelegatingHierarchyAccess
      extended by mondrian.olap.RoleImpl.CachingHierarchyAccess
All Implemented Interfaces:
Role.HierarchyAccess
Enclosing class:
RoleImpl

static class RoleImpl.CachingHierarchyAccess
extends RoleImpl.DelegatingHierarchyAccess

Implementation of 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.


Field Summary
 
Fields inherited from class mondrian.olap.RoleImpl.DelegatingHierarchyAccess
hierarchyAccess
 
Constructor Summary
RoleImpl.CachingHierarchyAccess(Role.HierarchyAccess hierarchyAccess)
          Creates a CachingHierarchyAccess.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoleImpl.CachingHierarchyAccess

public RoleImpl.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:

For these purposes, children which are below the bottom level are regarded as visible.

Specified by:
getAccess in interface Role.HierarchyAccess
Overrides:
getAccess in class RoleImpl.DelegatingHierarchyAccess
Parameters:
member - Member
Returns:
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 interface Role.HierarchyAccess
Overrides:
getTopLevelDepth in class RoleImpl.DelegatingHierarchyAccess
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 interface Role.HierarchyAccess
Overrides:
getBottomLevelDepth in class RoleImpl.DelegatingHierarchyAccess
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 interface Role.HierarchyAccess
Overrides:
getRollupPolicy in class RoleImpl.DelegatingHierarchyAccess
Returns:
rollup policy

hasInaccessibleDescendants

public boolean hasInaccessibleDescendants(Member member)
Description copied from interface: Role.HierarchyAccess
Returns 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.

Specified by:
hasInaccessibleDescendants in interface Role.HierarchyAccess
Overrides:
hasInaccessibleDescendants in class RoleImpl.DelegatingHierarchyAccess
Parameters:
member - Member
Returns:
whether a descendant is inaccessible

Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads