com.ibm.commerce.collaboration.workspaces.commands
Class AddMemberToSpaceCtrlCmdImpl

com.ibm.commerce.command.AbstractECTargetableCommand
  |
  +--com.ibm.commerce.command.ControllerCommandImpl
        |
        +--com.ibm.commerce.tools.command.ToolsControllerCommandImpl
              |
              +--com.ibm.commerce.collaboration.workspaces.commands.AddMemberToSpaceCtrlCmdImpl
All Implemented Interfaces:
AccCommand, AddMemberToSpaceCtrlCmd, ControllerCommand, ECCommand, ECTargetableCommand, Protectable, ToolsControllerCommand

public class AddMemberToSpaceCtrlCmdImpl
extends ToolsControllerCommandImpl
implements AddMemberToSpaceCtrlCmd

Adds a list of registered members to the collaborative workspace. Each member will be automatically assigned the Author role in the collaborative workspace.

Behaviour

The command does the following for each member to be added to the collaborative workspace:

  1. Verifies that the user requesting the action has a Manager role in the collaborative workspace or a Site Administrator role in the seller organization. Otherwise, the requester does not have the authority to execute this command.
  2. Checks to make sure this member does not already have a role in the collaborative workspace. A member may have only one role in a collaborative workspace.
  3. Creates an instance of the CollabManagerAccessBean.
  4. Calls the addAuthorGroupMember method in the access bean to add the member to the collaborative workspace.
  5. If the member is added successfully and the sendEmail parameter is set to TRUE, the command will send an email notification to the new member specifying the URL to access the collaborative workspace. Email notification is sent only if both the receiver and the sender have registered e-mail addresses.

Exception Conditions

If the collaborative workspace Id parameter is missing, the command sets the _ERR_MISSING_CMD_PARAMETER exception task to handle the error.

If the user requester does not have the authority to execute the AddMember function, the command sets the EC_ERROR_COLLAB_NO_AUTHORIZATION exception task to handle the error.

If any member in the list of members being added to the collaborative workspace already has the Author role in the specified workspace, the command sets the EC_ERROR_MEMBER_HAS_ROLE exception task to handle the error.

If any member in the list of members being added to the collaborative workspace already has the Manager or Reader role in the specified workspace, the command sets the EC_ERROR_MEMBER_HAS_ANOTHER_ROLE exception task to handle the error.

If the AddMember action was not executed successfully, the command sets the EC_ERROR_ADD_MEMBERS exception task to handle the error.


Field Summary
static java.lang.String CLASSNAME
           
static java.lang.String COPYRIGHT
           
 
Fields inherited from class com.ibm.commerce.command.ControllerCommandImpl
requestProperties, responseProperties, retriable, viewReqProperties
 
Fields inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.collaboration.workspaces.commands.AddMemberToSpaceCtrlCmd
defaultCommandClassName, NAME
 
Constructor Summary
AddMemberToSpaceCtrlCmdImpl()
           
 
Method Summary
 java.lang.String getCollabSpaceId()
          Gets the unique identifier associated with the collaborative workspace.
 java.lang.String getCSCreator()
          Gets the national language-specific name of the creator of the collaborative workspace based on the language Id in the command context.
 java.lang.String getCSName()
          Gets the name of the collaborative workspace.
 java.lang.String getEmailAddressForUser(java.lang.String user)
          Gets the email address associated with a given user DN (Distinguished Name).
 java.lang.String getLanguageIdForUser(java.lang.String user)
          Gets the preferred language Id of the users.
 java.util.Vector getNewMembers()
          Gets a list of members to be added to the collaborative workspace in the form of a vector.
 java.lang.String getQuickPlaceURL()
          Gets the URL to the controller command that will redirect to the QuickPlace associated with a collaborative workspace.
 AccessVector getResources()
          Gets the access control resources corresponding to the command.
 java.lang.String getWCUserId(java.lang.String fullDN)
          Gets the logon Id of a user from the full Distinguished Name.
 void performExecute()
          Contains the business logic for the command.
 boolean sendEmail(java.lang.String senderEmailAddress, java.lang.String receiverEmailAddress, java.lang.String csName, java.lang.String csCreator, java.lang.String quickPlaceURL, java.lang.String wcUserId, java.lang.String languageId)
          Sends an email notification to the new member in the collaborative workspace specifying the URL to access the collaborative workspace.
 void setCollabSpaceId(java.lang.String newCollabSpaceId)
          Sets the unique identifier associated with the collaborative workspace to a local variable.
 void setNewMembers(java.util.Vector newMembers)
          Sets the list of new members to be added to the collaborative workspace to a local variable.
 void setRequestProperties(TypedProperty reqParms)
          Gets the input parameters from the requestProperties object and sets each parameter to a local variable.
 void setSendEmail(boolean newSendEmail)
          Sets the parameter specifying whether email notification should be sent to the new member.
 boolean shouldSendEmail()
          Gets the parameter specifying whether email notification should be sent to the new member.
 void validateParameters()
          Validates that the syntax of the input parameters are correct.
 
Methods inherited from class com.ibm.commerce.tools.command.ToolsControllerCommandImpl
getViewInputProperties
 
Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl
fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
 
Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.command.ControllerCommand
execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputProperties
 
