com.ibm.commerce.order.commands

Class OrderCopyCmdImpl

  • All Implemented Interfaces:
    AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, OrderCopyCmd, OrderConstants, 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 OrderCopyCmdImpl
    extends OrderBaseCmdImpl
    implements OrderConstants, OrderCopyCmd
    This is the default implementation of the OrderCopy controller command.

    Input parameters:

    Name Description
    langId Sets or resets the preferred language for the duration of the session; the supported languages for a store are found in the STORELANG table.
    forUser The logon ID of the user on whose behalf the command will be run. Only a person with the authority to process orders can specify this parameter.
    forUserId Same as forUser, but identifying the user by the internal user ID, as found in the USERS table.
    storeId Sets the store ID of the destination order. It is also used to resolve special abbreviations (".", "*", ".t", ".**.", and "*t") when they appear in fromOrderId_i, toOrderId, orderInfoFrom, and payInfoFrom. For example, the following command refers to all pending orders of member 1001 in store 1: fromOrderId_1=*&memberId_1=1001&storeId=1.
    URL Mandatory, the redirection URL that is called when the command successfully completes.
    isPONumberCopied Controls whether the PO number of source order will be copied to the destination order.
    field1 Sets the field1 value of the destination order, respectively. If not specified, the corresponding field value of the "orderInfoFrom" order will be used, if there is one.
    field2 Sets the field2 value of the destination order, respectively. If not specified, the corresponding field value of the "orderInfoFrom" order will be used, if there is one.
    field3 Sets the field3 value of the destination order, respectively. If not specified, the corresponding field value of the "orderInfoFrom" order will be used, if there is one.
    billingAddressId Sets the billing address ID of the destination order. If not specified, the billing address ID of the "orderInfoFrom" order will be used, if there is one.
    displaySeq Sets the display sequence of the destination order. If not specified, the display sequence "orderInforFrom" order will be used, if there is one.
    orderInfoFrom Specifies the reference number of an order from which to copy order level information: values for the DESCRIPTION, ADDRESS_ID, SEQUENCE, FIELD1, FIELD2, and FIELD3 columns in the ORDERS table. This parameter can be repeated. If more than one order is specified, it is as if only the most recently updated of those orders were specified.
    If "**" is specified, order level information is not copied from any order.
    If this parameter is not specified, and there is only one source order specified by the fromOrderId_i parameters, then it is as if order was specified. Otherwise, it defaults to "**". Abbreviations are resolved using the current customer and the store specified by the storeId parameter.
    payInfoFrom Specifies the reference number of an order from which to copy payment information obtained by calling the GetOrderPaymentInfoCmd task command. If more than one order is specified, it is as if only the most recently updated of those orders were specified. This parameter can be repeated.
    If "**" is specified, order level information is not copied from any order.
    If this parameter is not specified, and there is only one source order specified by the fromOrderId_i parameters, then it is as if order was specified. Otherwise, it defaults to "**". Abbreviations are resolved using the current customer and the store specified by the storeId parameter.
    description Sets the description of the destination order. If not specified, the description of the "orderInforFrom" order will be used, if there is one.
    orderComment Sets the order comment if specified.
    outOrderItemName Specifies the names of name-value pairs to be added to the redirection URL. The value of each added name-value pair is the reference number of a destination order item. The default value is "orderItemId". This parameter can be repeated.
    outOrderName Specifies the names of name-value pairs to be added to the redirection URL. The value of each added name-value pair is the reference number of a destination order. The default value is "orderId". This parameter can be repeated.
    status Specifies the status of the destination order. Only I (submitted) and P (pending) are valid values. The default is P. If I is specified, then after the destination order is updated. It is prepared for display and locked, as if OrderPrepare had been called, and then the status is set to I. This prepares the order to be accepted by OrderProcess, and prevents it from being further modified by the customer.
    prepare Controls whether the destination order will be prepared by OrderPrepare command or not.
    toOrderId Specifies the order to be created or modified. It can be specified as an order reference number or as one of the special abbreviations ".", "*", ".t", "*t", "**" and ".**.". If it is not specified, it defaults to "**", which creates a new order. If more than one order is specified, it is as if only the most recently updated one was specified. Abbreviations are resolved using the current customer (the customer running this command) and the store specified in the storeId parameter.
    tcId Specifies the term and condition Id of the destination order.
    continue Controls whether the order copy continues when one or more of the order items cannot be copied. A value of 0 terminates and rolls back execution if an order item cannot be created or updated in the target order. A value of 1 ignores the create or update operation for that order item and continues execution. The default value is 0.
    ShipAsComplete Specifies the ShipAsComplete flag of the destination order.
    sensitiveInfoCopy Controls whether the sensitive information to be copied from the source order to the destination order.
    blockInfoCopy Controls whether the block information of the source order to be copied to destination order.
    requestedShipDate Specifies the request ship date of the destination order.
    copyAutoAddedOrderItems Controls whether the auto added order items to be copied from source order to destination order.
    shippingAddressFromOrderProfile The shippingAddressFromOrderProfile flag controls whether the default shipping address of the order profile will be used. If the value of the parameter 'shippingAddressFromOrderProfile' is set to '1', and if the toOrder is not null. It will try to copy the default shipping address of the order profile to all the order items of the order specified in the 'toOrderId'.
    shippingModeFromOrderProfile The shippingModeFromOrderProfile flag controls whether the default shipping mode of the order profile will be used. If the value of the parameter 'shippingModeFromOrderProfile' is set to '1', and if the toOrder is not null. It will try to copy the default shipping mode of the order profile to all the order items of the order specified in the 'toOrderId'.
    merge A list of OrderItems that should be merged with other OrderItems in the same order if possible, regardless of their correlationGroup attributes. This parameter can be repeated.
    remerge A list of the OrderItems that should be merged with other OrderItems in the same order and with the same correlationGroup attribute, if possible. This parameter can be repeated.
    check A list of OrderItems that should be checked by the CheckInventory task command. This parameter can be repeated.
    allocate A list of OrderItems that should be allocated from existing inventory. This parameter can be repeated.
    backorder A list of OrderItems that should be allocated from expected inventory. This parameter can be repeated.
    reverse A list of OrderItems whose allocations should be released (that is, de-allocated from existing or expected inventory as appropriate). This parameter can be repeated.
    pay_paymentname Sets the payment name value pairs of the destination order. This parameter can be repeated. For example the following command refers to the payment name-value pair "creditCardNumber==2222222222": pay_creditCardNumber=2222222222 These payment name-value pairs will be added to the ORDPAYINFO table through the SetOrderPaymentInfoCmd task command. If not specified, the payment name-value pairs of the payInfoFrom order will be used, if there is one.
    addressId_i The reference number of the address to which the order items in the enumeration group specified by i are to be shipped. The address must belong to the customer executing this command.
    catEntryId_i Sets the catalog entry ID of the order items in enumeration group i.
    comment_i A comment included with the item to be passed to the OrderItemUpdate command when order items are added to or updated in the destination.
    contractId_i The contract reference number associated with the order. It will be passed to the OrderItemUpdate command when order items are added to or updated in the destination.
    description_i Sets the description of the order items in enumeration group i.
    copyOrderItemId_i Specifies which order items should be copied from the source orders specified by fromOrderId_i and added to the destination order specified by toOrderId. This parameter can be repeated.
    If it is not specified, or "*" is specified, the parameter refers to all order items that belong to the orders specified by fromOrderId_i.
    If "." is specified the parameter refers to the most recently updated order item that belongs to the orders specified by fromOrderId_i.
    If "**" is specified the parameter refers to a single new order item that will be added to the destination order. It uses information only from other parameters in the enumeration group specified by i, but not from the source orders for that enumeration group. In this case, catEntryId_i or partNumber_i must be specified. The OrderCopy command calls the OrderItemUpdate command to add new order items to the destination order.
    field1_i Specifies an integer value to be passed to the OrderItemUpdate command. When order items are added to or updated in the destination order, for the enumeration group specified by i.
    field2_i Specifies a character string to be passed to the OrderItemUpdate command. When order items are added to or updated in the destination order, for the enumeration group specified by i.
    fromOrderId_i Specifies zero or more source orders from which order items will be copied when enumeration group i is processed. The special abbreviations "." , "*", " .t" , "*t" and "q" are resolved using memberId_i and storeId. This parameter can be repeated.
    memberId_i The reference number of a member, used to resolve special abbreviations (".", "*", ".t", ".**.", and "*t") when they appear in fromOrderId_i. For example, the following command refers to all pending orders of member 1001: fromOrderId_1=*&memberId_1=1001 The default value is the member ID of the current user. If the current customer attempts to access the orders of other customers but is not authorized to do so, an exception is thrown.
    offerId_i A list of offer IDs to be chosen from when creating a new order item. This list will be passed to the OrderItemUpdate command. There is no default value.
    partNumber_i The part number to be resolved to a catalog entry ID. It overrides catEntryId_i.
    partOwnerId_i The member ID of the part owner, used with partNumber_i; defaults to the owner of the store.
    quantity_i Sets the quantity of the order items in enumeration group i.
    shipModeId_i Specifies a shipping mode reference number, to be passed to the OrderItemUpdate command. When order items are added to or updated in the destination order, for the enumeration group specified by i. This reference number is associated with a particular shipping service.
    UOM_i The unit of measure for the quantity_i.
    updateOrderItemId_i Specifies order items in the destination order to be updated. It is updated using information from other parameters in the enumeration group specified by i. But not from the source orders for that enumeration group and not from catEntryId_i and partNumber_i. Note that the catalog entry ID of an order item cannot be updated. The OrderCopy command calls the OrderItemUpdate command to update order items in the destination order. This parameter can be repeated.
    If "*" is specified, it means all order items in the destination order.
    If "." is specified, it means the most recently updated order item.
    currency_i Sets the currency of the order items in enumeration group i.
    price_i Sets the price of the order items in enumeration group i.
    configurationId_i If the OrderItem represents a configured Dynamic Kit, this is the configuration ID. This parameter can be repeated.
    correlationGroup_i The group to which this OrderItem is related. Normally, the correlationGroup is the same as the OrderItemID. OrderItems with the same correlationGroup attribute value represent the same object the customer wants to buy. A value for correlationGroup can be specified and propagated. When either OrderItems are split when inventory is allocated. Such as when two fulfillment centers must be used to fill an order for the same item if one fulfillment center has insufficient supply. Or when a price quotation is received for an OrderItem. When an OrderItem is split at inventory allocation, the newly created OrderItem inherits the correlationGroup value from the original OrderItem. In a quotation situation, the OrderItem inherits the correlationGroup value from the corresponding OrderItem in the parent order.
    attr_i_attrname Specifies an attribute name and value to be passed to the OrderItemUpdate command. When adding order items for the enumeration group specified by i to the destination order. For example, the following command refers to part ABC123 with attribute "length"=="10":partNumber_1=ABC123&attr_1_length=10
    inventoryValidation Specifies whether inventory status should be validated for adding to cart. Default is "false" which means order items can be added to cart regardless of inventory status.

    Output parameters:

    Name Description
    the value of the outOrderId the order Ids of the output orders.
    the value of the outOrderItemId the orderItem Ids of the output orderItems.

    Behaviour:

    • Call the copyOrderInfo() method to copy the order level information.
    • Call the copyOrderItemsInfo() method to copy order item level information.
    • Call the prepareOrder() method which may call the PrepareOrderCmd task command if istrPrepare is "Y".
    • Call the copyQuotationRelatedInfo method to copy quotation related information when the prepareFlags attribute of the copied OrderItems indicates "quotation".
    • Set the viewTaskName response property to "RedirectView".
    • Call the extOrderCopy() method which will call the ExtOrderCopyCmd task command.

    Task commands called:

    AccessBeans used:

    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM Copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • OrderCopyCmdImpl

        public OrderCopyCmdImpl()
        default constructor
    • Method Detail

      • reset

        public void reset()
        Resets instance variables to their initial values.
        Specified by:
        reset in interface com.ibm.websphere.command.Command
        Overrides:
        reset in class AbstractECTargetableCommand
      • setBillingAddressId

        public void setBillingAddressId(java.lang.Long anBillingAddressId)
        Set the addressId of the billing address.
        Specified by:
        setBillingAddressId in interface OrderCopyCmd
        Parameters:
        anBillingAddressId - the addressId.
      • setCopyOrderInfoFrom

        public void setCopyOrderInfoFrom(java.lang.String[] astrCopyOrderInfoFrom)
        Set the source order from which the order info (for example billingAddress) will be copied.
        Specified by:
        setCopyOrderInfoFrom in interface OrderCopyCmd
        Parameters:
        astrCopyOrderInfoFrom - the source order.
      • setCopyPaymentInfoFrom

        public void setCopyPaymentInfoFrom(java.lang.String[] astrCopyPaymentInfoFrom)
        Set the source order from which the payment info will be copied.
        Specified by:
        setCopyPaymentInfoFrom in interface OrderCopyCmd
        Parameters:
        astrCopyPaymentInfoFrom - the source order.
      • setSensitiveInfoCopyFlag

        public void setSensitiveInfoCopyFlag(java.lang.String astrSensitiveInfoCopyFlag)
        Set the flag which decides whether to copy sensitive (payment and so forth) info or not
        Specified by:
        setSensitiveInfoCopyFlag in interface OrderCopyCmd
        Parameters:
        astrSensitiveInfoCopyFlag - info copy flag
      • setBlockInfoCopyFlag

        public void setBlockInfoCopyFlag(java.lang.String astrBlockInfoCopyFlag)
        Set the flag indicating whether to copy block information
        Specified by:
        setBlockInfoCopyFlag in interface OrderCopyCmd
        Parameters:
        astrBlockInfoCopyFlag -
      • setDescription

        public void setDescription(java.lang.String astrDescription)
        Set the description of the target order.
        Specified by:
        setDescription in interface OrderCopyCmd
        Parameters:
        astrDescription - the description.
      • setDisplaySequence

        public void setDisplaySequence(java.lang.Double adDisplaySequence)
        Set the display sequence of the target order.
        Specified by:
        setDisplaySequence in interface OrderCopyCmd
        Parameters:
        adDisplaySequence - the display sequence.
      • setField1

        public void setField1(java.lang.Integer anField1)
        Set field1 of the target order.
        Specified by:
        setField1 in interface OrderCopyCmd
        Parameters:
        anField1 - the value of field1.
      • setField2

        public void setField2(java.math.BigDecimal adField2)
        Set field2 of the target order.
        Specified by:
        setField2 in interface OrderCopyCmd
        Parameters:
        adField2 - the value of field2.
      • setField3

        public void setField3(java.lang.String astrField3)
        Set field3 of the target order.
        Specified by:
        setField3 in interface OrderCopyCmd
        Parameters:
        astrField3 - the value of field3.
      • setGroups

        public void setGroups(OrderCopyCmd.Group[] aGroups)
        Set the enumeration groups.
        An enumeration group consists of parameters that will be passed (as input parameters) to OrderItemUpdateCmd.
        Specified by:
        setGroups in interface OrderCopyCmd
        Parameters:
        aGroups - the enumeration groups.
      • setOutOrderItemNames

        public void setOutOrderItemNames(java.lang.String[] astrOutOrderItemNames)
        Sets the names of the orderItemId properties to be appended to the redirection URL. Each name causes properties to be appended to the redirection URL with the specified name. And with values of the OrderItemIds that were created or updated.
        Specified by:
        setOutOrderItemNames in interface OrderCopyCmd
        Parameters:
        astrOutOrderItemNames - the names of the orderItemId properties.
      • setOutOrderNames

        public void setOutOrderNames(java.lang.String[] astrOutOrderNames)
        Sets the names of the orderId properties to be appended to the redirection URL. Each name causes properties to be appended to the redirection URL with the specified name. And with values of the OrderId that was created or updated.
        Specified by:
        setOutOrderNames in interface OrderCopyCmd
        Parameters:
        astrOutOrderNames - the names of the orderId properties.
      • setPayment

        public void setPayment(java.util.Hashtable ahshPayment)
        Set the payment information of the target order.
        Specified by:
        setPayment in interface OrderCopyCmd
        Parameters:
        ahshPayment - the payment information.
      • Key: payment information name (String).
      • Value: payment information values (String[] ) .
      • setStatus

        public void setStatus(java.lang.String astrStatus)
        Set the status of the target order.
        Specified by:
        setStatus in interface OrderCopyCmd
        Parameters:
        astrStatus - the status ("P" or "I").
      • setPrepare

        public void setPrepare(java.lang.String astrPrepare)
        Set if the order should be Prepared .
        Parameters:
        astrPrepare - as ("Y") or ("N").
      • setShippingAddressFromOrderProfile

        public void setShippingAddressFromOrderProfile(java.lang.String anShippingAddressFromOrderProfile)
        Set the shippingAddressFromOrderProfile flag
        Parameters:
        anShippingAddressFromOrderProfile - the shippingAddressFromOrderProfile flag.
      • setTcId

        public void setTcId(java.lang.Long anTcId)
        Set the PaymentTC that the billing address will be checked against.
        Specified by:
        setTcId in interface OrderCopyCmd
        Parameters:
        anTcId - the tcId of the PaymentTC
      • setToOrderAbbreviations

        public void setToOrderAbbreviations(java.lang.String[] astrToOrderAbbreviations)
        Set the target order.
        Specified by:
        setToOrderAbbreviations in interface OrderCopyCmd
        Parameters:
        astrToOrderAbbreviations - the target order.
      • validateParameters

        public void validateParameters()
                                throws ECException
        Validates the input parameters.
        • Checks that addressId is owned by the current user.
        • Checks that status is be either P or I.
        • Calls the ResolveOrdersCmd task command to resolve Order abbreviations.
        • Calls the ResolveOrderItemsCmd task command to resolve OrderItem abbreviations.
        • Calls the CheckOrderCopyCmd task command for each of the Orders to be accessed.
        • Checks that the updateOrderItemId parameter does not specify an OrderItem abbreviation that requests a new OrderItem to be created.
        • Checks that the continue parameter specifies only 0 or 1.
        Specified by:
        validateParameters in interface ECCommand
        Overrides:
        validateParameters in class AbstractECTargetableCommand
        Throws:
        ECApplicationException - The _ERR_BAD_MISSING_CMD_PARAMETER message is passed, with the name of the invalid or missing property name.
        ECException -
        See Also:
        ECCommand#validateParameters()
      • setContinue

        public void setContinue(java.lang.String astrContinue)
        Description copied from interface: OrderCopyCmd
        Set the continue parameter (optional). If an OrderItem cannot be created or updated in the target Order,
        0 - terminate execution and rollback.
        1 - ignore the create or update operation for that OrderItem and continue execution.
        Specified by:
        setContinue in interface OrderCopyCmd
        Parameters:
        astrContinue - the continue parameter.
        See Also:
        OrderCopyCmd.setContinue(String)
      • getItemsToBeRemoved

        public java.util.Vector getItemsToBeRemoved()
        To Retrieve items to be removed after copy
        Specified by:
        getItemsToBeRemoved in interface OrderCopyCmd
        Returns:
        Vector
      • setOrderPromotionCodeCopyFlag

        public void setOrderPromotionCodeCopyFlag(java.lang.String astrOrderPromotionCodeCopyFlag)
        Set the order promotion code copy flag. The default value is "N" indicating the promotion codes need not be copied. If it is set as "Y", the order promotion codes need to be copied to the target order.
        Specified by:
        setOrderPromotionCodeCopyFlag in interface OrderCopyCmd
        Parameters:
        astrOrderPromotionCodeCopyFlag - the order promotion code copy flag.
      • setCopyOrderPromotionCodeFrom

        public void setCopyOrderPromotionCodeFrom(java.lang.String[] astrCopyOrderPromotionCodeFrom)
        Set the source order from which the order promotion codes are copied.
        Specified by:
        setCopyOrderPromotionCodeFrom in interface OrderCopyCmd
        Parameters:
        astrCopyOrderPromotionCodeFrom - the array of source orders.
      • setOrdPayInfoCopyFlag

        public void setOrdPayInfoCopyFlag(java.lang.String astrOrdPayInfoCopyFlag)
        Set the order payment info copy flag. The default value is "Y" indicating the order payment info need to be copied. If it is set as "N", the order payment info need not to be copied to the target order.
        Parameters:
        astrOrdPayInfoCopyFlag - the order payment info copy flag.