com.ibm.commerce.me.commands
Class BatchOrderRequestCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.ControllerCommandImpl
                    |
                    +--com.ibm.commerce.me.commands.BatchOrderRequestCmdImpl
All Implemented Interfaces:
AccCommand, BatchOrderRequestCmd, ControllerCommand, ECCommand, ECTargetableCommand

public class BatchOrderRequestCmdImpl
extends ControllerCommandImpl
implements BatchOrderRequestCmd

This controller command will receive a PurchaseOrderRequest message from a buyer organization using procurement system and creates an order.

See Also:
Serialized Form

Field Summary
protected  java.lang.Integer authType
           
protected  java.lang.Long btAddressId
           
protected  long buyerId
           
protected  java.lang.Long catalogId
           
protected  CIData ciData
           
protected  java.lang.Long contractId
           
protected  java.lang.Long memberGroupId
           
protected  java.lang.Long oldOrderId
           
protected  java.util.Vector oldQuotes
           
protected  java.lang.Long orderId
           
protected  java.lang.Long organizationUnitId
           
protected  ProcurementProtocolAccessBean protocolBean
           
protected  java.lang.Integer protocolId
           
protected  java.lang.String requisitionerId
           
protected  boolean solicitedOrder
          indicate whether order is solicited, default to false
protected  java.lang.Long stAddressId
           
protected  java.lang.Integer storeId
           
protected  long supplierId
           
 
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.me.commands. BatchOrderRequestCmd
COPYRIGHT, CREATE_MODE, defaultCommandClassName, DELETE_MODE, messageName, NAME, UPDATE_MODE
 
Fields inherited from interface com.ibm.commerce.command. ECTargetableCommand
COPYRIGHT
 
Constructor Summary
BatchOrderRequestCmdImpl()
          Default Constructor
 
Method Summary
protected  void checkRegistration()
          Check the user registration.
protected  void createOrderMessagingExtensionRecord(java.lang.Long orderRn)
          Creates an order extension record.
protected  void doProcess()
          The main business logic, processes the PurchaseOrderRequest message from the buyer organization using procurement system and creates an order.
 java.lang.Integer getAuthType()
          Gets the authentication type
 java.lang.Long getBuyerId()
          Gets the buyer id
 java.lang.Long getContractId()
          Gets the contract id
 java.lang.Long getOrganizationUnitId()
          Gets the organization unit id
 java.lang.Integer getProtocolId()
          Gets the protocol id
 java.lang.String getRequisitionerId()
          Gets the requisitioner id
 java.lang.Integer getStoreId()
          Gets the store id
 java.lang.Long getSupplierId()
          Gets the supplier id
protected  void initializeInputData()
          Initializes the input data
 boolean isGeneric()
          A user is generic till he logs on, so return true
 boolean isRetriable()
          Check to see if this command is retriable on transaction rollback exception.
protected  boolean isValidCredentials()
          check the credentials of the user who has submitted this order.
 void performExecute()
          If the checkParamateres are OK, authenticate the buyer and supplier credentials.
protected  void processOrderItems()
          Process the shopping cart items
protected  void retrieveUserInfo(java.lang.Long shoppingCartId)
          Changes the Shopping cart status from "I" to "H" i.e., requested status.
 void setAuthType(java.lang.Integer authType)
          Sets the authentication type
 void setBuyerId(java.lang.Long buyerId)
          Sets the buyer organization id
protected  void setBuyerRequestProperties()
          Sets the buyer request properties based on the protocol id and buyer id
 void setContractId(java.lang.Long contractId)
          Sets the contract id
 void setOrganizationUnitId(java.lang.Long orgUnit)
          Sets the organization unit id
 void setProtocolId(java.lang.Integer protocolId)
          Sets the protocol id
 void setRequestProperties( TypedProperty p)
          The WebController calls the setRequestProperties method before invoking the execute method in this command.
 void setRequisitionerId(java.lang.String requisitionerId)
          Sets the requisitioner id
 void setStoreId(java.lang.Integer storeId)
          Sets the store id
 void setSupplierId(java.lang.Long supplierId)
          Sets the supplier id
 void validateParameters()
          Validate parameters, the validation includes checking whether buyer credential is null or empty and whether the prtocol valid.
 
Methods inherited from class com.ibm.commerce.command. ControllerCommandImpl
checkPermission, fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResourceOwners, getResponseProperties, getRetriable, getViewInputProperties, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
 
Methods inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.commerce.command. ControllerCommand
checkPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, mergeProperties, setGeneric, setRetriable, setViewInputProperties
 
Methods inherited from interface com.ibm.commerce.command. AccCommand
accessControlCheck, getAccCheck, getForUserId, getResourceOwners, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command. ECCommand
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getUser, getUserId, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
 

Field Detail

buyerId

protected long buyerId

supplierId

protected long supplierId

storeId

protected java.lang.Integer storeId

orderId

protected java.lang.Long orderId

btAddressId

protected java.lang.Long btAddressId

stAddressId

protected java.lang.Long stAddressId

ciData

protected CIData ciData

protocolBean

protected ProcurementProtocolAccessBean protocolBean

protocolId

protected java.lang.Integer protocolId

authType

protected java.lang.Integer authType

contractId

protected java.lang.Long contractId

catalogId

protected java.lang.Long catalogId

memberGroupId

protected java.lang.Long memberGroupId

oldOrderId

protected java.lang.Long oldOrderId

requisitionerId

protected java.lang.String requisitionerId

organizationUnitId

