View Javadoc

1   package com.atlassian.user.impl;
2   
3   import com.atlassian.user.EntityException;
4   import com.atlassian.user.Group;
5   import com.atlassian.user.GroupManager;
6   import com.atlassian.user.User;
7   
8   import java.util.List;
9   import java.util.Collections;
10  
11  public abstract class ReadOnlyGroupManager implements GroupManager
12  {
13      public List<Group> getWritableGroups()
14      {
15          return Collections.emptyList();
16      }
17  
18      public Group createGroup(String groupName) throws EntityException
19      {
20          throw new UnsupportedOperationException("Cannot write to read-only GroupManager [" + getIdentifier().getKey() +"]");
21      }
22  
23      public void removeGroup(Group group) throws EntityException
24      {
25          throw new UnsupportedOperationException("Cannot write to read-only GroupManager [" + getIdentifier().getKey() +"]");
26      }
27  
28      @SuppressWarnings({"UnusedDeclaration"})
29      public void saveGroup(Group group) throws EntityException
30      {
31          throw new UnsupportedOperationException("Cannot write to read-only GroupManager [" + getIdentifier().getKey() +"]");
32      }
33  
34      public void addMembership(Group group, User user) throws EntityException
35      {
36          throw new UnsupportedOperationException("Cannot write to read-only GroupManager [" + getIdentifier().getKey() +"]");
37      }
38  
39      public void removeMembership(Group group, User user) throws EntityException
40      {
41          throw new UnsupportedOperationException("Cannot write to read-only GroupManager [" + getIdentifier().getKey() +"]");
42      }
43  
44      /**
45       * Used to detemine whether an entity can be added (eg, can call {@link com.atlassian.user.UserManager#createUser(String)}
46       * or{@link com.atlassian.user.GroupManager#createGroup(String)}
47       */
48      public boolean isCreative()
49      {
50          return false;
51      }
52  
53      public boolean isReadOnly(Group group)
54      {
55          return true;
56      }
57  
58      public boolean supportsExternalMembership() throws EntityException
59      {
60          return false;
61      }
62  }