org.dspace.app.xmlui.aspect.administrative
Class FlowGroupUtils

java.lang.Object
  extended by org.dspace.app.xmlui.aspect.administrative.FlowGroupUtils

public class FlowGroupUtils
extends Object

Utility methods to processes actions on Groups. These methods are used exclusivly from the administrative flow scripts.

Author:
scott phillips

Nested Class Summary
static class FlowGroupUtils.Role
           
 
Constructor Summary
FlowGroupUtils()
           
 
Method Summary
static String[] addMember(String[] list, String id)
          Add the given id to the list and return a new list.
static int getCollectionId(String groupName)
          Extracts the collection id that may be immbedded in the given group name.
static FlowGroupUtils.Role getCollectionRole(String groupName)
           
static int getCommunityId(String groupName)
          Extracts the community id that may be embedded in the given group name.
static FlowGroupUtils.Role getCommunityRole(String groupName)
           
static String[] getEPeopleMembers(Context context, int groupID)
          Return the list of current epeople ID's that are a member of this group.
static String[] getGroupMembers(Context context, int groupID)
          Return the list of current group id's that are a member of this group.
static String getName(Context context, int groupID)
          Return the current name for the given group ID.
static FlowResult processDeleteGroups(Context context, String[] groupIDs)
          Remove the specified groups.
static FlowResult processSaveGroup(Context context, int groupID, String newName, String[] newEPeopleIDsArray, String[] newGroupIDsArray)
          Save the group.
static String[] removeMember(String[] list, String id)
          Remove all instances of the given id from the member list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlowGroupUtils

public FlowGroupUtils()
Method Detail

getName

public static String getName(Context context,
                             int groupID)
                      throws SQLException
Return the current name for the given group ID.

Parameters:
context - The current DSpace context.
groupID - The group id.
Returns:
The group's name.
Throws:
SQLException

getEPeopleMembers

public static String[] getEPeopleMembers(Context context,
                                         int groupID)
                                  throws SQLException
Return the list of current epeople ID's that are a member of this group.

Parameters:
context - The current DSpace context
groupID - The group's id.
Returns:
An array of ids.
Throws:
SQLException

getGroupMembers

public static String[] getGroupMembers(Context context,
                                       int groupID)
                                throws SQLException
Return the list of current group id's that are a member of this group.

Parameters:
context - The current DSpace context
groupID - The group's id.
Returns:
An array of ids.
Throws:
SQLException

addMember

public static String[] addMember(String[] list,
                                 String id)
Add the given id to the list and return a new list.

Parameters:
list - The current array
id - The new element
Returns:
A new combined array.

removeMember

public static String[] removeMember(String[] list,
                                    String id)
Remove all instances of the given id from the member list.

Parameters:
list - The current array
id - The id to remove
Returns:
A new combined array.

processSaveGroup

public static FlowResult processSaveGroup(Context context,
                                          int groupID,
                                          String newName,
                                          String[] newEPeopleIDsArray,
                                          String[] newGroupIDsArray)
                                   throws SQLException,
                                          AuthorizeException,
                                          UIException
Save the group. If the name has been changed then it will be updated, if any members have been added or removed then they are updated. If the groupID is -1 then a new group is created.

Parameters:
context - The current dspace context
groupID - The group id, or -1 for a new group.
newName - The group's new name.
newEPeopleIDsArray - All epeople members
newGroupIDsArray - All group members.
Returns:
A result
Throws:
SQLException
AuthorizeException
UIException

processDeleteGroups

public static FlowResult processDeleteGroups(Context context,
                                             String[] groupIDs)
                                      throws SQLException,
                                             AuthorizeException,
                                             IOException
Remove the specified groups. It is assumed that the user has allready confirm this selection.

Parameters:
context - The current DSpace context
groupIDs - A list of groups to be removed.
Returns:
A results object.
Throws:
SQLException
AuthorizeException
IOException

getCollectionId

public static int getCollectionId(String groupName)
Extracts the collection id that may be immbedded in the given group name.

Parameters:
groupName - - the name of a group (ie group.getName())
Returns:
the integer collection id or -1 if the group is not that of a collection

getCollectionRole

public static FlowGroupUtils.Role getCollectionRole(String groupName)

getCommunityId

public static int getCommunityId(String groupName)
Extracts the community id that may be embedded in the given group name.

Parameters:
groupName - - the name of a group (ie group.getName())
Returns:
the integer community id or -1 if the group is not that of a community

getCommunityRole

public static FlowGroupUtils.Role getCommunityRole(String groupName)


Copyright © 2013 DuraSpace. All Rights Reserved.