protected java.lang.Long organizationUnitId

solicitedOrder

protected boolean solicitedOrder
indicate whether order is solicited, default to false

oldQuotes

protected java.util.Vector oldQuotes
Constructor Detail

BatchOrderRequestCmdImpl

public BatchOrderRequestCmdImpl()
Default Constructor
Method Detail

checkRegistration

protected void checkRegistration()
                          throws ECException
Check the user registration. If the user is registered update the requistions if necessary else register the user and get the users Id. The update and registration is done by invoking RegisterRequistionerCmd. ECException can be thrown when error occurs during the command creation and execution stages. The new user id is retrieved from the command and update the local variable usersId and the usersId in the current command context.
Throws:
ECException - Raised when error occurs during the command creation and execution stages

createOrderMessagingExtensionRecord

protected void createOrderMessagingExtensionRecord(java.lang.Long orderRn)
                                            throws ECException
Creates an order extension record. This includes migrating information from the purchase order header, eg. Order ID, Message ID, Coments. ECException is thrown when the ejb fails.
Parameters:
orderRn - Order reference number (key for the order extension record)
Throws:
ECException - Raised when the ejb encounters any problems

doProcess

protected void doProcess()
                  throws ECException
The main business logic, processes the PurchaseOrderRequest message from the buyer organization using procurement system and creates an order.
Throws:
ECException

getAuthType

public java.lang.Integer getAuthType()
Gets the authentication type
Returns:
an integer indicating the authentication type

getBuyerId

public java.lang.Long getBuyerId()
Gets the buyer id
Returns:
id of the buyer

getContractId

public java.lang.Long getContractId()
Gets the contract id
Returns:
the contract id

getOrganizationUnitId

public java.lang.Long getOrganizationUnitId()
Gets the organization unit id
Returns:
the id identifying the organization

getProtocolId

public java.lang.Integer getProtocolId()
Gets the protocol id
Returns:
id indentifying the protocol

getRequisitionerId

public java.lang.String getRequisitionerId()
Gets the requisitioner id
Returns:
requisitioner id

getStoreId

public java.lang.Integer getStoreId()
Gets the store id
Specified by:
getStoreId in interface ECCommand
Overrides:
getStoreId in class AbstractECTargetableCommand
Returns:
the store id

getSupplierId

public java.lang.Long getSupplierId()
Gets the supplier id
Returns:
the supplier id

initializeInputData

protected void initializeInputData()
Initializes the input data

isGeneric

public boolean isGeneric()
A user is generic till he logs on, so return true
Specified by:
isGeneric in interface ControllerCommand
Overrides:
isGeneric in class ControllerCommandImpl
Returns:
true if this command can be executed by a generic user false if this command cannot be executed by a generic user

isRetriable

public boolean isRetriable()
Check to see if this command is retriable on transaction rollback exception. A retriable command will be retried once on transaction rollback exception.
Specified by:
isRetriable in interface ControllerCommand
Overrides:
isRetriable in class ControllerCommandImpl
Returns:
true if this command is retriable false if this command is not retriable

isValidCredentials

protected boolean isValidCredentials()
                              throws ECException
check the credentials of the user who has submitted this order.
Throws:
ECException

performExecute

public void performExecute()
                    throws ECException
If the checkParamateres are OK, authenticate the buyer and supplier credentials. If the order is solicit order get the user id from the shopping cart id and change the shopping cart status from I to H. or else register the user.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
CommandException.
ECException

processOrderItems

protected void processOrderItems()
                          throws ECException
Process the shopping cart items
Throws:
ECException

retrieveUserInfo

protected void retrieveUserInfo(java.lang.Long shoppingCartId)
                         throws ECException
Changes the Shopping cart status from "I" to "H" i.e., requested status.
Parameters:
shoppingCartId - id identifying a shopping cart session
ECException

setAuthType

public void setAuthType(java.lang.Integer authType)
Sets the authentication type
Parameters:
authType - type of authentication mode

setBuyerId

public void setBuyerId(java.lang.Long buyerId)
Sets the buyer organization id
Parameters:
buyerId - the buyer id

setBuyerRequestProperties

protected void setBuyerRequestProperties()
Sets the buyer request properties based on the protocol id and buyer id

setContractId

public void setContractId(java.lang.Long contractId)
Sets the contract id
Parameters:
contractId - the contract id

setOrganizationUnitId

public void setOrganizationUnitId(java.lang.Long orgUnit)
Sets the organization unit id
Parameters:
orgUnit - the organization unit id

setProtocolId

public void setProtocolId(java.lang.Integer protocolId)
Sets the protocol id
Parameters:
protocolId - the protocol id

setRequestProperties

public void setRequestProperties(TypedProperty p)
                          throws ECException
The WebController calls the setRequestProperties method before invoking the execute method in this command. Set the POData by calling setPOData() passing requestProperties.
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class ControllerCommandImpl
Parameters:
p - request properties
Throws:
ECException

setRequisitionerId

public void setRequisitionerId(java.lang.String requisitionerId)
Sets the requisitioner id
Parameters:
requisitionerId - the requisitioner id

setStoreId

public void setStoreId(java.lang.Integer storeId)
Sets the store id
Parameters:
storeId - the store id

setSupplierId

public void setSupplierId(java.lang.Long supplierId)
Sets the supplier id
Parameters:
supplierId - the supplier id

validateParameters

public void validateParameters()
                        throws ECException
Validate parameters, the validation includes checking whether buyer credential is null or empty and whether the prtocol valid.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException.
ECException