com.ibm.commerce.orderitems.commands

Interface OrderItemAddCmd

  • All Superinterfaces:
    AccCommand, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, ControllerCommand, ECCommand, Protectable, java.io.Serializable, com.ibm.websphere.command.TargetableCommand
    All Known Subinterfaces:
    AddOrderItemWithPromotionCodeOrCouponCmd
    All Known Implementing Classes:
    AddOrderItemWithPromotionCodeOrCouponCmdImpl, AdminOrderItemUpdateCOCmdImpl, AdminQuoteItemUpdateCmdImpl, DOMOrderItemAddCmdImpl, DOMOrderItemBaseCmdImpl, DOMOrderItemUpdateCmdImpl, ExternalOrderItemAddCmdImpl, ExternalOrderItemBaseCmdImpl, ExternalOrderItemUpdateCmdImpl, OrderItemAddCmdImpl, OrderItemBaseCmdImpl, OrderItemUpdateCmdImpl, QuoteItemAddCmdImpl, com.ibm.commerce.quote.commands.QuoteItemBaseCmdImpl, QuoteItemUpdateCmdImpl, RequisitionListItemUpdateCmdImpl, RequisitionListItemUpdateWithDynamicKitCmdImpl


    public interface OrderItemAddCmd
    extends ControllerCommand
    Adds items to one or a list of orders.

    This command accepts enumeration type of parameters. That is, it accepts parameterName_i=parameterValue.

    For example, to add three order items with the catalog entries id 15, 16, and 17, you can pass catEntryId_1=15&catEntryId_2=16&catEntryId_3=17 to the command. If you call the individual set method setCatEntryId(Hashtable) to pass the above parameters. You need to create a hashtable and add the following to the hashtable:

          hashtable.put(new Integer(1), new String("15")); 
          hashtable.put(new Integer(2), new String("16")); 
          hashtable.put(new Integer(3), new String("17"));
     
    Behavior
    • The command calls ResolveOrdersCmd with the input parameter orderId to get a list orders. If the orderId is not specified, the default is "." (the current pending orders).
    • The command can handle multiple items at one transaction. The multiple items are specified using the enumeration group i. For example, if you want to update multiple order items, you can specify orderItemId_i as parameters and i can be 1, 2, 3, ...
      1. The enumeration group i must be an integer. They don't have to be consecutive integers. The command will handle each enumeration group in numeric order.
      2. A parameter in enumeration group i = 0 has special meaning. That is, if a parameter with enumeration group 0, this parameter applies to all other enumeration groups. For example, if you want to update all order items with the same shipping address with id=1001. You can specify addressId_0=1001 instead of specifying addressId_1=1001&addressId_2=1001&addressId_3=1001...
      3. If a parameter does not have enumeration group, it means that it is in enumeration group 0. The above special meaning also applies. So instead of specifying addressId_0=1001, you can just specify addressId=1001.
      4. The parameters orderItemId, caEntryId and partNumber, expandConfigurationId are the keys for each enumeration group. It does not make sense to have one orderItemId to apply to all enumeration group. So you should not use enumeration group 0 for these parameters. If you use the enumeration group 0 or don't specify the enumeration group for these parameters, the command will only handle one item. All parameters in other enumeration groups are ignored.
    • The command does the following for each enumeration group i of parameters:
      1. Only one of the following parameters should be specified: orderItemId_i, expandConfigurationId_i, partNumber_i, catEntryId_i. If more than one of above parameters are specified, only one will take effect and the others are ignored. The order of precedence is: orderItemId_i, expandConfigurationId_i, partNumber_i, catEntryId_i, that is, if the orderItemId_i is specified, the others are ignored.
      2. If the parameter orderItemId_i is specified, the command tries to update the order item.
      3. If the parameter partNumber_i or parameter catEntryId_i is specified, the command tries to create a new order item and insert into all resolved orders. If the list of resolved orders is empty, a new pending order will be created.
      4. If the parameter partNumber_i is specified,the command uses the partNumber_i with the optional parameter memberId_i to find the catalog entry. If the memberId_i is not specified, we use the store path to search the catalog entry with the specified part number..
      5. If the parameter expandConfigurationId_i is specified, the command tries to create multiple new order items and insert them into one order. That is, the list of resolved orders should be maximal to one. If the list of resolved order contains more than one orders, the created order items will be inserted into only one order. It does the following:
        • Find all rows in the OICOMPLIST table based on the CONIFGURATIONID = expandConfigurationId_i and ORDERITEMS_ID is null.
        • For each row found above, use the field CATENTRY_ID to create a new order item.
        • The quantity in the order item is the quantity_i specified on the URL multiplied by the field CATALOGQUANTITY.
        • If the field UNITPRICE and the field CURRENCY are both not null, they will be copied to the order item. And the manual price bit in the prepareflags of the order item will be set.
        • The field ORDERITEMS_ID of the row will be set to orderitems_id of the newly created order item.
        • The configurationid of the order item will be set to the expandConfigurationId_i.
      6. When a new order is created, the member id of the new order is set to the current user in the command context. And the currency is also taken from the one in the command context.
      7. When creating a new order item, the parameter quantity_i is required and must be a positive number. The member id and currency of the order item are set to be the same as the member id and currency of the order. The storeId is also required.
      8. If the same enumeration group i is specified more than once, only one is effective, the others are ignored.
      9. To add a new order item with catEntryId, the following things are checked:
        • It calls the ResolveSkuCmd task command to resolve the SKU.
        • It checks if the catalog entry is buyable in this store.
        • It checks if the shopper is entitled to buy this catalog entry.
        • If any above checking failed, an exception will be thrown. But if the parameter continue is specified with value 1, the error will be ignored. This order item will not be added and the command will continue to process the next order item.
    • Either updating the existing order item when the orderItemId_i is specified or create a new order item when the partNumber_i or catEntryId_i is specified. The command uses the rest of parameters to update the order item.
      1. If the parameter addressId_i is not specified, for registered user, the default will be the addressId in the ADDRESS table. That is, the STATUS column has a value of P and the value in the NICKNAME column is the user's login id. The login id is obtained from the LOGONID column in the USERREG table). If the address cannot be found in the ADDRESS table, the address_id will be NULL for the order item in the ORDERITEMS table.
      2. If the quantity_i is zero, the order item is removed from the orders.
      3. If the parameter shipModeId_i is not specified, the default is taken from the STOREDEF table.
      4. It calls the GetContractUnitPriceCmd task command to get the contract price of the product or item. It uses the specified trading agreements (contracts) or all eligible trading agreements (contracts) for which the member of the order is eligible. Except for order items which were generated or whose price was manually entered (overridden by the administrator). All input trading agreements (contracts) to be used will be checked to verify that if they apply compatible payment methods. The currency is always the same as the currency of the order.
    • For any orders in which one or more order items got updated or inserted, the orders are unlocked. And the lastUpdate fields are updated with the current time stamp.
    • After all enumeration group are processed, the command determines fulfillment centers and checks for available inventory for all order items modified or created. If ATP inventory is enabled, it calls AllocateInventoryCmd. Otherwise it calls ResolveFulfillmentCenterCmd which is the WCS 5.1 behavior.
    • Calls the ExtendOrderItemProcessCmd task command to perform additional processing to meet any unique requirements.
    View
    • RedirectView
      After the command finishes, it redirects to the URL that is specified.
    Exception conditions
    • Different exception tasks are called depending on the error.
    • If any parameter value is invalid, the command throws an ECApplicationException with message: _ERR_INVALID_INPUT and error view: InvalidInputErrorView.
    • If the partNumber is specified and it cannot be found in the catalog, the command throws an ECApplicationException with message: _ERR_PROD_NOT_EXISTING and error view: badPartNumberErrorView.
    • ECApplicationException will be thrown too if the following errors are encountered:
      1. Input trading agreements (contracts) are not valid or eligible to use.
      2. Trading agreements (contracts) being used in the order applies incompatible payment methods.
      3. Price Lists cannot be retrieved
    • If ATP is not enabled, the task command ResolveFulfillmentCenterCmd may throw ECApplicationException with message: _API_BAD_INV and error view: ResolveFulfillmentCenterErrorView.
    • Field Detail

      • COPYRIGHT

        static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
      • NAME

        static final java.lang.String NAME
        The name of the Command Interface class.
        See Also:
        Constant Field Values
      • defaultCommandClassName

        static final java.lang.String defaultCommandClassName
        The default implementation class.
        See Also:
        Constant Field Values
      • badPartNumberList

        static final java.lang.String badPartNumberList
        The parameter badPartNumberList. If there are bad part numbers in the request, the following parameters will be in the response: badPartNumberList, goodPartNumberList, badPartNumberQuantityList, goodPartNumberQuantityList, badPartNumberErrorView.
        See Also:
        Constant Field Values
      • goodPartNumberList

        static final java.lang.String goodPartNumberList
        The parameter goodPartNumberList.
        See Also:
        Constant Field Values
      • badPartNumberQuantityList

        static final java.lang.String badPartNumberQuantityList
        The parameter badPartNumberQuantityList.
        See Also:
        Constant Field Values
      • goodPartNumberQuantityList

        static final java.lang.String goodPartNumberQuantityList
        The parameter goodPartNumberQuantityList.
        See Also:
        Constant Field Values
      • multiplePartNumberList

        static final java.lang.String multiplePartNumberList
        The parameter multiplePartNumberList. If there is a part number which can be resolved to multiple catalog entries, the following parameters will be in the response: multiplePartNumberList, multiplePartNumberQuantityList and multiplePartNumberCatalogEntriesList.
        See Also:
        Constant Field Values
      • multiplePartNumberQuantityList

        static final java.lang.String multiplePartNumberQuantityList
        The parameter multiplePartNumberQuantityList.
        See Also:
        Constant Field Values
      • multiplePartNumberCatalogEntriesList

        static final java.lang.String multiplePartNumberCatalogEntriesList
        The parameter multiplePartNumberCatalogEntriesList.
        See Also:
        Constant Field Values
      • badPartNumberErrorView

        static final java.lang.String badPartNumberErrorView
        The parameter badPartNumberErrorView.
        See Also:
        Constant Field Values
    • Method Detail

      • getOrderIds

        java.lang.String[] getOrderIds()
        Return a list of order ids which are touched or created by the command. These order ids are also appended to redirection url.
        Returns:
        an array of order IDs
      • getOrderItemIds

        java.lang.String[] getOrderItemIds()
        Return a list of order item ids which are created or updated by the command. These order item ids are also appended to redirection url.
        Returns:
        an array of order item IDs
      • getNonBuyableCatentryIds

        java.util.Vector getNonBuyableCatentryIds()
        Returns a vector contains the identifiers of CatalogEntries that are non buyable in OrderItem.
        Returns:
        the catentry_ids of non-buyable catentry.
      • setAddressId

        void setAddressId(java.util.Hashtable ahshAddress_id)
        Set the address id parameters (optional).
        Parameters:
        ahshAddress_id - Contains a list of address ids. The key is the enumeration group (Integer) and the value is the address id (String). For example, if you have input parameters: addressId_1=123&addressId=234, the hashtable can be constructed by:
            ahshAddress_id.put(new Integer(1), new String("123"));
            ahshAddress_id.put(new Integer(2), new String("234"));
         
      • setAttrName

        void setAttrName(java.util.Hashtable ahshAttr_name)
        Set the attribute name parameters (optional). The attribute name, together with the attribute value are used to determine a SKU.
        Parameters:
        ahshAttr_name - Contains a list of attribute names. The key is the enumeration group (Integer) and the value is the attribute name (String[]). For example, if you have input parameters: attrName_1=123&attrName_1=234&attrName_2=123, the hashtable can be constructed by:
            ahshAttr_name.put(new Integer(1), new String[] {"123", "234"});
            ahshAttr_name.put(new Integer(2), new String[] {"123"});
         
      • setAttrValue

        void setAttrValue(java.util.Hashtable ahshAttr_value)
        Set the attribute value parameters (optional). The attribute name, together with the attribute value are used to determine a SKU.
        Parameters:
        ahshAttr_value - a list of attribute values.
      • setCatEntryId

        void setCatEntryId(java.util.Hashtable ahshCatentry_id)
        Set the attribute name parameters. This parameter is mandatory if the partNumber parameter is not set. This parameter is ignored when the partNumber parameter is set.
        Parameters:
        ahshCatentry_id - a list of catalog entry ids.
      • setComment

        void setComment(java.util.Hashtable ahshComment)
        Set the comment parameters (optional).
        Parameters:
        ahshComment - a list of comments
      • setConfigurationId

        void setConfigurationId(java.util.Hashtable ahshConfigurationId)
        Set the configurationId parameters (optional).
        Parameters:
        ahshConfigurationId - a list of configuration ids.
      • setContinue

        void setContinue(java.lang.String aContinue)
        Set the continue parameter (optional).
        Parameters:
        aContinue - a string can be either "0" or "1".
      • setContractId

        void setContractId(java.util.Hashtable ahshContract_id)
        Set the contract id parameters (optional). It is used to calculate the price.
        Parameters:
        ahshContract_id - a list of contract ids.
      • setCorrelationGroup

        void setCorrelationGroup(java.util.Hashtable ahshCorrelationGroup)
        Set the correlation group parameters. It is optional.
        Parameters:
        ahshCorrelationGroup - a list of correlation groups.
      • setDescription

        void setDescription(java.util.Hashtable ahshDescription)
        Set the description parameters (optional).
        Parameters:
        ahshDescription - a list of order item descriptions.
      • setExpandConfigurationId

        void setExpandConfigurationId(java.util.Hashtable ahshExpandConfigurationId)
        Set the expandConfigurationId parameter. This parameter is optional.
        Parameters:
        ahshExpandConfigurationId - a list of expand configuration ids.
      • setField1

        void setField1(java.util.Hashtable ahshField1)
        Set the field1 parameters (optional).
        Parameters:
        ahshField1 - a list of field1.
      • setField2

        void setField2(java.util.Hashtable ahshField2)
        Set the field2 parameters (optional).
        Parameters:
        ahshField2 - a list of field2.
      • setListId

        void setListId(java.lang.String[] aList_id)
        Set the interest item list id parameters (optional).
        Parameters:
        aList_id - an array of interest item list ids.
      • setMemberId

        void setMemberId(java.util.Hashtable ahshMember_id)
        Set the member id parameters (optional). It is the catalog owner's member id. It is necessary when the partNumber parameter is set. Together with the partNumber, the catalog entry id can uniquely be determined.
        Parameters:
        ahshMember_id - a list of member ids.
      • setOfferId

        void setOfferId(java.util.Hashtable ahshOffer_id)
        Set the offer id parameters (optional). It is used to calculate the price.
        Parameters:
        ahshOffer_id - a list of offer ids.
      • setOrderComment

        void setOrderComment(java.lang.String aOrderComment)
        Set the Order comment parameter (optional).
        Parameters:
        aOrderComment - order comment.
      • setOrderDesc

        void setOrderDesc(java.lang.String aOrder_desc)
        Set the Order description parameter (optional).
        Parameters:
        aOrder_desc - order description.
      • setOrderId

        void setOrderId(java.lang.String[] aOrder_id)
        Set the order id parameters (optional). If it is not set, the current pending order id will be used. If there is no current pending order, a new order will be created.
        Parameters:
        aOrder_id - an array of order ids.
      • setOutOrderItemName

        void setOutOrderItemName(java.lang.String[] aOut_orderitem_name)
        Set the out order item name parameters (optional). If it is not set, the default name is "orderItemId".
        Parameters:
        aOut_orderitem_name - an array of out order item names.
      • setOutOrderName

        void setOutOrderName(java.lang.String[] aarrOutOrderName)
        Set the out order name parameters (optional). If it is not set, the default name is "orderId".
        Parameters:
        aarrOutOrderName - an array of out order names.
      • setPartNumber

        void setPartNumber(java.util.Hashtable ahshPart_number)
        Set the part number parameters (optional).
        Parameters:
        ahshPart_number - a list of part numbers.
      • setQuantity

        void setQuantity(java.util.Hashtable ahshQuantity)
        Set the quantity parameters (mandatory).
        Parameters:
        ahshQuantity - a list of quantities.
      • setShipmodeId

        void setShipmodeId(java.util.Hashtable ahshShipmode_id)
        Set the ship mode id parameters (optional).
        Parameters:
        ahshShipmode_id - a list of shipping mode ids.
      • setFulfillmentCenterId

        void setFulfillmentCenterId(java.util.Hashtable ahshFulfillmentCenter_id)
        Set the Fulfillment Center id parameters (optional).
        Parameters:
        ahshFulfillmentCenter_id - a list of fulfillment center ids.
      • setTradingId

        void setTradingId(java.util.Hashtable ahshTrading_id)
        Set the trading id parameters (optional). It is used to calculate the price.
        Parameters:
        ahshTrading_id - a list of trading ids.
      • setUom

        void setUom(java.util.Hashtable ahshUom)
        Set the unit of measure parameters (optional).
        Parameters:
        ahshUom - a list of UOMs.