com.ibm.commerce.requisitionlist.commands
Class RequisitionListSubmitCmdImpl

com.ibm.commerce.command.AbstractECTargetableCommand
  |
  +--com.ibm.commerce.command.ControllerCommandImpl
        |
        +--com.ibm.commerce.requisitionlist.commands.RequisitionListBaseCmdImpl
              |
              +--com.ibm.commerce.requisitionlist.commands.RequisitionListSubmitCmdImpl
All Implemented Interfaces:
AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, Protectable, RequisitionListSubmitCmd

public class RequisitionListSubmitCmdImpl
extends RequisitionListBaseCmdImpl
implements RequisitionListSubmitCmd

Submit a requisition list for order processing.


Field Summary
protected  java.lang.Long[] iContractId
          The contract id.
protected  java.lang.Long[] iOfferId
          The offer id.
 
Fields inherited from class com.ibm.commerce.requisitionlist.commands.RequisitionListBaseCmdImpl
iOrderId, iRequisitionListId, iRequisitionListName, iRequisitionListStatus
 
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.requisitionlist.commands.RequisitionListSubmitCmd
COPYRIGHT, defaultCommandClassName, NAME
 
Fields inherited from interface com.ibm.commerce.command.ECTargetableCommand
COPYRIGHT
 
Constructor Summary
RequisitionListSubmitCmdImpl()
           
 
Method Summary
protected  void action()
          The main action of the command.
 void addOrderItemNVPs(TypedProperty req, OrderItemAccessBean orderItemAB, int i)
          Add some name value pairs to the req based on the columns in the orderItamAB.
protected  OrderAccessBean copyOrder(OrderAccessBean fromOrderAB)
          Copy the OrderAccessBean fromOrderAB and return a new created OrderAccessBean which is a clone of fromOrderAB.
protected  java.lang.String[] getContractId()
          Return an array of contract ids.
protected  java.lang.String[] getOfferId()
          Return an array of offer ids.
 java.lang.Long getOrderId()
          Returns the id of the order.
 AccessVector getResources()
          It returns the store access bean and the order access bean.
 void performExecute()
          The main execution of the command.
protected  void prepareOrder(java.lang.Long orderId)
          Prepare an order.
 void setContractId(java.lang.Long[] id)
          Specifies an array of contract ids for price calculation.
 void setOfferId(java.lang.Long[] id)
          Specifies an array of offer ids for price calculation.
 void setRequestProperties(TypedProperty reqProperties)
          The WebController calls this method before invoking the execute method in this command to set the request properties for this command.
 void setRequisitionListId(java.lang.Long id)
          Specifies the requisition list id to be submitted.
protected  void updateResponseView()
          Sets the response view - Redirect View.
 void validateParameters()
          Validate the input parameters.
 
Methods inherited from class com.ibm.commerce.requisitionlist.commands.RequisitionListBaseCmdImpl
copyOrder, copyOrderAccessBean, copyOrderItemAccessBean, copyOrderPayInfo, getName, getRequisitionListId, getStatus, reset, setDefaultRequisitionListStatus, setName, setOrderId, setStatus
 
Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl
fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, 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, 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

iContractId

protected java.lang.Long[] iContractId
The contract id.

iOfferId

protected java.lang.Long[] iOfferId
The offer id.
Constructor Detail

RequisitionListSubmitCmdImpl

public RequisitionListSubmitCmdImpl()
Method Detail

action

protected void action()
               throws java.sql.SQLException,
                      javax.ejb.CreateException,
                      javax.ejb.FinderException,
                      javax.naming.NamingException,
                      java.rmi.RemoteException,
                      ECException
The main action of the command.

It calls copyOrder() to copy the requisition list and then calls prepareOrder() to prepare the order.


addOrderItemNVPs

public void addOrderItemNVPs(TypedProperty req,
                             OrderItemAccessBean orderItemAB,
                             int i)
                      throws java.sql.SQLException,
                             javax.ejb.CreateException,
                             javax.ejb.FinderException,
                             javax.naming.NamingException,
                             java.rmi.RemoteException,
                             ECException
