com.ibm.commerce.tools.optools.order.commands
Class CSROrderCancelCmdImpl

com.ibm.commerce.command.AbstractECTargetableCommand
  |
  +--com.ibm.commerce.command.ControllerCommandImpl
        |
        +--com.ibm.commerce.tools.command.ToolsControllerCommandImpl
              |
              +--com.ibm.commerce.tools.optools.order.commands.CSROrderCancelCmdImpl
All Implemented Interfaces:
AccCommand, ControllerCommand, CSROrderCancelCmd, ECCommand, ECTargetableCommand, Protectable, ToolsControllerCommand

public class CSROrderCancelCmdImpl
extends ToolsControllerCommandImpl
implements CSROrderCancelCmd

 Call the AdminOrderCancel command to cancel orders.

 This class will also add commets to the canceled order.
 If the method isSendEmail() returns true, this command will also call CSROrderCommentsNotify command to send the comment to the email address specified.
 


Field Summary
static java.lang.String COPYRIGHT
           
static java.lang.String DIALOG_URL
           
protected  java.lang.String xmlFile
           
 
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.tools.optools.order.commands.CSROrderCancelCmd
defaultCommandClassName, NAME
 
Constructor Summary
CSROrderCancelCmdImpl()
           
 
Method Summary
protected  void cancelOrders()
          Cancel orders and add comment to orders if comment exists.
protected  void exceptionUtil(TypedProperty prop, java.lang.Exception ex, java.lang.String methodName, java.lang.String cmdName, java.lang.String errMsg)
          Common exception code for this command.
protected  void executeCommentNotifyCmd(java.lang.String orderId)
          Call the CSROrderCommentsNotofy to Send the order comment.
protected  void executeOrderCancelCmd(java.lang.String orderId)
          Call the AdminOrderCancel command to cancel an order.
 java.lang.String getEmailAddress()
          Get the email address.
 java.lang.String getNewComment()
          Get the comment needed to add to the order(s).
 java.util.Hashtable getNLS()
          Return NLS properties.
 java.util.Vector getOrderIds()
          Return list of order IDs.
 CommandContext getOrgCmdContext()
          Return original command context.
 java.lang.String getRedirectURL()
          Return the redirect URL.
 AccessVector getResources()
          Gets the access vector accessed by this command.
 java.lang.String getSuccessMsg()
          Return the successful message.
 java.lang.String getXmlFile()
          Return the XML file.
 boolean isEmailError()
          Return if it is unable to send the email.
 boolean isSendEmail()
          Return if there is a need to send the comment to the email address.
 void performExecute()
          This method performs the execution to cancel orders and add comment to canceled orders.
protected  void setEmailAddress(java.lang.String newEmailAddress)
          Set the email address.
protected  void setEmailError(boolean newEmailError)
          Set the flag to indicate if there is any problem sending email.
 void setNewComment(java.lang.String newNewComment)
          Set the order comment.
protected  void setNLS(java.util.Hashtable newNLS)
          Set NLS properties.
 void setOrderIds(java.util.Vector newOrderIds)
          Set Order IDs which needs to be canceled.
protected  void setOrgCmdContext(CommandContext newOrgCmdContext)
          Set original command context.
 void setRedirectURL(java.lang.String newRedirectURL)
          Set redirect URL.
protected  void setSendEmail(boolean newSendEmail)
          Set the flag to indicate if the order comment needs to be emailed.
protected  void setSuccessMsg(java.lang.String newSuccessMsg)
          Set the success message.
 void setXmlFile(java.lang.String newXmlFile)
          Set XML file.
 void validateParameters()
          Set the NLS properties and parse the input XML parameters.
 
Methods inherited from class com.ibm.commerce.tools.command.ToolsControllerCommandImpl
getViewInputProperties, setRequestProperties
 
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, setRequestProperties, 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

COPYRIGHT

public static final java.lang.String COPYRIGHT

DIALOG_URL

public static final java.lang.String DIALOG_URL

xmlFile

protected java.lang.String xmlFile
Constructor Detail

CSROrderCancelCmdImpl

public CSROrderCancelCmdImpl()
Method Detail

cancelOrders

protected void cancelOrders()
                     throws java.lang.Exception
Cancel orders and add comment to orders if comment exists. If the flag for sending the email is set, send the comment to the email address specified by the user.
Throws:
java.lang.Exception -  

exceptionUtil

