com.ibm.commerce.utf.commands
Class RFQCompleteCmdImpl

com.ibm.commerce.command.AbstractECTargetableCommand
  |
  +--com.ibm.commerce.command.ControllerCommandImpl
        |
        +--com.ibm.commerce.tools.command.ToolsControllerCommandImpl
              |
              +--com.ibm.commerce.utf.commands.RFQCompleteCmdImpl
All Implemented Interfaces:
AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, Protectable, RFQCompleteCmd, ToolsControllerCommand

public class RFQCompleteCmdImpl
extends ToolsControllerCommandImpl
implements RFQCompleteCmd

Implementation class for completing an RFQ.


Field Summary
 boolean nonUTFMessage
           
 java.lang.Long rfqId
           
 java.lang.Long rfqOwner
           
 
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.utf.commands.RFQCompleteCmd
COPYRIGHT, defaultCommandClassName, NAME
 
Fields inherited from interface com.ibm.commerce.command.ECTargetableCommand
COPYRIGHT
 
Constructor Summary
RFQCompleteCmdImpl()
           
 
Method Summary
 boolean checkRFQState(java.lang.Integer currentRFQState)
          Checks the state of the RFQ.
 void createContracts()
          Creates a contract for each winning response.
 void createOrders()
          Creates an order for each winning response.
 void doAcknowledgment()
          Composes and sends out the response
 java.util.Hashtable getErrorContent()
          Returns a hastable of error codes.
 AccessVector getResources()
          Gets the access vector accessed by this command.
The protectable resource for this command is the RFQ object that needs to be completed.
 java.lang.Long getRfqId()
          Returns the RFQ identifier.
 java.lang.Long getRfqOwner()
          Returns the RFQ owner's member Id.
 java.lang.String getShippingAddress(java.util.Vector shippingAddressList, java.lang.String catentryId)
          Inspects the incoming list of shipping addresses to find the address corresponding to the incoming catalog entry.
 java.lang.String getShippingMode(java.util.Vector shippingModeList, java.lang.String catentryId)
          Inspects the incoming list of shipping modes to find the mode corresponding to the incoming catalog entry.
 java.util.Hashtable getToolXMLObject()
          Fetches the XML data prepared by the tools framework.
 java.lang.String getWinningResponseName(java.lang.String responseId)
          Gets the name of the winning response.
 boolean isNonUTFMessage()
          Provides an indication whether the error message is a UTF message or not.
 void performExecute()
          Completes the RFQ by creating a contract or an order for each winning response.
This method does the following:
    Calls createContracts() if the endresult s a Contract. Calls createOrders() if the endresult is an Order Sets the state of the RFQ to "Complete". Sets the completion time for the RFQ. Raises a UBF event to change the state of all the non-winning responses that are in evaluation for this RFQ
 void setError(java.lang.String errorKey, java.lang.String errorParams)
          Writes the errorcode into a hashtable
 void setError(java.lang.String errorKey, java.lang.String[] errorParams)
          Writes the errorcode into a hashtable
 void setErrorContent(java.util.Hashtable newErrorContent)
          Assigns the incoming hashtable containing error codes and parameters to the errorContent member variable.
 void setNonUTFMessage(boolean newNonUTFMessage)
          Assigns the incoming boolean value to the nonUTFMessage member variable.
 void setRequestProperties(TypedProperty requestProperties)
          Assigns the incoming XML object from the tools framework to a member variable toolsXMLObject.
 void setRfqId(java.lang.Long newRfqId)
          Assigns the incoming RFQ identifier to a member variable.
 void setRfqOwner(java.lang.Long newRfqOwner)
          Assigns the incoming member identifier of the RFQ owner to a member variable.
 void setToolXMLObject(java.util.Hashtable newToolXMLObject)
          Sets a member variable to the incoming tools XML object.
 void validateParameters()
          Validates the incoming parameters for this command.
This method expects the following parameters :
offering_id , the reference number of the RFQ that is to be completed

This method does the following:
    Checks if a RFQ Id has been specified. Checks if the specified RFQ Id is valid. Checks if the RFQ is in the appropriate state. Calls checkContractParamters, if the endresult of this RFQ is a contract. Calls checkOrderParamters, if the endresult of this RFQ is an order. Throws an INVALID OFFERING ID Excepion if the endresult is neither.
 
Methods inherited from class com.ibm.commerce.tools.command.ToolsControllerCommandImpl
getViewInputProperties
 
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, 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

nonUTFMessage

public boolean nonUTFMessage

rfqId

public java.lang.Long rfqId

rfqOwner

public java.lang.Long rfqOwner
Constructor Detail

RFQCompleteCmdImpl

public RFQCompleteCmdImpl()
Method Detail

checkRFQState

public boolean checkRFQState(java.lang.Integer currentRFQState)
Checks the state of the RFQ.

Parameters:
currentRFQState - The rfq state Integer value

createContracts

public void createContracts()
                     throws ECException
Creates a contract for each winning response.

This method does the following:

  1. Retrieves the list of winning responses for the incoming RFQ.
  2. For each response, performs the following steps.
  3. Creates a contract with the same name as the RFQ Response.
  4. Creates Shipping Charge TC.
  5. Creates Return Charge TC.
  6. Creates Return Payment TC.
  7. Creates Custom Price List TC.
  8. Creates Participant entries for the seller and the buyer.

Throws:
ECException -  

