001/* 002// This software is subject to the terms of the Eclipse Public License v1.0 003// Agreement, available at the following URL: 004// http://www.eclipse.org/legal/epl-v10.html. 005// You must accept the terms of that agreement to use this software. 006// 007// Copyright (C) 2007-2009 Pentaho and others 008// All Rights Reserved. 009*/ 010package mondrian.olap; 011 012/** 013 * <code>DelegatingRole</code> implements {@link Role} by 014 * delegating all methods to an underlying {@link Role}. 015 * 016 * <p>It is a convenient base class if you want to override just a few of 017 * {@link Role}'s methods. 018 * 019 * @author Richard M. Emberson 020 * @since Mar 29 2007 021 */ 022public class DelegatingRole implements Role { 023 protected final Role role; 024 025 /** 026 * Creates a DelegatingRole. 027 * 028 * @param role Underlying role 029 */ 030 public DelegatingRole(Role role) { 031 assert role != null; 032 this.role = role; 033 } 034 035 public Access getAccess(Schema schema) { 036 return role.getAccess(schema); 037 } 038 039 public Access getAccess(Cube cube) { 040 return role.getAccess(cube); 041 } 042 043 public Access getAccess(Dimension dimension) { 044 return role.getAccess(dimension); 045 } 046 047 public Access getAccess(Hierarchy hierarchy) { 048 return role.getAccess(hierarchy); 049 } 050 051 /** 052 * {@inheritDoc} 053 * 054 * <p>This implementation returns the same access as the underlying role. 055 * Derived class may choose to refine access by creating a subclass of 056 * {@link mondrian.olap.RoleImpl.DelegatingHierarchyAccess}. 057 */ 058 public HierarchyAccess getAccessDetails(Hierarchy hierarchy) { 059 return role.getAccessDetails(hierarchy); 060 } 061 062 public Access getAccess(Level level) { 063 return role.getAccess(level); 064 } 065 066 public Access getAccess(Member member) { 067 return role.getAccess(member); 068 } 069 070 public Access getAccess(NamedSet set) { 071 return role.getAccess(set); 072 } 073 074 public boolean canAccess(OlapElement olapElement) { 075 return role.canAccess(olapElement); 076 } 077} 078 079// End DelegatingRole.java