com.ibm.commerce.order.commands

Class CalculateOrderCmdImpl

  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, CalculateOrderCmd, 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 CalculateOrderCmdImpl
    extends TaskCommandImpl
    implements CalculateOrderCmd
    This is implementation of the CalculateOrderCmd task command.

    Behavior:

    For each Order specified:
    • if doFreeGift is true, free gift handling logic is called.
      • keep the CatalogEntries which are auto added freegiftbefore to iarrAutoAddedOrderItems.
      • if the PromotionsEngine component is enabled and freegift is to be refreshed. Call the PromotionEngine to obtain a list of CatalogEntries to add to the Order
      • for each CatalogEntry to be added to the Order, if ATP is disabled and there is insufficient inventory:
        • remove the CatalogEntry from the list
        • add the CatalogEntry identifier to the outOfInventoryCatalogEntryId list
      • get the list of order items which to be added or updated. If the new CatalogEntries returned from PromotionEngine having same CatetnryId and Quantity, do nothing. If with same CatentryId but different Quantity, add it to updating list. If the CatentryId of this new CatalogEntry is not contained in the existed ones, add it to adding list. If the free gifts which are cached before are not contained in the new returned list, add it to deleting list.
      • call removeFreeGifts method to remove the freegifts listed in the deleting list
      • call updateFreeGiftsQuantities method to update the quantities of freegifts listed in the updating list
        • call resolveATPParameter method to resolve the ATP parameter. In this method, it gets the ATP parameters from requestProperties of CommandContext, the ATP parameters for the freegift include: CHECK, ALLOCATE and BACKORDER.
        • call OrderItemUpdateCmd to update the quantity of the freegift
      • call addFreeGifts method to add the new freegifts listed in the adding list
        • call resolveATPParameter method to resolve the ATP parameter.In this method, it gets the ATP parameters from requestProperties of CommandContext, the ATP parameters for the freegift include: CHECK, ALLOCATE and BACKORDER.
        • call OrderItemAddCmd to add new the freegift
    • compute the product total of order
    • initialize the specified CalculationUsages that are enabled
    • apply the specified CalculationUsages that are enabled
    • update the SubOrders for the Order unless that feature is disabled
    • summarize the specified CalculationUsages that are enabled

    AccessBeans utilized:

    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

      • CalculateOrderCmdImpl

        public CalculateOrderCmdImpl()
        The 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
      • performExecute

        public void performExecute()
                            throws ECException
        Executes the main business logic of the command implementation. It implements the logic of free gift handling and calculating logic.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECException
        See Also:
        ECCommand#performExecute()
      • getCustomProperties

        public java.util.HashMap getCustomProperties()
        This method returns the customer properties.
        Specified by:
        getCustomProperties in interface CalculateOrderCmd
        Returns:
        HashMap the customer properties
      • setUsageIds

        public void setUsageIds(java.lang.Integer[] anUsageIds)
        This method sets the calculation usages will be used
        Specified by:
        setUsageIds in interface CalculateOrderCmd
        Parameters:
        anUsageIds - array of calculation usage
      • setDoFreeGift

        public void setDoFreeGift(boolean doFreegift)
        This method sets the flag whether free gift handling logic will be called.
        Specified by:
        setDoFreeGift in interface CalculateOrderCmd
        Parameters:
        doFreegift - flag of whether to do free gift handling
      • setCustomProperties

        public void setCustomProperties(java.util.HashMap newhshCustomProperties)
        This method sets the customer properties.
        Specified by:
        setCustomProperties in interface CalculateOrderCmd
        Parameters:
        newhshCustomProperties - the customer properties