Methods inherited from interface com.ibm.commerce.command.AccCommand
accessControlCheck, getAccCheck, getForUserId, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.security.Protectable
fulfills, getOwner
 

Field Detail

CLASSNAME

public static final java.lang.String CLASSNAME

COPYRIGHT

public static final java.lang.String COPYRIGHT
Constructor Detail

AddMemberToSpaceCtrlCmdImpl

public AddMemberToSpaceCtrlCmdImpl()
Method Detail

getCollabSpaceId

public java.lang.String getCollabSpaceId()
Gets the unique identifier associated with the collaborative workspace.
Returns:
The collaborative workspace Id.

getCSCreator

public java.lang.String getCSCreator()
Gets the national language-specific name of the creator of the collaborative workspace based on the language Id in the command context.
  1. If the language Id is less than -6, it is assumed that the name should be displayed in an Asian format (lastName FirstName).
  2. If the languageId is greater than or equal to -6, it is assumed that the name should be displayed in a Western format (FirstName space LastName).
Returns:
The name of the creator of the collaborative workspace.

getCSName

public java.lang.String getCSName()
Gets the name of the collaborative workspace.
Returns:
The name of the collaborative workspace.

getEmailAddressForUser

public java.lang.String getEmailAddressForUser(java.lang.String user)
Gets the email address associated with a given user DN (Distinguished Name). If no email address is associated with the user, the method returns null.
Parameters:
user - The distinguished name of a user (ex. uid=demoUser,o=Root Organization)
Returns:
The email address associated with the user if it is specified in the database.

getLanguageIdForUser

public java.lang.String getLanguageIdForUser(java.lang.String user)
Gets the preferred language Id of the users. If no language preference is associated with the user, the method returns null.
Parameters:
user - The collaborative workspace user.
Returns:
The preferred language Id of the user.

getNewMembers

public java.util.Vector getNewMembers()
Gets a list of members to be added to the collaborative workspace in the form of a vector.
Returns:
The list of new members to be added to the collaborative workspace.

getQuickPlaceURL

public java.lang.String getQuickPlaceURL()
Gets the URL to the controller command that will redirect to the QuickPlace associated with a collaborative workspace.
Returns:
The QuickPlace URL associated with a collaborative workspace.

getResources

public AccessVector getResources()
                          throws ECException
Gets the access control resources corresponding to the command.
Specified by:
getResources in interface ECCommand
Overrides:
getResources in class AbstractECTargetableCommand
Returns:
The access vector associated with the command.
Throws:
ECException - If the access control resources cannot be retrieved.

getWCUserId

public java.lang.String getWCUserId(java.lang.String fullDN)
Gets the logon Id of a user from the full Distinguished Name.
  1. Distinguished Name: uid=demoUser,o=Root Organization
  2. Logon Id: demoUser
Returns:
the logon Id of the user.

performExecute

public void performExecute()
                    throws ECException
Contains the business logic for the command.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
com.ibm.commerce.command.CommandException - The superclass for all ECExceptions.

sendEmail

public boolean sendEmail(java.lang.String senderEmailAddress,
                         java.lang.String receiverEmailAddress,
                         java.lang.String csName,
                         java.lang.String csCreator,
                         java.lang.String quickPlaceURL,
                         java.lang.String wcUserId,
                         java.lang.String languageId)
                  throws ECException
Sends an email notification to the new member in the collaborative workspace specifying the URL to access the collaborative workspace.
Parameters:
senderEmailAddress - The email address of the sender.
receiverEmailAddress - The email address of the receiver.
csName - The name of the collaborative workspace.
csCreator - The name of the creator of the collaborative workspace.
quickPlaceURL - The URL of the QuickPlace associated with the collaborative workspace.
wcUserId - The logon Id of the new member in the collaborative workspace.
languageId - The preferred language Id of the receiver of the email.
Returns:
true if the email was sent successfully, false if the email was not sent successfully.

setCollabSpaceId

public void setCollabSpaceId(java.lang.String newCollabSpaceId)
Sets the unique identifier associated with the collaborative workspace to a local variable.
Parameters:
newCollabSpaceId - The collaborative workspace Id.

setNewMembers

public void setNewMembers(java.util.Vector newMembers)
Sets the list of new members to be added to the collaborative workspace to a local variable.
Parameters:
newMembers - The list of new members.

setRequestProperties

public void setRequestProperties(TypedProperty reqParms)
                          throws ECApplicationException
Gets the input parameters from the requestProperties object and sets each parameter to a local variable.
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class ToolsControllerCommandImpl
Parameters:
reqParms - The input parameters that are received by the command.
Throws:
ECApplicationException - If the collaborative workspace Id is missing.

setSendEmail

public void setSendEmail(boolean newSendEmail)
Sets the parameter specifying whether email notification should be sent to the new member.
Parameters:
newSendEmail - The variable specifying whether email should be sent.

shouldSendEmail

public boolean shouldSendEmail()
Gets the parameter specifying whether email notification should be sent to the new member.
Returns:
The variable specifying whether email should be sent.

validateParameters

public void validateParameters()
                        throws ECException
Validates that the syntax of the input parameters are correct.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
ECException. -