com.ibm.commerce.price.commands

Class PredefinedConfigurationComponentPricingCmdImpl

  • java.lang.Object
    • com.ibm.websphere.command.CacheableCommandImpl
      • com.ibm.commerce.command.MeasuredCacheableCommandImpl
        • com.ibm.commerce.command.AbstractECTargetableCommand
          • com.ibm.commerce.command.TaskCommandImpl
            • com.ibm.commerce.price.commands.PredefinedConfigurationComponentPricingCmdImpl
  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, com.ibm.commerce.command.ECCommand, com.ibm.commerce.command.ECTargetableCommand, com.ibm.commerce.command.TaskCommand, PredefinedConfigurationComponentPricingCmd, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command


    public class PredefinedConfigurationComponentPricingCmdImpl
    extends com.ibm.commerce.command.TaskCommandImpl
    implements PredefinedConfigurationComponentPricingCmd
    An implementation of PredefinedConfigurationComponentPricingCmd. This implementation assumes the following rule:

    replacementCost((x1,x2,...,xn),(y1,y2,...,yn)) = additionCost((y1,y2,...,yn)) - removalCost((x1,x2,...xn))

    . That is, that the cost of replacing any set of items with another set of items. It is the same as the cost of removing the replaced items and adding the replacement items.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.util.Set getAdditions(com.ibm.commerce.order.objects.OrderItemAccessBean oiab)
      Returns all items that were added to the predefined configuration set on the command in order to create the dynamic kit configuration represented by the OrderItemAccessBean passed.
      MonetaryAmount getPriceDifferenceAddingComponents(java.util.Set components, java.lang.String currency, java.lang.Long contractId)
      Returns the negated price change to the predefined configuration that is caused by removing the components in the passed Set of DynamicKitComponent objects.
      MonetaryAmount getPriceDifferenceRemovingComponents(java.util.Set components, java.lang.String currency, java.lang.Long contractId)
      Returns the negated price change to the predefined configuration that is caused by removing the components in the passed Set of DynamicKitComponent objects.
      MonetaryAmount getPriceDifferenceReplacingComponents(java.util.Hashtable replacements, java.lang.String currency, java.lang.Long contractId)
      Returns the price change to the predefined configuration that is caused by preforming the component replacements in the passed Hashtable of DynamicKitComponent objects.
      java.util.Set getRemovals(com.ibm.commerce.order.objects.OrderItemAccessBean oiab)
      Returns all items that were removed from the predefined configuration set on the command in order to create the dynamic kit configuration represented by the OrderItemAccessBean passed.
      java.util.Hashtable getReplacements(com.ibm.commerce.order.objects.OrderItemAccessBean oiab)
      Returns a hashtable of the items, that were replaced in the predefined configuration set on the command.
      void performExecute()
      Executes the command.
      void setDynamicKitCatalogEntryId(java.lang.Long dynamicKitCatalogEntryId)
      Sets the catalog entry ID of the dynamic kit.
      void setPredefinedConfigurationId(java.lang.Long predefinedConfigurationId)
      Sets the ID of the predefined configuration to use.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand

        accessControlCheck, checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getObjectSize, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
      • Methods inherited from interface com.ibm.commerce.command.CacheableECCommand

        execute
      • Methods inherited from interface com.ibm.commerce.command.ECCommand

        checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
    • Field Detail

      • COPYRIGHT

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

      • PredefinedConfigurationComponentPricingCmdImpl

        public PredefinedConfigurationComponentPricingCmdImpl()
    • Method Detail

      • getAdditions

        public java.util.Set getAdditions(com.ibm.commerce.order.objects.OrderItemAccessBean oiab)
                                   throws com.ibm.commerce.exception.ECException
        Returns all items that were added to the predefined configuration set on the command in order to create the dynamic kit configuration represented by the OrderItemAccessBean passed.
        Specified by:
        getAdditions in interface PredefinedConfigurationComponentPricingCmd
        Parameters:
        oiab - The OrderItemAccessBean that represents the dynamic kit configuration to price using the predefined configuration set on the command.
        Returns:
        A Set of DynamicKitComponent objects that were added to the predefined configuration to yield the configuration represented by the OrderItemAccessBean passed into the command.
        Throws:
        com.ibm.commerce.exception.ECException - Thrown whenever there is an error determining the additions to the predefined configuration.
        See Also:
        OrderItemAccessBean, DynamicKitComponent
      • getPriceDifferenceAddingComponents

        public MonetaryAmount getPriceDifferenceAddingComponents(java.util.Set components,
                                                                 java.lang.String currency,
                                                                 java.lang.Long contractId)
                                                          throws java.lang.Exception
        Returns the negated price change to the predefined configuration that is caused by removing the components in the passed Set of DynamicKitComponent objects.
        Specified by:
        getPriceDifferenceAddingComponents in interface PredefinedConfigurationComponentPricingCmd
        Parameters:
        components - A Set of DynamicKitComponent objects that represents the removals from the predefined configuration.
        currency - The currency in which to calculate the price changes.
        contractId - The ID of the contract to use to calculate the prices of each component in the components Set.
        Returns:
        A MonetaryAmount object that contains the price change to the predefined configuration.
        Throws:
        java.lang.Exception - Thrown whenever the price change cannot be calculated.
      • getPriceDifferenceRemovingComponents

        public MonetaryAmount getPriceDifferenceRemovingComponents(java.util.Set components,
                                                                   java.lang.String currency,
                                                                   java.lang.Long contractId)
                                                            throws java.lang.Exception
        Returns the negated price change to the predefined configuration that is caused by removing the components in the passed Set of DynamicKitComponent objects.
        Specified by:
        getPriceDifferenceRemovingComponents in interface PredefinedConfigurationComponentPricingCmd
        Parameters:
        components - A Set of DynamicKitComponent objects that represents the removals from the predefined configuration.
        currency - The currency in which to calculate the price changes.
        contractId - The ID of the contract to use to calculate the prices of each component in the components Set.
        Returns:
        A MonetaryAmount object that contains the price change to the predefined configuration.
        Throws:
        java.lang.Exception - Thrown whenever the price change cannot be calculated.
      • getPriceDifferenceReplacingComponents

        public MonetaryAmount getPriceDifferenceReplacingComponents(java.util.Hashtable replacements,
                                                                    java.lang.String currency,
                                                                    java.lang.Long contractId)
                                                             throws java.lang.Exception
        Returns the price change to the predefined configuration that is caused by preforming the component replacements in the passed Hashtable of DynamicKitComponent objects. This implementation calls the getPriceDifferenceAddingComponents and getPriceDifferenceRemovingComponents methods to calculate the replacement price using the formula:

        replacementCost((x1,x2,...,xn),(y1,y2,...,yn)) = additionCost((y1,y2,...,yn)) - removalCost((x1,x2,...xn))
        Specified by:
        getPriceDifferenceReplacingComponents in interface PredefinedConfigurationComponentPricingCmd
        Parameters:
        replacements - A Hashtable of DynamicKitComponent objects that represents the replacements in the predefined configuration.
        currency - The currency in which to calculate the price changes.
        contractId - The ID of the contract to use to calculate the prices of each component in the components Set.
        Returns:
        A MonetaryAmount object that contains the price change to the predefined configuration.
        Throws:
        java.lang.Exception - Thrown whenever the price change cannot be calculated.
      • getRemovals

        public java.util.Set getRemovals(com.ibm.commerce.order.objects.OrderItemAccessBean oiab)
                                  throws com.ibm.commerce.exception.ECException
        Returns all items that were removed from the predefined configuration set on the command in order to create the dynamic kit configuration represented by the OrderItemAccessBean passed.
        Specified by:
        getRemovals in interface PredefinedConfigurationComponentPricingCmd
        Parameters:
        oiab - The OrderItemAccessBean that represents the dynamic kit configuration to price using the predefined configuration set on the command.
        Returns:
        A Set of DynamicKitComponent objects that were removed from the predefined configuration to yield the configuration represented by the OrderItemAccessBean passed into the command.
        Throws:
        com.ibm.commerce.exception.ECException - Thrown whenever there is an error determining the removals from the predefined configuration.
        See Also:
        OrderItemAccessBean, DynamicKitComponent
      • getReplacements

        public java.util.Hashtable getReplacements(com.ibm.commerce.order.objects.OrderItemAccessBean oiab)
                                            throws com.ibm.commerce.exception.ECException
        Returns a hashtable of the items, that were replaced in the predefined configuration set on the command. It is in order to create the dynamic kit configuration represented by the OrderItemAccessBean passed along with the replacement component.
        Specified by:
        getReplacements in interface PredefinedConfigurationComponentPricingCmd
        Parameters:
        oiab - The OrderItemAccessBean that represents the dynamic kit configuration to price using the predefined configuration set on the command.
        Returns:
        A Hashtable representing the replacements. The keys of the Hashtable are DynamicKitComponent objects, that represent the components that were replaced in the predefined configuration. It is to yield the configuration represented by the OrderItemAccessBean passed into the command. Each DynamicKitComponent key has a hashed DynamicKitComponent entry that represents the replacement of the DynamicKitComponent key in the predefined configuration.
        Throws:
        com.ibm.commerce.exception.ECException - Thrown whenever there is an error determining the replacements in the predefined configuration.
        See Also:
        OrderItemAccessBean, DynamicKitComponent
      • performExecute

        public void performExecute()
                            throws com.ibm.commerce.exception.ECException
        Executes the command.
        Specified by:
        performExecute in interface com.ibm.commerce.command.ECCommand
        Overrides:
        performExecute in class com.ibm.commerce.command.AbstractECTargetableCommand
        Throws:
        com.ibm.commerce.exception.ECException - Thrown whenever the predefined configuration cannot be loaded.
      • setPredefinedConfigurationId

        public void setPredefinedConfigurationId(java.lang.Long predefinedConfigurationId)
        Sets the ID of the predefined configuration to use.
        Specified by:
        setPredefinedConfigurationId in interface PredefinedConfigurationComponentPricingCmd
        Parameters:
        predefinedConfigurationId - The ID of the predefined configuration to use.