com.ibm.commerce.messaging.commands
Class SendMsgCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.TaskCommandImpl
                    |
                    +--com.ibm.commerce.messaging.commands.SendMsgCmdImpl
All Implemented Interfaces:
ECCommand, ECTargetableCommand, SendMsgCmd, TaskCommand

public class SendMsgCmdImpl
extends TaskCommandImpl
implements SendMsgCmd

The outbound messaging system interface implementation, a task command to use the messaging system object.

See Also:
Serialized Form

Field Summary
static java.lang.String COPYRIGHT
          The IBM copyright notice field.
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.messaging.commands. SendMsgCmd
defaultCommandClassName, NAME, SEND_IMMEDIATE, SEND_RECEIVE_IMMEDIATE, SEND_TRANSACTED
 
Fields inherited from interface com.ibm.commerce.command. ECCommand
defaultCommandClassName
 
Constructor Summary
SendMsgCmdImpl()
           
 
Method Summary
 void addContentPart(byte[] aMsgContentPart)
          Adds attachments to an e-mail message.
 void addContentPart(byte[] aMsgContentPart, java.lang.String aMsgContentPartName, java.lang.String aMsgContentPartType)
          Adds attachments to an e-mail message.
 void addMember(java.lang.Long aMember)
          Adds member information to get recipient data.
 void addMemberGroup(java.lang.Long aMemberGroup)
          Adds member group information to get recipient data
 void addSecureMember(java.lang.Long aMember)
          Adds secure member id to get recipient data.
 void addStore(java.lang.Integer astore_id)
          Adds a store.
 void compose(java.lang.String aView, CommandContext aCommandContext, TypedProperty aParms)
          Provides message composition services through the use as jsp templates.
 byte[] getContent(java.lang.Integer transport, java.lang.String language)
          Gets content of the message.
 java.lang.String getMsgTypeName()
          Returns the name of the message type.
 byte[] getResult()
          Returns the result of a sendReceive sending operation.
 boolean isReadyToCallExecute()
          Checks if the command is ready to call Execute.
 void performExecute()
          The business logic for this controller command.
 void remTransport(java.lang.Integer aRemoveTransportID)
          Allows the user to have transport(s) removed.
 void sendImmediate()
          Sets the sending mode to send the message immediately to the recipients.
 void sendReceiveImmediate()
          Sets the sending mode to send the message and wait for a reply.
 void sendTransacted()
          Sets the sending mode such that it sends the message in transacted mode.
 void setConfigData(java.lang.String aKey, java.lang.String aValue)
          Allows the user to configure the parameters of transport services used for the message.
 void setConfigNLData(java.lang.String aKey, java.lang.String language, java.lang.String aValue)
          Allows the user to configure NL specific parameters of transport services used for the message.
 void setContent(java.lang.Integer aTransportID, java.lang.String aLanguageID, byte[] aMsgContent)
          Allows a user to set the content body of a message using byte[] format.
 void setContent(java.lang.Integer aTransportID, java.lang.String aLanguageID, java.lang.String aMsgContent)
          Allows a user to set the content body of a message using String format.
 void setMsgType(java.lang.Integer aMsgType)
          Deprecated. use setMsgType(java.lang.String) instead.
 void setMsgType(java.lang.String aMsgType)
          Sets the message type required to initialize the messaging system.
 void setPartialSend(java.lang.Boolean aPartialSendFlag)
          Allows partial send when using e-mail as transport.
 void setPriority(java.lang.Integer aPriority)
          Sets the priority which can be used when initializing the messaging system.
 void setStoreID(java.lang.Integer aStoreID)
          Sets the store id required to initialize the messaging system.
 void validateParameters()
          Checks if message type and store id are set.
 
Methods inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail
public static final java.lang.String COPYRIGHT
The IBM copyright notice field.
See Also:
Constant Field Values
Constructor Detail

SendMsgCmdImpl

public SendMsgCmdImpl()
Method Detail

addContentPart

public void addContentPart(byte[] aMsgContentPart)
Adds attachments to an e-mail message.
Specified by:
addContentPart in interface SendMsgCmd
Parameters:
aMsgContentPart - The attachment (in byte array) to be added to the message.

addContentPart

public void addContentPart(byte[] aMsgContentPart,
                           java.lang.String aMsgContentPartName,
                           java.lang.String aMsgContentPartType)
Adds attachments to an e-mail message.
Specified by:
addContentPart in interface SendMsgCmd
Parameters:
aMsgContentPart - The attachment (in byte array) to be added to the message.
aMsgContentPartName - The name to be used for this attachment.
aMsgContentPartType - The content type of the part being sent For instance, in Mime Email, this could be 'text/plain'.

addMember

public void addMember(java.lang.Long aMember)
Adds member information to get recipient data.
Specified by:
addMember in interface SendMsgCmd
Parameters:
aMember - The member id of a recipient.

addMemberGroup

public void addMemberGroup(java.lang.Long aMemberGroup)
Adds member group information to get recipient data
Specified by:
addMemberGroup in interface SendMsgCmd

addSecureMember

public void addSecureMember(java.lang.Long aMember)
Adds secure member id to get recipient data. The information used will be hidden from the rest of recipients if there is any.
Specified by:
addSecureMember in interface SendMsgCmd
Parameters:
aMember - The secure member id.

addStore

public void addStore(java.lang.Integer astore_id)
Adds a store.
Specified by:
addStore in interface SendMsgCmd
Parameters:
astore_id - The store id.

compose

