Class ItemDiscountMultiplierCalculator

  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.pricing.DiscountCalculatorService
              extended by atg.commerce.pricing.ItemDiscountCalculator
                  extended by atg.projects.b2cstore.ItemDiscountMultiplierCalculator
All Implemented Interfaces:
ItemPricingCalculator, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class ItemDiscountMultiplierCalculator
extends ItemDiscountCalculator

This calculator knows how to adjust the amount of a discount by factor N, where N is the adjuster amount as defined in a PricingModel. That is, if an item originally costs $20, and has had $5 taken off of the price for whatever reason, then the new price is $15. The ItemDiscountMultiplierCalculator takes this amount and multiplies it by the number N. So, if the number N is 2, then the new discount amount would be $10 and the new price would also be $10.

The parent class, ItemDiscountCalculator is used to determine which items should qualify for getting a double discount and then the overriden adjust method defined in this class applies determines the new adjustment.

See Also:

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
Fields inherited from class atg.commerce.pricing.ItemDiscountCalculator
Fields inherited from class atg.commerce.pricing.DiscountCalculatorService
Fields inherited from class atg.nucleus.GenericService
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
Constructor Summary
          Empty Constructor
Method Summary
protected  double adjust(double pCurrentPrice, double pDiscountAmount, double pAdjuster, java.lang.String pId)
          Adjust the price of an item.
 double findAdjustedPrice(DetailedItemPriceInfo pDetailedItemPriceInfo, java.util.List pPriceQuotes, java.util.List pItems, RepositoryItem pPricingModel, RepositoryItem pProfile, java.util.Locale pLocale, Order pOrder, java.util.Map pExtraParameters)
          Override the findAdjustedPrice to enable us to provide different parameters to the adjust() method of this function.
Methods inherited from class atg.commerce.pricing.ItemDiscountCalculator
determineDiscountNumber, doStartService, findQualifyingItems, getAmountToDiscount, getPricingTools, getRangeComparator, priceDetailedItemPriceInfo, priceEachItem, priceItem, priceItems, priceQualifyingItem, priceQualifyingItems, setPricingTools, setRangeComparator, updateDetailedPriceInfos, updateQualifyingDetails, updateQuantityAsQualifier, validateQualifierService
Methods inherited from class atg.commerce.pricing.DiscountCalculatorService
adjust, adjustAmount, getAdjuster, getDiscountType, getDiscountType, getPricingModelProperties, getPromotionTools, getQualifierService, getQualifierService, isNegativeAmountException, setNegativeAmountException, setPricingModelProperties, setPromotionTools, setQualifierService
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail


public ItemDiscountMultiplierCalculator()
Empty Constructor

Method Detail


public double findAdjustedPrice(DetailedItemPriceInfo pDetailedItemPriceInfo,
                                java.util.List pPriceQuotes,
                                java.util.List pItems,
                                RepositoryItem pPricingModel,
                                RepositoryItem pProfile,
                                java.util.Locale pLocale,
                                Order pOrder,
                                java.util.Map pExtraParameters)
                         throws PricingException
Override the findAdjustedPrice to enable us to provide different parameters to the adjust() method of this function. Specifically, the adjust funcion needs:

The amout that the DetailedItemPriceInfo has been discounted thus far is determined by iterating through the List of adjustments and retrieving their amounts.

findAdjustedPrice in class ItemDiscountCalculator
pDetailedItemPriceInfo - the details on the item being priced
pPriceQuotes - list of itemPriceInfo
pItems - list of commerceItems
pPricingModel - pricing model being used to calculate price
pProfile - users profile, not used here
pLocale - users locale, not used here
pOrder - users order, not used here
pExtraParameters - map of extra params, not used here
a value of type 'double'
PricingException - if an error occurs


protected double adjust(double pCurrentPrice,
                        double pDiscountAmount,
                        double pAdjuster,
                        java.lang.String pId)
                 throws PricingException
Adjust the price of an item. This method overrides the adjust method by calculating the price of an item in a new manner. It determines a new adjusted price by multiplying the previous adjusted amount by the adjuster amount specified in the PricingModel. This amount is then subtracted from the original price and returned to the calling method.

pCurrentPrice - the current price of the item
pDiscountAmount - the amount the item has been discounted thus far
pAdjuster - the adjuster for this discount
pId - the commerce id of the item
a value of type 'double'
PricingException - if there was a problem in adjusting the current price