com.sas.drugdev.remote.admin
Class GroupBean

java.lang.Object
  extended bycom.sas.drugdev.remote.admin.GroupBean
All Implemented Interfaces:
Group

public class GroupBean
extends java.lang.Object
implements Group

Simple bean to represent a group. This can be constructed various ways. This class allows the user to construct a Group object without requiring a server call.

It is the only way to create a Group on the server. Construct a GroupBean, then pass it into GroupService.create(GroupBean).

It is also the only means for performing write operations on the Group, such as updating membership and the description. Construct a GroupBean object then call addUser(String), removeUser(String) or setDescription(String) method. Then pass that bean into GroupService.update(GroupBean) to perform those operations on the server side.


Constructor Summary
GroupBean(RemoteGroup remoteGroup)
          Construct the GroupBean with a RemoteGroup.
GroupBean(java.lang.String name)
          Contruct the GroupBean with a group name.
 
Method Summary
 void addUser(java.lang.String userId)
          Add the given user to this group.
 void addUsers(java.util.List userIds)
          Add the given users to this group.
 java.lang.String getDescription()
          Get the description of this group
 java.lang.String getName()
          Get the name of this group
 java.util.List getUsers()
          Get the userIds of the current users in this group.
 boolean isFromServer()
           
 void removeUser(java.lang.String userId)
          Remove the user with the specified userId from this group.
 void removeUsers(java.util.List userIds)
          Remove the users with the specified userIds from this group.
 void setDescription(java.lang.String description)
          Set the description of this group.
 void setUsers(java.util.List userIds)
          Set the given userIds to be users in this group.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupBean

public GroupBean(RemoteGroup remoteGroup)
          throws InvalidGroupBeanException
Construct the GroupBean with a RemoteGroup. This is useful for updating a group.

Parameters:
remoteGroup -
Throws:
InvalidGroupBeanException - if the passed RemoteGroup is null

GroupBean

public GroupBean(java.lang.String name)
          throws InvalidGroupBeanException
Contruct the GroupBean with a group name.

Parameters:
name - Name of the group.
Throws:
InvalidGroupBeanException - if the passed name is null
Method Detail

addUser

public void addUser(java.lang.String userId)
             throws InvalidGroupBeanException
Add the given user to this group. The users are not updated on the server until you call GroupService.update(GroupBean) or GroupService.create(GroupBean). If the user is already a member of this group, this call is a no-op.

Parameters:
userId - userId of user to add to the group
Throws:
InvalidGroupBeanException - if the passed userID is null

addUsers

public void addUsers(java.util.List userIds)
Add the given users to this group. The users are not updated on the server until you call GroupService.update(GroupBean) or GroupService.create(GroupBean). If the user is already a member of this group, this call is a no-op.

Parameters:
userIds - List of users to add to the group

removeUser

public void removeUser(java.lang.String userId)
                throws InvalidGroupBeanException
Remove the user with the specified userId from this group. The users are not removed from the group on the server until you call GroupService.update(GroupBean). If the user isn't a member of this group, this call is a no-op.

Parameters:
userId - User to remove from the group
Throws:
InvalidGroupBeanException - if the passed userID is null

removeUsers

public void removeUsers(java.util.List userIds)
                 throws InvalidGroupBeanException
Remove the users with the specified userIds from this group. The users are not removed from the group on the server until you call GroupService.update(GroupBean). If the user isn't a member of this group, this call is a no-op.

Parameters:
userIds - userIds to remove from the group
Throws:
InvalidGroupBeanException - if the passed userIDs is null

setUsers

public void setUsers(java.util.List userIds)
              throws InvalidGroupBeanException
Set the given userIds to be users in this group. Overwrites any existing users. The users are not updated on the server until you call GroupService.update(GroupBean) or GroupService.update(GroupBean).

Parameters:
userIds - userIds to be set on the group
Throws:
InvalidGroupBeanException - if the passed userIDs is null

setDescription

public void setDescription(java.lang.String description)
                    throws InvalidGroupBeanException
Set the description of this group. The description isn't updated on the server until you call GroupService.update(GroupBean) or GroupService.create(GroupBean).

Parameters:
description -
Throws:
InvalidGroupBeanException - if the passed description is null

getUsers

public java.util.List getUsers()
Description copied from interface: Group
Get the userIds of the current users in this group.

Specified by:
getUsers in interface Group
Returns:
List of userIds

getName

public java.lang.String getName()
Description copied from interface: Group
Get the name of this group

Specified by:
getName in interface Group
Returns:
the name of this group

getDescription

public java.lang.String getDescription()
Description copied from interface: Group
Get the description of this group

Specified by:
getDescription in interface Group
Returns:
the description of this group

isFromServer

public boolean isFromServer()