public void compose(java.lang.String aView,
CommandContext aCommandContext,
TypedProperty aParms)
Provides message composition services through the use as jsp templates.
Specified by:
compose in interface SendMsgCmd
Parameters:
aView - The viewname used for composing the message. It can be found in VIEWREG table.
aCommandContext - The context of this command execution.
aParms - The parameter list used to generate the message.

getContent

public byte[] getContent(java.lang.Integer transport,
                         java.lang.String language)
                  throws ECSystemException
Gets content of the message.
Specified by:
getContent in interface SendMsgCmd
Parameters:
transport - The transport id.
language - The encoding scheme of the language preference.
Returns:
byte[]
Throws:
ECSystemException

getMsgTypeName

public java.lang.String getMsgTypeName()
Returns the name of the message type.
Returns:
The name of the message type.

getResult

public byte[] getResult()
Returns the result of a sendReceive sending operation. This method should be called AFTER the execute for the command is called.
Specified by:
getResult in interface SendMsgCmd
Returns:
The byte array of the response message.

isReadyToCallExecute

public boolean isReadyToCallExecute()
Checks if the command is ready to call Execute.
Overrides:
isReadyToCallExecute in class AbstractECTargetableCommand
Returns:
true if the command is ready to call performExecute() method; false otherwise.

performExecute

public void performExecute()
                    throws ECException
The business logic for this controller command. For this default implementation we simply calls checkParameters. Command writers who overwrites this method should do a super() as the first line in their method if they want checkParameters to be called. It calls all the necessary steps to execute the messaging system services.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException - Raised with ERR_CMD_BAD_PROCESS_CMD message when an exception is encountered.

remTransport

public void remTransport(java.lang.Integer aRemoveTransportID)
Allows the user to have transport(s) removed. It calls setRemoveTransportID.
Specified by:
remTransport in interface SendMsgCmd
Parameters:
aRemoveTransportID - The unwanted transport id.
See Also:
setRemoveTransportID(Integer)

sendImmediate

public void sendImmediate()
Sets the sending mode to send the message immediately to the recipients.
Specified by:
sendImmediate in interface SendMsgCmd

sendReceiveImmediate

public void sendReceiveImmediate()
Sets the sending mode to send the message and wait for a reply.
Specified by:
sendReceiveImmediate in interface SendMsgCmd

sendTransacted

public void sendTransacted()
Sets the sending mode such that it sends the message in transacted mode. With this set, the command will store the message in the MSGSTORE table and let the scheduler batch job to send the messages at pre-determined time interval. The advantage of doing so is to avoid sending the message if the caller of this command encounters exception after calling this command.
Specified by:
sendTransacted in interface SendMsgCmd

setConfigData

public void setConfigData(java.lang.String aKey,
                          java.lang.String aValue)
Allows the user to configure the parameters of transport services used for the message.
Specified by:
setConfigData in interface SendMsgCmd
Parameters:
aKey - The name of the parameter.
aValue - The value of the parameter.

setConfigNLData

public void setConfigNLData(java.lang.String aKey,
                            java.lang.String language,
                            java.lang.String aValue)
Allows the user to configure NL specific parameters of transport services used for the message.
Specified by:
setConfigNLData in interface SendMsgCmd
Parameters:
aKey - The name of the parameter.
aValue - The value of the parameter.

setContent

public void setContent(java.lang.Integer aTransportID,
                       java.lang.String aLanguageID,
                       byte[] aMsgContent)
Allows a user to set the content body of a message using byte[] format. It calls setMsgContent(byte[]).
Specified by:
setContent in interface SendMsgCmd
Parameters:
aTransportID - The transport used in this command.
aMsgContent - The message content in byte array format.
See Also:
setMsgContent(byte[])

setContent

public void setContent(java.lang.Integer aTransportID,
                       java.lang.String aLanguageID,
                       java.lang.String aMsgContent)
                throws ECSystemException
Allows a user to set the content body of a message using String format. It converts the String object to UTF-8 format and calls setMsgContent(byte[]).
Specified by:
setContent in interface SendMsgCmd
Parameters:
aTransportID - The transport used in this command.
aMsgContent - The message content in String format.
Throws:
ECSystemException
See Also:
setMsgContent(byte[])

setMsgType

public void setMsgType(java.lang.Integer aMsgType)
Deprecated. use setMsgType(java.lang.String) instead.
Sets the message type required to initialize the messaging system.
Specified by:
setMsgType in interface SendMsgCmd
Parameters:
aMsgType - The message type identifier used for this command.

setMsgType

public void setMsgType(java.lang.String aMsgType)
Sets the message type required to initialize the messaging system.
Specified by:
setMsgType in interface SendMsgCmd
Parameters:
aMsgType - The message type name used for this command.

setPartialSend

public void setPartialSend(java.lang.Boolean aPartialSendFlag)
Allows partial send when using e-mail as transport. It calls setPartialSendFlag(Boolean).
Specified by:
setPartialSend in interface SendMsgCmd
Parameters:
aPartialSendFlag - true if the command should still send the message to the rest of recipients; false otherwise.
See Also:
setPartialSendFlag(Boolean)

setPriority

public void setPriority(java.lang.Integer aPriority)
Sets the priority which can be used when initializing the messaging system.
Specified by:
setPriority in interface SendMsgCmd
Parameters:
aPriority - The priority used to send the message.

setStoreID

public void setStoreID(java.lang.Integer aStoreID)
Sets the store id required to initialize the messaging system.
Specified by:
setStoreID in interface SendMsgCmd
Parameters:
aStoreID - The store id used by the command.

validateParameters

public void validateParameters()
                        throws ECException
Checks if message type and store id are set. They are both mandatory.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException - Raised with ERR_CMD_BAD_PARAM_CMD message if one of the parameters are not set.