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

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

public class CSROrderItemAddCmdImpl
extends ToolsControllerCommandImpl
implements CSROrderItemAddCmd

Adds one or more order items to an order

If the order does not exist, creates one and return the order ID.
If a new order is created, this command will change the status of the new order and its order items to 'E' state. 
If the order ID is specified, adds the order items to the order.
If ship mode ID is not specified, the server runtime will randomly select one to use.


Field Summary
static java.lang.String COPYRIGHT
           
static java.lang.String ERRTASK_NAME
           
 
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.CSROrderItemAddCmd
defaultCommandClassName, NAME
 
Constructor Summary
CSROrderItemAddCmdImpl()
           
 
Method Summary
protected  TypedProperty exceptionUtil(TypedProperty prop, java.lang.Exception ex, java.lang.String methodName, java.lang.String cmdName)
          Generates common exception code.
 void executeCSROrderStatusChange(java.lang.String theOrderId, java.lang.String newStatus)
          Call CSROrderStatusChange command to change the status of the order and its order items.
protected  void executeOrderItemAdd()
          Calls OrderItemAddCmd to add the order item into the order with the following parameters: catentryId quantity contractId shipModeId shipAddrId When a new order is created, this method will change the status of the new order and its order items to Edit state.
 java.util.Vector getAddItems()
          Gets the items to be added.
 java.lang.String getAddressId()
          Gets the address ID for which the order item is to be added
 java.util.Vector getItems()
          Gets the items in the order
 java.util.Hashtable getNLS()
          Returns NLS properties.
 java.lang.String getOrderId()
          Gets the order ID for which the items are to be added
 CommandContext getOrgCmdContext()
          Gets the original command context
 TypedProperty getOrgReqProperties()
          Gets the original request properties
 java.lang.String getRedirectURL()
          Gets the redirect URL
 AccessVector getResources()
          Gets the access vector accessed by this command.
 java.lang.String getShipModeId()
          Gets the shipping mode ID for which the order item is to be added
 java.lang.String getShopperId()
          Gets the shopper ID for which the order is to be added
 void performExecute()
          Adds the items into the order.
 void setAddItems(java.util.Vector newAddItems)
          Sets the items to be added to the order
 void setAddressId(java.lang.String newAddressId)
          Sets the address ID for which the items is to be added
 void setItems(java.util.Vector newItems)
          Sets the items of the order
protected  void setNLS(java.util.Hashtable newNLS)
          Sets NLS properties.
 void setOrderId(java.lang.String newOrderId)
          Sets the order ID into which the items are added
 void setOrgCmdContext(CommandContext newOrgCmdContext)
          Sets the original command context
 void setOrgReqProperties(TypedProperty newOrgReqProperties)
          Sets the original request properties
 void setRedirectURL(java.lang.String newRedirectURL)
          Sets the redirect URL
 void setShipModeId(java.lang.String newShipModeId)
          Sets the shipping mode ID for which the items are added
 void setShopperId(java.lang.String newShopperId)
          Sets the shopper ID for which the items are added
 void validateParameters()
          Gets XMLObject from the GUI Notebook or Wizard and get ready to parse it.
 
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
Constructor Detail

CSROrderItemAddCmdImpl

public CSROrderItemAddCmdImpl()
Method Detail

exceptionUtil

protected TypedProperty exceptionUtil(TypedProperty prop,
                                      java.lang.Exception ex,
                                      java.lang.String methodName,
                                      java.lang.String cmdName)
Generates common exception code.
Parameters:
prop - The response typed property.
ex - The catched exception.
methodName - The method that generates the exception
cmdName - The command that generates the exception
Returns:
The response typed property of the exception

executeCSROrderStatusChange

public void executeCSROrderStatusChange(java.lang.String theOrderId,
                                        java.lang.String newStatus)
                                 throws ECException
Call CSROrderStatusChange command to change the status of the order and its order items.
Parameters:
newStatus - The status of the order and its order items.
theOrderId - The ID of the order.
Throws:
ECException -  

executeOrderItemAdd

protected void executeOrderItemAdd()
                            throws ECException
Calls OrderItemAddCmd to add the order item into the order with the following parameters: When a new order is created, this method will change the status of the new order and its order items to Edit state.
Throws:
ECException - If the order item cannot be added

getAddItems

public java.util.Vector getAddItems()
Gets the items to be added.
Returns:
The vector containing the items to be added to the order

getAddressId

public java.lang.String getAddressId()
Gets the address ID for which the order item is to be added
Returns:
The address ID

getItems

public java.util.Vector getItems()
Gets the items in the order
Returns:
The vector that contains the items in the order

getNLS

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

getOrderId

public java.lang.String getOrderId()
Gets the order ID for which the items are to be added
Returns:
The order ID

getOrgCmdContext

public CommandContext getOrgCmdContext()
Gets the original command context
Returns:
The original command context

getOrgReqProperties

public TypedProperty getOrgReqProperties()
Gets the original request properties
Returns:
The original request properties

getRedirectURL

public java.lang.String getRedirectURL()
Gets 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:
The vector of resource action pairs

getShipModeId

public java.lang.String getShipModeId()
Gets the shipping mode ID for which the order item is to be added
Returns:
The shipping mode ID

getShopperId

public java.lang.String getShopperId()
Gets the shopper ID for which the order is to be added
Returns:
The shopper ID

performExecute

public void performExecute()
                    throws ECException
Adds the items into the order. It creates a new order with the items if it does not exist
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException - If the item cannot be added

setAddItems

public void setAddItems(java.util.Vector newAddItems)
Sets the items to be added to the order
Parameters:
newAddItems - The vector of items to be added to the order

setAddressId

public void setAddressId(java.lang.String newAddressId)
Sets the address ID for which the items is to be added
Parameters:
newAddressId - The address ID

setItems

public void setItems(java.util.Vector newItems)
Sets the items of the order
Parameters:
newItems - The vector of items in the order

setNLS

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

setOrderId

public void setOrderId(java.lang.String newOrderId)
Sets the order ID into which the items are added
Parameters:
newOrderId - The order ID

setOrgCmdContext

public void setOrgCmdContext(CommandContext newOrgCmdContext)
Sets the original command context
Parameters:
newOrgCmdContext - The original command context

setOrgReqProperties

public void setOrgReqProperties(TypedProperty newOrgReqProperties)
Sets the original request properties
Parameters:
newOrgReqProperties - The original request properties

setRedirectURL

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

setShipModeId

public void setShipModeId(java.lang.String newShipModeId)
Sets the shipping mode ID for which the items are added
Parameters:
newShipModeId - The shipping mode ID

setShopperId

public void setShopperId(java.lang.String newShopperId)
Sets the shopper ID for which the items are added
Parameters:
newShopperId - The shopper ID

validateParameters

public void validateParameters()
                        throws ECApplicationException
Gets XMLObject from the GUI Notebook or Wizard and get ready to parse it.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECApplicationException - If the XML does not contain the required parameters