com.atlassian.jira.bc.group
Class GroupRemoveUserMapper

java.lang.Object
  extended by com.atlassian.jira.bc.group.GroupRemoveUserMapper

public class GroupRemoveUserMapper
extends Object

Holds the parameters that specify which users should be removed from which groups. Also holds a list of default groups which users can be registered to be removed from. This class is not threadsafe. The only time you want to use the register methods and not the register(String) method is when you are updating multiple groups and multiple users and not all users are being removed from all groups. In all other cases the usage pattern for this class should be: GroupRemoveUserMapper mapper = new GroupRemoveUserMapper(listOfGroupNamesToRemoveFrom); mapper.registerForSelected(userNameWhoShouldBeRemovedFromGroups);

Since:
v3.12

Constructor Summary
GroupRemoveUserMapper()
          Creates the mapper with no default groups.
GroupRemoveUserMapper(List defaultGroupNames)
          Creates the mapper with the given groups marked as default groups.
 
Method Summary
 List getDefaultGroupNames()
          Returns the default groups.
 Collection getGroups(String userName)
          Provides an unmodifiable collection of all registered groups for a user.
 Iterator getGroupsIterator(String userName)
          Provides an Iterator to loop over all registered groups for a user.
 boolean isRemoveFromAllSelected(String userName)
          Indicates that the given user is to be removed from all default groups.
 GroupRemoveUserMapper register(String userName)
          Registers the given userName to be removed from the configured list of default groups.
 GroupRemoveUserMapper register(String userName, Collection groupNames)
          Registers the given userName to be removed from the specified group names.
 GroupRemoveUserMapper register(String userName, String groupName)
          Registers the given userName to be removed from the specified groupName.
 Iterator userIterator()
          Provides an iterator over the userNames.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupRemoveUserMapper

public GroupRemoveUserMapper()
Creates the mapper with no default groups.


GroupRemoveUserMapper

public GroupRemoveUserMapper(List defaultGroupNames)
Creates the mapper with the given groups marked as default groups. If there are any users registered to be removed from all default groups, these will be the groups that refers to.

Parameters:
defaultGroupNames - the defaultGroupNames.
Since:
v3.12
Method Detail

register

public GroupRemoveUserMapper register(String userName)
Registers the given userName to be removed from the configured list of default groups.

Parameters:
userName - identifies the user to be removed from the default groups.
Returns:
this.
Since:
v3.12

register

public GroupRemoveUserMapper register(String userName,
                                      String groupName)
Registers the given userName to be removed from the specified groupName. This can be called many times and the groups will be aggregated against the userName. Calling this method implies that the user should be removed from the specified group instead of the default groups.

Parameters:
userName - identifies the user to be removed from the default groups.
groupName - identifies the group to remove the user from.
Returns:
this.
Since:
v3.12

register

public GroupRemoveUserMapper register(String userName,
                                      Collection groupNames)
Registers the given userName to be removed from the specified group names. This can be called many times and the groups will be aggregated against the userName. Calling this method implies that the user should be removed from the specified groups instead of the default groups.

Parameters:
userName - identifies the user to be removed from the default groups.
groupNames - a collection of groupNames that identify the groups to remove the user from.
Returns:
this.
Since:
v3.12

isRemoveFromAllSelected

public boolean isRemoveFromAllSelected(String userName)
Indicates that the given user is to be removed from all default groups.

Parameters:
userName - identifies the user to be removed from the default groups.
Returns:
true if the user is to be removed from all default groups, false otherwise.
Since:
v3.12

getGroupsIterator

public Iterator getGroupsIterator(String userName)
Provides an Iterator to loop over all registered groups for a user.

Parameters:
userName - identifies the user whose groups we want to iterate over.
Returns:
Iterator to loop over all registered groups for a user.
Since:
v3.12

getGroups

public Collection getGroups(String userName)
Provides an unmodifiable collection of all registered groups for a user.

Parameters:
userName - identifies the user to be removed from the default groups.
Returns:
unmodifiable collection of all registered groups for a user.
Since:
v3.12

userIterator

public Iterator userIterator()
Provides an iterator over the userNames.

Returns:
iterator for registered userNames.
Since:
v3.12

getDefaultGroupNames

public List getDefaultGroupNames()
Returns the default groups.

Returns:
the list of groupNames that are default.
Since:
v3.12


Copyright © 2002-2009 Atlassian. All Rights Reserved.