mondrian.olap
Class RoleImpl

java.lang.Object
  extended by mondrian.olap.RoleImpl
All Implemented Interfaces:
Role

public class RoleImpl
extends Object
implements Role

RoleImpl is Mondrian's default implementation for the Role interface.

Since:
Oct 5, 2002
Author:
jhyde
 

Nested Class Summary
 
Nested classes/interfaces inherited from interface mondrian.olap.Role
Role.HierarchyAccess, Role.RollupPolicy
 
Constructor Summary
RoleImpl()
          Creates a role with no permissions.
 
Method Summary
 boolean canAccess(OlapElement olapElement)
          Returns whether this role is allowed to see a given element.
protected  RoleImpl clone()
           
static Role.HierarchyAccess createAllAccess(Hierarchy hierarchy)
          Creates an element which represents all access to a hierarchy.
 Access getAccess(Cube cube)
          Returns the access this role has to a given cube.
 Access getAccess(Dimension dimension)
          Returns the access this role has to a given dimension.
 Access getAccess(Hierarchy hierarchy)
          Returns the access this role has to a given hierarchy.
 Access getAccess(Level level)
          Returns the access this role has to a given level.
 Access getAccess(Member member)
          Returns the access this role has to a given member.
 Access getAccess(NamedSet set)
          Returns the access this role has to a given named set.
 Access getAccess(Schema schema)
          Returns the access this role has to a given schema.
 Role.HierarchyAccess getAccessDetails(Hierarchy hierarchy)
          Returns the details of this hierarchy's access, or null if the hierarchy has not been given explicit access.
 void grant(Cube cube, Access access)
          Defines access to a cube.
 void grant(Dimension dimension, Access access)
          Defines access to a dimension.
 void grant(Hierarchy hierarchy, Access access, Level topLevel, Level bottomLevel, Role.RollupPolicy rollupPolicy)
          Defines access to a hierarchy.
 void grant(Member member, Access access)
          Defines access to a member in a hierarchy.
 void grant(Schema schema, Access access)
          Defines access to all cubes and dimensions in a schema.
 boolean isMutable()
          Returns whether modifications are possible.
 void makeImmutable()
          Prevents any further modifications.
 RoleImpl makeMutableClone()
          Returns a copy of this Role which can be modified.
 void removeTopLevels()
          Removes the upper level restriction of each hierarchy in this role.
static Role union(List<Role> roleList)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoleImpl

public RoleImpl()
Creates a role with no permissions.

Method Detail

clone

protected RoleImpl clone()
Overrides:
clone in class Object

makeMutableClone

public RoleImpl makeMutableClone()
Returns a copy of this Role which can be modified.


makeImmutable

public void makeImmutable()
Prevents any further modifications.

Post-condition:
!isMutable()

isMutable

public boolean isMutable()
Returns whether modifications are possible.


grant

public void grant(Schema schema,
                  Access access)
Defines access to all cubes and dimensions in a schema.

Pre-condition:
schema != null, access == Access.ALL || access == Access.NONE || access == Access.ALL_DIMENSIONS, isMutable()
Parameters:
schema - Schema whose access to grant/deny.
access - An access code

getAccess

public Access getAccess(Schema schema)
Description copied from interface: Role
Returns the access this role has to a given schema.

Specified by:
getAccess in interface Role

grant

public void grant(Cube cube,
                  Access access)
Defines access to a cube.

Pre-condition:
cube != null, access == Access.ALL || access == Access.NONE, isMutable()
Parameters:
cube - Cube whose access to grant/deny.
access - An access code

getAccess

public Access getAccess(Cube cube)
Description copied from interface: Role
Returns the access this role has to a given cube.

Specified by:
getAccess in interface Role

removeTopLevels

public void removeTopLevels()
Removes the upper level restriction of each hierarchy in this role. This will allow member names to be resolved even if the upper levels are not visible.

For example, it should be possible to resolve [Store].[USA].[CA].[San Francisco] even if the role cannot see the nation level.


grant

public void grant(Dimension dimension,
                  Access access)
Defines access to a dimension.

Pre-condition:
dimension != null, access == Access.ALL || access == Access.NONE, isMutable()
Parameters:
dimension - Hierarchy whose access to grant/deny.
access - An access code

getAccess

public Access getAccess(Dimension dimension)
Description copied from interface: Role
Returns the access this role has to a given dimension.

Specified by:
getAccess in interface Role

grant

public void grant(Hierarchy hierarchy,
                  Access access,
                  Level topLevel,
                  Level bottomLevel,
                  Role.RollupPolicy rollupPolicy)
Defines access to a hierarchy.

Pre-condition:
hierarchy != null, Access.instance().isValid(access), (access == Access.CUSTOM) || (topLevel == null && bottomLevel == null), topLevel == null || topLevel.getHierarchy() == hierarchy, bottomLevel == null || bottomLevel.getHierarchy() == hierarchy, isMutable()
Parameters:
hierarchy - Hierarchy whose access to grant/deny.
access - An access code
topLevel - Top-most level which can be accessed, or null if the highest level. May only be specified if access is Access.CUSTOM.
bottomLevel - Bottom-most level which can be accessed, or null if the lowest level. May only be specified if access is Access.CUSTOM.
rollupPolicy -

getAccess

public Access getAccess(Hierarchy hierarchy)
Description copied from interface: Role
Returns the access this role has to a given hierarchy.

Specified by:
getAccess in interface Role

getAccessDetails

public Role.HierarchyAccess getAccessDetails(Hierarchy hierarchy)
Description copied from interface: Role
Returns the details of this hierarchy's access, or null if the hierarchy has not been given explicit access.

Specified by:
getAccessDetails in interface Role

getAccess

public Access getAccess(Level level)
Description copied from interface: Role
Returns the access this role has to a given level.

Specified by:
getAccess in interface Role

grant

public void grant(Member member,
                  Access access)
Defines access to a member in a hierarchy.

Notes:

  1. The order of grants matters. If you grant/deny access to a member, previous grants/denials to its descendants are ignored.
  2. Member grants do not supersde top/bottom levels set using grant(Hierarchy, Access, Level, Level, mondrian.olap.Role.RollupPolicy).
  3. If you have access to a member, then you can see its ancestors even those explicitly denied, up to the top level.

Pre-condition:
member != null, isMutable(), getAccess(member.getHierarchy()) == Access.CUSTOM

getAccess

public Access getAccess(Member member)
Description copied from interface: Role
Returns the access this role has to a given member.

Specified by:
getAccess in interface Role

getAccess

public Access getAccess(NamedSet set)
Description copied from interface: Role
Returns the access this role has to a given named set.

Specified by:
getAccess in interface Role

canAccess

public boolean canAccess(OlapElement olapElement)
Description copied from interface: Role
Returns whether this role is allowed to see a given element.

Specified by:
canAccess in interface Role

createAllAccess

public static Role.HierarchyAccess createAllAccess(Hierarchy hierarchy)
Creates an element which represents all access to a hierarchy.

Parameters:
hierarchy - Hierarchy
Returns:
element representing all access to a given hierarchy

union

public static Role union(List<Role> roleList)

SourceForge.net_Logo