protected void exceptionUtil(TypedProperty prop,
                             java.lang.Exception ex,
                             java.lang.String methodName,
                             java.lang.String cmdName,
                             java.lang.String errMsg)
                      throws ECApplicationException
Common exception code for this command.
Parameters:
prop - The response typed property.
ex - The catched exception.
methodName - The name of the method with exception.
cmdName - The name of the command.
errMsg - The translated error message string.
Throws:
ECApplicationException - The exception to be sent to the error handling view.

executeCommentNotifyCmd

protected void executeCommentNotifyCmd(java.lang.String orderId)
                                throws ECApplicationException,
                                       ECException
Call the CSROrderCommentsNotofy to Send the order comment.
Parameters:
orderId - The order ID to send the order comment.
Throws:
ECApplicationException -  
ECException -  

executeOrderCancelCmd

protected void executeOrderCancelCmd(java.lang.String orderId)
                              throws ECApplicationException,
                                     ECException
Call the AdminOrderCancel command to cancel an order.
Parameters:
orderId - The order ID.
Throws:
ECApplicationException - The exception description
ECException -  

getEmailAddress

public java.lang.String getEmailAddress()
Get the email address.
Returns:
The email address.

getNewComment

public java.lang.String getNewComment()
Get the comment needed to add to the order(s).
Returns:
The order comment.

getNLS

public java.util.Hashtable getNLS()
Return NLS properties.
Returns:
The NLS properties.

getOrderIds

public java.util.Vector getOrderIds()
Return list of order IDs.
Returns:
The order IDs.

getOrgCmdContext

public CommandContext getOrgCmdContext()
Return original command context.
Returns:
The original command context.

getRedirectURL

public java.lang.String getRedirectURL()
Return the redirect URL.
Returns:
The redirect URL.

getResources

public AccessVector getResources()
                          throws ECException
Gets the access vector accessed by this command. The default implementation returns null indicating that no protectable resource is accessed by this command.

Specified by:
getResources in interface ECCommand
Overrides:
getResources in class AbstractECTargetableCommand
Returns:
A vector of resource action pairs

getSuccessMsg

public java.lang.String getSuccessMsg()
Return the successful message.
Returns:
The successful message.

getXmlFile

public java.lang.String getXmlFile()
Return the XML file.
Returns:
The entire XML file.

isEmailError

public boolean isEmailError()
Return if it is unable to send the email.
Returns:
True if the email has not been sent successfully.

isSendEmail

public boolean isSendEmail()
Return if there is a need to send the comment to the email address.
Returns:
True if there is a need to send the comment to the email address.

performExecute

public void performExecute()
                    throws ECException
This method performs the execution to cancel orders and add comment to canceled orders. If the flag to indicate sending email is set, it will also send the order comment to the email address specified.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException -  

setEmailAddress

protected void setEmailAddress(java.lang.String newEmailAddress)
Set the email address.
Parameters:
newEmailAddress - The email address.

setEmailError

protected void setEmailError(boolean newEmailError)
Set the flag to indicate if there is any problem sending email.
Parameters:
newEmailError - The flag to indicate if email has not been successfully sent.

setNewComment

public void setNewComment(java.lang.String newNewComment)
Set the order comment.
Parameters:
newNewComment - The order comment.

setNLS

protected void setNLS(java.util.Hashtable newNLS)
Set NLS properties.
Parameters:
newNLS - The NLS properties.

setOrderIds

public void setOrderIds(java.util.Vector newOrderIds)
Set Order IDs which needs to be canceled.
Parameters:
newNewComment - The order IDs.

setOrgCmdContext

protected void setOrgCmdContext(CommandContext newOrgCmdContext)
Set original command context.
Parameters:
newOrgCmdContext - The original command context.

setRedirectURL

public void setRedirectURL(java.lang.String newRedirectURL)
Set redirect URL.
Parameters:
newRedirectURL - The redirect URL.

setSendEmail

protected void setSendEmail(boolean newSendEmail)
Set the flag to indicate if the order comment needs to be emailed.
Parameters:
newSendEmail - The flag to indicate if the order comment needs to be emailed.

setSuccessMsg

protected void setSuccessMsg(java.lang.String newSuccessMsg)
Set the success message.
Parameters:
newSuccessMsg - The success message.

setXmlFile

public void setXmlFile(java.lang.String newXmlFile)
Set XML file.
Parameters:
newXMLFile - The XML file used.

validateParameters

public void validateParameters()
                        throws ECException
Set the NLS properties and parse the input XML parameters.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException -