com.atlassian.core.user
Class GroupUtils

java.lang.Object
  extended bycom.atlassian.core.user.GroupUtils

public class GroupUtils
extends java.lang.Object

A utility class for operating on groups.

See Also:
UserUtils

Constructor Summary
GroupUtils()
           
 
Method Summary
static boolean existsGroup(java.lang.String name)
          A simple method to tell if a group already exists or not
static com.opensymphony.user.Group getGroup(java.lang.String name)
          Get a group from the underlying user manager.
static java.util.Collection getGroups()
           
static com.opensymphony.user.Group getGroupSafely(java.lang.String name)
          This method gets a group from OSUser - however if the group does not exist, it tries to create it and then return it (mitigates the need for a setup file).
static void removeGroup(com.opensymphony.user.Group group)
          This will remove a group, and remove any users from that group
static void sortGroupNames(java.util.List groups)
          Sort group names in alphabetical (*not* ascii) order.
static void sortGroups(java.util.List groups)
          Sort group names in alphabetical (*not* ascii) order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupUtils

public GroupUtils()
Method Detail

getGroupSafely

public static com.opensymphony.user.Group getGroupSafely(java.lang.String name)
                                                  throws com.opensymphony.user.ImmutableException
This method gets a group from OSUser - however if the group does not exist, it tries to create it and then return it (mitigates the need for a setup file).

Throws:
com.opensymphony.user.ImmutableException

getGroup

public static com.opensymphony.user.Group getGroup(java.lang.String name)
Get a group from the underlying user manager.

Returns:
The Group from the underlying UserManager, or null if the group doesn't exist

existsGroup

public static boolean existsGroup(java.lang.String name)
A simple method to tell if a group already exists or not


getGroups

public static java.util.Collection getGroups()
Returns:
A collection of all groups (sorted by name)

sortGroups

public static void sortGroups(java.util.List groups)
Sort group names in alphabetical (*not* ascii) order. This means that upper case and lower case characters are sorted together.

Parameters:
groups -

sortGroupNames

public static void sortGroupNames(java.util.List groups)
Sort group names in alphabetical (*not* ascii) order. This means that upper case and lower case characters are sorted together.

Parameters:
groups -

removeGroup

public static void removeGroup(com.opensymphony.user.Group group)
                        throws java.lang.Exception
This will remove a group, and remove any users from that group

Throws:
java.lang.Exception


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.