com.ibm.commerce.orderquotation.commands

Class OrderQuotationRequestCmdImpl

  • All Implemented Interfaces:
    AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, OrderQuotationRequestCmd, Protectable, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable


    public class OrderQuotationRequestCmdImpl
    extends ControllerCommandImpl
    implements OrderQuotationRequestCmd
    This is the default implementation of the OrderQuotationRequestCmd controller command.

    Parameter values

    quotationType
    Specifies the type of quotation requested, "initial" or "final". The default value of this parameter is "initial".
    orderId
    Specifies the shopping cart for which quotations are to be requested. The default value of this parameter is ".". This parameter can be repeated.
    deleteOrderQuotationRelId
    Specifies the OrderQuotationRel objects to be deleted (along with their child orders). If their type is "initial", "final", or "selection" and if their parent orders are one of the shopping carts specified in the orderId parameter. The default value of this parameter is "*n". This parameter can be repeated.
    quotationStoreId_i
    Specifies a store from which quotations are to be requested. Stores that are not quote-enabled under the contract specified by the quotationContractId_i parameter for the current user in the current store are ignored.
    quotationContractId_i
    Specifies a contract containing a ReferralInterfaceTC that indicates a PolicyCommand to be used to obtain a quotation. A system exception is thrown if a specified contract does not contain such a ReferralInterfaceTC or is not deployed in the store indicated in quotationStoreId_i. This parameter is ignored if quotationStoreId_i is not specified.
    quotationUserId_i
    Specifies the user ID to be sent with the quotation request. Which is sent to the store indicated by storeId_i for the contract indicated by quotationContract_i. This parameter is ignored if quotationStoreId_i is not specified.
    quotationPassword_i
    Specifies a password for the user ID specified by the quotationUserId_i parameter. This parameter is ignored if quotationStoreUserId_i is not specified.
    outOrderQuotationRelIdName
    Specifies the name-value pairs that should be added to the redirection URL. The values of the name-value pairs are the identifiers of the OrderQuotationRel objects created by this command invocation. This parameter can be repeated.
    URL
    Specifies the redirection URL that is returned when the command successfully completes.

    Behavior

    • The ResolveOrdersCmd and ResolveOrderQuotationRelsCmd task commands are invoked to evaluate any abbreviations specified by the orderId and deleteOrderQuotationRelId parameters respectively.
    • For each order specified by the orderId parameter, if it has status attribute 'P' or 'E':
      • Assign a displaySequence number to each of the specified quotation store and contract pairs:
        • Assign sequence numbers that reflect the sequence in which the store and contract pairs appear in the quotationStoreId_i and quotationContractId_i parameters. When the parameters are arranged in sequence of i from low to high.
      • Remove from the quotationStoreId_i and quotationContractId_i parameter list (that is, ignore). Which specifies store and contract pairs that are not quote enabled for the current user in the current store.
      • If quotationType is initial:
        • For each store and contract pair specified by the quotationStoreId_i and quotationContractId_i parameters:
          • Determine a list of OrderItemData for which quotations should be requested, as follows:
            • Include all order items from the specified order.
      • If quotationType is final:
        • Determine a list of OrderQuotationRel objects with relType "selection": the parent order is the order specified by the orderId parameter. And whose childStoreId attribute indicates one of the stores specified by the quotationStoreId_i parameter. And whose tradingAgreementId attribute indicates the contract specified by the corresponding quotationContractId_i parameter.
        • For each store and contract pair specified by the quotationStoreId_i and quotationContract_i parameters:
          • Determine a list of OrderItemData for which quotations should be requested, as follows:
            • Include all OrderItems from the child order referenced by OrderQuotationRel object in the preceding determined list. Whose childStoreId and tradingAgreementId attributes indicate the specified store and contract.
      • For each store and contract pair specified by the quotationStoreId_i and quotationContractId_i parameters. Delete all OrderQuotationRel objects for this order, store, and contract whose relType attributes match the specified quotationType. And also delete any child orders they reference. Also delete the OrderQuotationRel objects specified by the deleteOrderQuotationRelId parameter, and their child orders. But only those ones with relType "initial", "final", or "selection" and whose parentOrderId attribute indicates the order being processed (specified by the orderId parameter).
      • For each store and contract pair (specified by the quotationStoreId_i and quotationContractId_i parameters) that has OrderItemData in its above determined list:
        • Create a new OrderQuotationRel object for the specified order with the specified relType. Set the childStoreId and tradingAgreementId attributes to indicate the store and contract. Set the displaySequence attribute to the displaySequence number assigned (above) to the store and contract pair. Set the tradingAgreementId attribute to indicate the TradingAgreement of the contract.
        • Set the timeoutTime attribute of the OrderQuotationRel object to: the current time plus the number of seconds specified by the quoteWaitFor attribute of the ReferralInterfaceTC of the TradingAgreement of the contract.
    • Call the requestOrderQuotationCmd to request quotations for each of the preceding created OrderQuotationRel objects and its above determined list of OrderItemData. (if the list is not empty). Pass the specified quotationUserId and quotationPassword as well as the OrganizationId of the order.
    • Redirect to the URL specified by the URL parameter by: setting the viewTaskName response property to "RedirectView". Setting the redirecturl response property to the value specified by the URL parameter. And adding response properties with names and values as specified by the outOrderQuotationRelIdName parameter.

    Exception conditions

    • If the value of a specified input parameter is missing or invalid, the command throws an ECApplicationException with error message _ERR_BAD_MISSING_CMD_PARAMETER and error view GenericApplicationError.
    See Also:
    Serialized Form
    • Constructor Detail

      • OrderQuotationRequestCmdImpl

        public OrderQuotationRequestCmdImpl()
    • Method Detail

      • getURL

        public java.lang.String getURL()
        Gets the URL.
        Returns:
        The URL
      • setURL

        public void setURL(java.lang.String URL)
        Sets the URL
        Parameters:
        URL - The URL to set
      • reset

        public void reset()
        Resets the command.
        Specified by:
        reset in interface com.ibm.websphere.command.Command
        Overrides:
        reset in class AbstractECTargetableCommand
      • setRequestProperties

        public void setRequestProperties(TypedProperty aRequestProperties)
                                  throws ECException
        Sets the requestProperties for the command.
        Specified by:
        setRequestProperties in interface ControllerCommand
        Overrides:
        setRequestProperties in class ControllerCommandImpl
        Parameters:
        aRequestProperties - The request properties. This parameter includes the following name value pairs:
        quotationType (optional, default=initial)
        The type of quotation requested. Valid values: initial, final.
        orderId (optional, default=. (the current pending Orders))
        The shopping carts for which quotations are to be requested. Valid values: list of (OrderId | Order abbreviation)
        quotationStoreId_<i> (optional)
        The Stores from which quotations are to be requested. Stores are ignored if: they are not quote enabled under the Contract specified by the quotationContractId_<i> parameter for the current user in the current Store.
        quotationContractId_<i> (optional, default=The default Contract for the Store indicated by quotationStoreId_<i>)
        The Contract that contain a ReferralInterfaceTCs that indicates a PolicyCommand to be used to obtain a quotation. A system exception is thrown if a specified Contract does not contain such a ReferralInterfaceTC. Or is not deployed in the Store indicated by quotationStoreId_<i>. Ignored if quotationStoreId_<i> is not specified.
        quotationUserId_<i> (optional)
        A user ID to be sent with the quotation request sent to the Store. Which is indicated by quotationStoreId_<i> for the Contract indicated by quotationContract_<i>. Ignored if quotationStoreId_<i> is not specified.
        quotationPassword_<i> (optional)
        A password for the user ID specified by the quotationUserId_<i> parameter. Ignored if quotationStoreId_<i> is not specified.
        outOrderQuotationRelIdName (optional)
        The names of name value pairs that should be added to the redirection URL. The values of the added name value pairs are the identifiers of the OrderQuotationRel objects created by this command invocation.
        URL
        The redirection URL that is returned when the command successfully completes.
        Throws:
        ECException - These exceptions are allowed to percolate.
      • getOrderIds

        public java.lang.String[] getOrderIds()
        Gets the shopping carts for which quotations are to be requested.
        Returns:
        The array of order ids.
      • setOrderIds

        public void setOrderIds(java.lang.String[] orderIds)
        (Optional) Sets the shopping carts for which quotations are to be requested. If not specified, the default is "." (the current pending orders).
        Parameters:
        orderIds - The orderIds of the shopping carts.
      • getQuotationType

        public java.lang.String getQuotationType()
        Gets the quotation type.
        Returns:
        The quotation type.
      • setQuotationType

        public void setQuotationType(java.lang.String quotationType)
        (Optional) This method sets the quotation type. If not specified, the default is "initial".
        Parameters:
        quotationType - The quotation type to set.
      • setQuotationStoreIds

        public void setQuotationStoreIds(java.util.Hashtable quotationStoreIds)
        (Optional) Sets the quotationStoreIds. This parameter is a map where the key is an Integer and the entry at any key is a quotation store id. The keys should not include the integer 0.
        Parameters:
        quotationStoreIds - The map of quotationStoreIds to set. This map and the other 3 maps should have the corresponding set of data for a request all at the same key value.
      • getQuotationStoreIds

        public java.util.Hashtable getQuotationStoreIds()
        Gets the quotationStoreIds map. This parameter is a map where the key is an Integer and the entry at any key is a quotation store id.
        Returns:
        The quotationStoreIds map.
      • getQuotationContractIds

        public java.util.Hashtable getQuotationContractIds()
        Gets the quotationContractIds map. This parameter is a map where the key is an Integer and the entry at any key is a quotation contract id. The key is used to map the appropriate quotation contract id to its matching quotation store id.
        Returns:
        The quotationContractIds map.
      • setQuotationContractIds

        public void setQuotationContractIds(java.util.Hashtable quotationContractIds)
        (Optional) Sets the quotationContractIds. This parameter is a map where the key is an Integer and the entry at any key is a quotation contract id. The key is used to map the appropriate quotation contract id to its matching quotation store id. The keys should not include the integer 0.
        Parameters:
        quotationContractIds - The map of quotationContractIds to set. This map and the other 3 maps should have the corresponding set of data for a request all at the same key value.
      • getQuotationUserIds

        public java.util.Hashtable getQuotationUserIds()
        Gets the quotationUserIds map. This parameter is a map where the key is an Integer and the entry at any key is a quotation userid. The key is used to map the appropriate quotation userid to its matching quotation store id.
        Returns:
        The quotationUserIds map.
      • setQuotationUserIds

        public void setQuotationUserIds(java.util.Hashtable quotationUserIds)
        (Optional) Sets the quotationUserIds. This parameter is a map where the key is an Integer and the entry at any key is a quotation userid. The key is used to map the appropriate quotation userid to its matching quotation store id. The keys should not include the integer 0.
        Parameters:
        quotationUserIds - The map of quotationUserIds to set. This map and the other 3 maps should have the corresponding set of data for a request all at the same key value.
      • getQuotationPasswords

        public java.util.Hashtable getQuotationPasswords()
        Gets the quotationPasswords map. This parameter is a map where the key is an Integer and the entry at any key is a quotation password. The key is used to map the appropriate quotation password to its matching user id.
        Returns:
        The quotationPasswords map.
      • setQuotationPasswords

        public void setQuotationPasswords(java.util.Hashtable quotationPasswords)
        (Optional) Sets the quotationPasswords. This parameter is a map where the key is an Integer and the entry at any key is a quotation password. The key is used to map the appropriate quotation password to its matching store id. The keys should not include the integer 0.
        Parameters:
        quotationPasswords - The map of quotationPasswords to set. This map and the other 3 maps should have the corresponding set of data for a request all at the same key value.
      • getOutOrderQuotationRelIdName

        public java.lang.String[] getOutOrderQuotationRelIdName()
        Gets the outOrderQuotationRelIdName.
        Returns:
        The array of outOrderQuotationRelIdName.
      • setOutOrderQuotationRelIdName

        public void setOutOrderQuotationRelIdName(java.lang.String[] outOrderQuotationRelIdName)
        (Optional) Sets the outOrderQuotationRelIdName.
        Parameters:
        outOrderQuotationRelIdName - The array of outOrderQuotationRelIdName to set
      • getDeleteOrderQuotationRelIds

        public java.lang.String[] getDeleteOrderQuotationRelIds()
        Gets the order quotation relation ids to be deleted.
        Returns:
        The array of order quotation relation ids.
      • setDeleteOrderQuotationRelIds

        public void setDeleteOrderQuotationRelIds(java.lang.String[] deleteOrderQuotationRelIds)
        (Optional) Sets the order quotation relation ids to be deleted along with their child Orders: if their type is either "initial" or "final". And if their parent Orders are one of the shopping carts specified by the orderId parameter.
        Parameters:
        deleteOrderQuotationRelIds - The order quotation relation ids to be deleted.