createOrders

public void createOrders()
                  throws ECException
Creates an order for each winning response.
This method does the following:
  1. Retrieves the list of winning responses for the incoming RFQ.
  2. For each response, performs the following steps.
  3. Calls the AdminOrderItemUpdateCmd for each item in the response. The outcome is a single order with one or more order items.
  4. Calls the OrderPrepareCmd that allocates inventory and performs Fulfillment Center related checks.
  5. Calls the OrderProcessCmd that handles payment processing.

Throws:
ECException -  

doAcknowledgment

public void doAcknowledgment()
Composes and sends out the response

getErrorContent

public java.util.Hashtable getErrorContent()
Returns a hastable of error codes.
Returns:
The hashtable containing error codes.

getResources

public AccessVector getResources()
                          throws ECException
Gets the access vector accessed by this command.
The protectable resource for this command is the RFQ object that needs to be completed.

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

getRfqId

public java.lang.Long getRfqId()
Returns the RFQ identifier.
Returns:
The RFQ Id.

getRfqOwner

public java.lang.Long getRfqOwner()
Returns the RFQ owner's member Id.
Returns:
The member Id of the RFQ owner.

getShippingAddress

public java.lang.String getShippingAddress(java.util.Vector shippingAddressList,
                                           java.lang.String catentryId)
Inspects the incoming list of shipping addresses to find the address corresponding to the incoming catalog entry.
Parameters:
shippingAddressList - A vector containing shipping information for catalog entries.
catentryId - The catalog entry identifier.
Returns:
The shipping address for the incoming catalog entry.

getShippingMode

public java.lang.String getShippingMode(java.util.Vector shippingModeList,
                                        java.lang.String catentryId)
Inspects the incoming list of shipping modes to find the mode corresponding to the incoming catalog entry.
Parameters:
shippingModeList - A vector containing shippingmode information for catalog entries.
catentryId - The catalog entry identifier.
Returns:
The shipping mode for the incoming catalog entry.

getToolXMLObject

public java.util.Hashtable getToolXMLObject()
Fetches the XML data prepared by the tools framework.
Returns:
A hashtable containing XML data from the tools framework.

getWinningResponseName

public java.lang.String getWinningResponseName(java.lang.String responseId)
Gets the name of the winning response.
Parameters:
responseId - The identifier of the winning response.
Returns:
The name of the winning response.

isNonUTFMessage

public boolean isNonUTFMessage()
Provides an indication whether the error message is a UTF message or not.
Returns:
true if the error message is a UTF message, false otherwise.

performExecute

public void performExecute()
                    throws ECException
Completes the RFQ by creating a contract or an order for each winning response.
This method does the following:
  1. Calls createContracts() if the endresult s a Contract.
  2. Calls createOrders() if the endresult is an Order
  3. Sets the state of the RFQ to "Complete".
  4. Sets the completion time for the RFQ.
  5. Raises a UBF event to change the state of all the non-winning responses that are in evaluation for this RFQ

Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException -  

setError

public void setError(java.lang.String errorKey,
                     java.lang.String errorParams)
Writes the errorcode into a hashtable
Parameters:
errorKey - The error code.
errorParams - The error parameters.

setError

public void setError(java.lang.String errorKey,
                     java.lang.String[] errorParams)
Writes the errorcode into a hashtable
Parameters:
errorKey - The error code.
errorParams - The error parameters.

setErrorContent

public void setErrorContent(java.util.Hashtable newErrorContent)
Assigns the incoming hashtable containing error codes and parameters to the errorContent member variable.
Parameters:
newErrorContent - The incoming hashtable containing error codes and parameters

setNonUTFMessage

public void setNonUTFMessage(boolean newNonUTFMessage)
Assigns the incoming boolean value to the nonUTFMessage member variable.
Parameters:
newNonUTFMessage - The incoming boolean value.

setRequestProperties

public void setRequestProperties(TypedProperty requestProperties)
                          throws ECApplicationException
Assigns the incoming XML object from the tools framework to a member variable toolsXMLObject.
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class ToolsControllerCommandImpl
Parameters:
requestProperties - TypedProperty containing the input parameters
Throws:
ECException -  

setRfqId

public void setRfqId(java.lang.Long newRfqId)
Assigns the incoming RFQ identifier to a member variable.
Parameters:
newRfqId - The RFQ identifier.

setRfqOwner

public void setRfqOwner(java.lang.Long newRfqOwner)
Assigns the incoming member identifier of the RFQ owner to a member variable.
Parameters:
newRfqOwner - The member Id of the RFQ owner.

setToolXMLObject

public void setToolXMLObject(java.util.Hashtable newToolXMLObject)
Sets a member variable to the incoming tools XML object.
Parameters:
newToolXMLObject - The XML object put together by tools framework.

validateParameters

public void validateParameters()
                        throws ECException
Validates the incoming parameters for this command.
This method expects the following parameters :
offering_id , the reference number of the RFQ that is to be completed

This method does the following:
  1. Checks if a RFQ Id has been specified.
  2. Checks if the specified RFQ Id is valid.
  3. Checks if the RFQ is in the appropriate state.
  4. Calls checkContractParamters, if the endresult of this RFQ is a contract.
  5. Calls checkOrderParamters, if the endresult of this RFQ is an order.
  6. Throws an INVALID OFFERING ID Excepion if the endresult is neither.

Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException -