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

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

public class CSROrderItemAddressUpdateCmdImpl
extends ToolsControllerCommandImpl
implements CSROrderItemAddressUpdateCmd

  Updates the address ID of the order item on behalf of the customer.
  If shippingAddressId is not provided, create a new address for the 
  customer by calling CSRCustomerAddressAddCmd. Once obtaining the 
  address Id, update the OrderItem by calling OrderItemUpdateCmd.
 


Field Summary
static java.lang.String COPYRIGHT
           
static java.lang.String ERRTASK_NAME
          Error handling viewname for this command.
 java.lang.Integer orgLangId
           
 
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.CSROrderItemAddressUpdateCmd
defaultCommandClassName, NAME
 
Constructor Summary
CSROrderItemAddressUpdateCmdImpl()
           
 
Method Summary
protected  void createAddress()
          This method generates an address Id based on the address information and address type passed to the command.
protected  TypedProperty exceptionUtil(TypedProperty prop, java.lang.Exception ex, java.lang.String methodName, java.lang.String cmdName)
          Common exception code for this command.
protected  void executeOrderItemUpdate()
          Update order item(s) with the given shipping address ID.
 java.lang.String getAddressId()
          Returns the address ID.
 java.lang.String getCustomerId()
          Returns the customer ID.
 java.util.Vector getItems()
          Return all the orderItems as a Vector.
