atg.projects.b2cstore
Class ItemDiscountMultiplierCalculator
java.lang.Object
atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
atg.nucleus.GenericService
atg.commerce.pricing.DiscountCalculatorService
atg.commerce.pricing.ItemDiscountCalculator
atg.projects.b2cstore.ItemDiscountMultiplierCalculator
- All Implemented Interfaces:
- ItemPricingCalculator, atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, 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:
DiscountCalculatorService
Field Summary |
static java.lang.String |
CLASS_VERSION
Class version string |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
DEFAULT_LOG_TRACE_STATUS |
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, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, 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, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, 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 |
CLASS_VERSION
public static java.lang.String CLASS_VERSION
- Class version string
ItemDiscountMultiplierCalculator
public ItemDiscountMultiplierCalculator()
- Empty Constructor
findAdjustedPrice
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 current cost for this DetailedItemPriceInfo
- the amount the DetailedItemPriceInfo has been discounted
- the adjuster for this calculator
- the id for this item
The amout that the DetailedItemPriceInfo has been discounted thus far
is determined by iterating through the List of adjustments and retrieving
their amounts.
- Overrides:
findAdjustedPrice
in class ItemDiscountCalculator
- Parameters:
pDetailedItemPriceInfo
- the details on the item being pricedpPriceQuotes
- list of itemPriceInfopItems
- list of commerceItemspPricingModel
- pricing model being used to calculate pricepProfile
- users profile, not used herepLocale
- users locale, not used herepOrder
- users order, not used herepExtraParameters
- map of extra params, not used here
- Returns:
- a value of type 'double'
- Throws:
PricingException
- if an error occurs
adjust
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.
- Parameters:
pCurrentPrice
- the current price of the itempDiscountAmount
- the amount the item has been discounted thus farpAdjuster
- the adjuster for this discountpId
- the commerce id of the item
- Returns:
- a value of type 'double'
- Throws:
PricingException
- if there was a problem in adjusting the current price