Add some name value pairs to the req based on the columns in the orderItamAB. If the catalogEntryId in orderItemAB is not null, it will add a nvp ("catEntryId_i", orderItemAB.getCatalogEntryId()) to req. The following columns are checked:

copyOrder

protected OrderAccessBean copyOrder(OrderAccessBean fromOrderAB)
                             throws java.sql.SQLException,
                                    javax.ejb.CreateException,
                                    javax.ejb.FinderException,
                                    javax.naming.NamingException,
                                    java.rmi.RemoteException,
                                    ECException
Copy the OrderAccessBean fromOrderAB and return a new created OrderAccessBean which is a clone of fromOrderAB. This method overwrites the method in the super class. It first calls copyOrderAccessBean(OrderAccessBean) to create a new OrderAccessBean and calls addOrderItemNVPs() to add NVPs in the requestProperty and then calls OrderItemAddCmd to create the order items. It also calls copyOrderPayInfo() to copy the order pay info.
Overrides:
copyOrder in class RequisitionListBaseCmdImpl

getContractId

protected java.lang.String[] getContractId()
Return an array of contract ids.

getOfferId

protected java.lang.String[] getOfferId()
Return an array of offer ids.

getOrderId

public java.lang.Long getOrderId()
Description copied from class: RequisitionListBaseCmdImpl
Returns the id of the order.
Overrides:
getOrderId in class RequisitionListBaseCmdImpl

getResources

public AccessVector getResources()
                          throws ECException
It returns the store access bean and the order access bean.
Specified by:
getResources in interface ECCommand
Overrides:
getResources in class AbstractECTargetableCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Returns:
AccessVector - a vector of resource action pairs

performExecute

public void performExecute()
                    throws ECException
The main execution of the command. It calls the follwoing methods:
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.

prepareOrder

protected void prepareOrder(java.lang.Long orderId)
                     throws java.sql.SQLException,
                            javax.ejb.CreateException,
                            javax.ejb.FinderException,
                            javax.naming.NamingException,
                            java.rmi.RemoteException,
                            ECException
Prepare an order. It calls OrderPrepareCmd to prepare the order.

setContractId

public void setContractId(java.lang.Long[] id)
Description copied from interface: RequisitionListSubmitCmd
Specifies an array of contract ids for price calculation.
Specified by:
setContractId in interface RequisitionListSubmitCmd

setOfferId

public void setOfferId(java.lang.Long[] id)
Description copied from interface: RequisitionListSubmitCmd
Specifies an array of offer ids for price calculation.
Specified by:
setOfferId in interface RequisitionListSubmitCmd

setRequestProperties

public void setRequestProperties(TypedProperty reqProperties)
                          throws ECException
Description copied from interface: ControllerCommand
The WebController calls this method before invoking the execute method in this command to set the request properties for this command. It is the responsibility of the implementer of the ControllerCommand to extract the required input parameters from the request properties and perform parameter checking.
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class RequisitionListBaseCmdImpl
Following copied from interface: com.ibm.commerce.command.ControllerCommand
Parameters:
requestProperties - com.ibm.commerce.datatype.TypedProperty
Throws:
com.ibm.commerce.exception.ECException. -  

setRequisitionListId

public void setRequisitionListId(java.lang.Long id)
Description copied from interface: RequisitionListSubmitCmd
Specifies the requisition list id to be submitted.
Specified by:
setRequisitionListId in interface RequisitionListSubmitCmd
Overrides:
setRequisitionListId in class RequisitionListBaseCmdImpl

updateResponseView

protected void updateResponseView()
Sets the response view - Redirect View. It also sets the output parameter orderId.
Overrides:
updateResponseView in class RequisitionListBaseCmdImpl

validateParameters

public void validateParameters()
                        throws ECException
Validate the input parameters.

It checks the following mandatory parameters:

It also checks the validation of the follwoing parameter values:

Exception:

Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
ECException. -