protected  java.lang.String getMissingParam(java.lang.String msg)
          Returns the missing parameter for the address.
 java.util.Hashtable getNLS()
          Return the properties containing all translatable messages for this command.
 CommandContext getOrgCmdContext()
          Returns the original commandContext (administrator's command context).
 java.lang.Integer getOrgLangId()
          Return original language ID.
 java.util.Locale getOrgLocale()
          Return original locale.
 TypedProperty getOrgReqProperties()
          Return original request properties.
 java.lang.String getRedirectURL()
          Returns the redirect URL that is to be executed after this controller command terminates.
 AccessVector getResources()
          Gets the access vector accessed by this command.
 void performExecute()
          This method perform the execution for creating an new shipping addressId for the customer and update order item(s).
protected  void setAddressId(java.lang.String newAddressId)
          Set address ID.
protected  void setCustomerId(java.lang.String newCustomerId)
          Set customer ID.
 void setItems(java.util.Vector newItems)
          Set all orderItems to be updated.
protected  void setNLS(java.util.Hashtable newNLS)
          Set NLS properties.
protected  void setOrgCmdContext(CommandContext newOrgCmdContext)
          Set original commandContext.
protected  void setOrgLangId(java.lang.Integer newOrgLangId)
          Set the original language ID.
protected  void setOrgLocale(java.util.Locale newOrgLocale)
          Set original locale.
protected  void setOrgReqProperties(TypedProperty newOrgReqProperties)
          Set original request properties.
protected  void setRedirectURL(java.lang.String newRedirectURL)
          Set redirect URL.
 void validateParameters()
          This method gets the XMLObject from the GUI Dialog.
 
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

ERRTASK_NAME

public static java.lang.String ERRTASK_NAME
Error handling viewname for this command.

orgLangId

public java.lang.Integer orgLangId
Constructor Detail

CSROrderItemAddressUpdateCmdImpl

public CSROrderItemAddressUpdateCmdImpl()
Method Detail

createAddress

protected void createAddress()
                      throws ECException
This method generates an address Id based on the address information and address type passed to the command.

In address Hashtable, it contains following information:

  • nick name
  • last name
  • first name
  • address1
  • address2
  • city
  • region(state)
  • country
  • postalCode(zipcode)
  • phonenumber
  • email
    Throws:
    ECException -  

  • exceptionUtil

    protected TypedProperty exceptionUtil(TypedProperty prop,
                                          java.lang.Exception ex,
                                          java.lang.String methodName,
                                          java.lang.String cmdName)
    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.
    Returns:
    The proper typed property with redirection to the error page.

    executeOrderItemUpdate

    protected void executeOrderItemUpdate()
                                   throws ECException
    Update order item(s) with the given shipping address ID.
    Throws:
    ECException - The exception thrown by the OrderItemUpdateCmd.

    getAddressId

    public java.lang.String getAddressId()
    Returns the address ID.
    Returns:
    The shipping address ID to be used.

    getCustomerId

    public java.lang.String getCustomerId()
    Returns the customer ID.
    Returns:
    The customer ID that owns the address.

    getItems

    public java.util.Vector getItems()
    Return all the orderItems as a Vector.
    Returns:
    java.util.Vector A vector containing the order items to update.

    getMissingParam

    protected java.lang.String getMissingParam(java.lang.String msg)
    Returns the missing parameter for the address.
    Parameters:
    msg - The error message from the AddressUpdateCmd command.
    Returns:
    The formatted error message string that will be sent to the error page.

    getNLS

    public java.util.Hashtable getNLS()
    Return the properties containing all translatable messages for this command.
    Returns:
    Name value pairs of translatable messages.

    getOrgCmdContext

    public CommandContext getOrgCmdContext()
    Returns the original commandContext (administrator's command context).
    Returns:
    The original command context when calling this command.

    getOrgLangId

    public java.lang.Integer getOrgLangId()
    Return original language ID.
    Returns:
    The original language ID.

    getOrgLocale

    public java.util.Locale getOrgLocale()
    Return original locale.
    Returns:
    The original locale.

    getOrgReqProperties

    public TypedProperty getOrgReqProperties()
    Return original request properties.
    Returns:
    The original request properties.

    getRedirectURL

    public java.lang.String getRedirectURL()
    Returns the redirect URL that is to be executed after this controller command terminates.
    Returns:
    The name of the view to be redirected to.

    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 used by the command.

    performExecute

    public void performExecute()
                        throws ECException
    This method perform the execution for creating an new shipping addressId for the customer and update order item(s).
    Specified by:
    performExecute in interface ECCommand
    Overrides:
    performExecute in class AbstractECTargetableCommand
    Throws:
    ECException -  

    setAddressId

    protected void setAddressId(java.lang.String newAddressId)
    Set address ID.
    Parameters:
    newAddressId - The shipping address ID to be used for updating the order item.

    setCustomerId

    protected void setCustomerId(java.lang.String newCustomerId)
    Set customer ID.
    Parameters:
    newCustomerId - The customer ID.

    setItems

    public void setItems(java.util.Vector newItems)
    Set all orderItems to be updated.
    Parameters:
    newItems - A vector containing the order items to be updated.

    setNLS

    protected void setNLS(java.util.Hashtable newNLS)
    Set NLS properties.
    Parameters:
    newNLS - The name-value pairs containing the messages to be used by this command.

    setOrgCmdContext

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

    setOrgLangId

    protected void setOrgLangId(java.lang.Integer newOrgLangId)
    Set the original language ID.
    Parameters:
    newOrgLangId - The original language ID.

    setOrgLocale

    protected void setOrgLocale(java.util.Locale newOrgLocale)
    Set original locale.
    Parameters:
    newOrgLocale - The locale from the original command context.

    setOrgReqProperties

    protected void setOrgReqProperties(TypedProperty newOrgReqProperties)
    Set original request properties.
    Parameters:
    newOrgReqProperties - The original request properties.

    setRedirectURL

    protected void setRedirectURL(java.lang.String newRedirectURL)
    Set redirect URL.
    Parameters:
    newRedirectURL - The name of the redirect page.

    validateParameters

    public void validateParameters()
                            throws ECApplicationException
    This method gets the XMLObject from the GUI Dialog. It parses the XMLObject to get the information into the commands local variables. It also sets the success redirect URL, customer ID and address ID if any.
    Specified by:
    validateParameters in interface ECCommand
    Overrides:
    validateParameters in class AbstractECTargetableCommand
    Throws:
    ECApplicationException - If cannot parse the XMLObject as expected, throw ECApplicationException