atg.commerce.pricing.priceLists
Class ItemTieredPriceCalculator

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.pricing.priceLists.ItemTieredPriceCalculator
All Implemented Interfaces:
ItemPriceSourceHandler, ItemSchemePriceCalculator, 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 ItemTieredPriceCalculator
extends GenericService
implements ItemSchemePriceCalculator, ItemPriceSourceHandler

A calculator which determines the tiered price of an item and sets the itemPriceInfo to be that amount. The pricing scheme for that item is tier pricing.

Tier pricing means the item's unit price will be variable, based on how many quantities ordered and how the tier is defined. For instance, if buy quantity from 0 to 10, the tier price is 10$, buy quantity from 11 to 20, the unit price is 9$, buy quantity from 21 to 30, the unit price is 8$ then if the user buys 25 items, the total price will be 10*10 + 10*9 + 5*8 = 230$

See Also:
ItemSchemePriceCalculator

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String RANGE_PROPERTY
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
ItemTieredPriceCalculator()
           
 
Method Summary
 java.lang.String getComplexPricePropertyName()
          the name of the property for the ComplexPrice
 ItemPriceSource getItemPriceSource(ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          This method is called by the calculator to return the ItemPriceSource that should be used to price the given CommerceItem
 OrderManager getOrderManager()
          The order manager is used to find the relationships for a given range.
 java.lang.String getPriceLevelPropertyName()
          the name of the property for the PriceLevel
 java.util.List getPriceLevels(ItemPriceSource pItemPriceSource, RepositoryItem pPrice, ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          This method is called by the calculator to provide the List of priceLevel repository items used to price the given commerce item.
 java.lang.String getPricePropertyName()
          the name of the property for the price of each price level
 PricingTools getPricingTools()
          pricing tools to help with price calculation
 java.lang.String getQuantityPropertyName()
          the name of the property for the quantity of each price level
 boolean populateItemPriceSource(ItemPriceSource pItemPriceSource, Order pOrder, CommerceItem pCommerceItem, CommerceItem pParentCommerceItem, java.util.Map pExtraParameters)
          Generates the ItemPriceSource listVolumeLevels based on the PricingAdjustments added by this calculator to the given CommerceItem.
 void priceItem(RepositoryItem pPrice, ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Sets the tiered price with the given determined price
 void setComplexPricePropertyName(java.lang.String pComplexPricePropertyName)
          the name of the property for the ComplexPrice
 void setOrderManager(OrderManager pOrderManager)
           
 void setPriceLevelPropertyName(java.lang.String pPriceLevelPropertyName)
          the name of the property for the PriceLevel
 void setPricePropertyName(java.lang.String pPricePropertyName)
          the name of the property for the price of each price level
 void setPricingTools(PricingTools pPricingTools)
          pricing tools to help with price calculation
 void setQuantityPropertyName(java.lang.String pQuantityPropertyName)
          the name of the property for the quantity of each price level
 boolean shouldConsumeSource(ItemPriceSource pItemPriceSource)
          This implementation is only here to satisfy the interface.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, 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
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


RANGE_PROPERTY

public static final java.lang.String RANGE_PROPERTY
See Also:
Constant Field Values
Constructor Detail

ItemTieredPriceCalculator

public ItemTieredPriceCalculator()
Method Detail

setPricingTools

public void setPricingTools(PricingTools pPricingTools)
pricing tools to help with price calculation

Parameters:
pPricingTools - new value to set

getPricingTools

public PricingTools getPricingTools()
pricing tools to help with price calculation

Returns:
property PricingTools

setOrderManager

public void setOrderManager(OrderManager pOrderManager)

getOrderManager

public OrderManager getOrderManager()
The order manager is used to find the relationships for a given range. This is to ensure DetailedItemPriceInfos are created correctly.


setComplexPricePropertyName

public void setComplexPricePropertyName(java.lang.String pComplexPricePropertyName)
the name of the property for the ComplexPrice

Parameters:
pComplexPricePropertyName - new value to set

getComplexPricePropertyName

public java.lang.String getComplexPricePropertyName()
the name of the property for the ComplexPrice

Returns:
property ComplexPricePropertyName

setPriceLevelPropertyName

public void setPriceLevelPropertyName(java.lang.String pPriceLevelPropertyName)
the name of the property for the PriceLevel

Parameters:
pPriceLevelPropertyName - new value to set

getPriceLevelPropertyName

public java.lang.String getPriceLevelPropertyName()
the name of the property for the PriceLevel

Returns:
property PriceLevelPropertyName

setQuantityPropertyName

public void setQuantityPropertyName(java.lang.String pQuantityPropertyName)
the name of the property for the quantity of each price level

Parameters:
pQuantityPropertyName - new value to set

getQuantityPropertyName

public java.lang.String getQuantityPropertyName()
the name of the property for the quantity of each price level

Returns:
property QuantityPropertyName

setPricePropertyName

public void setPricePropertyName(java.lang.String pPricePropertyName)
the name of the property for the price of each price level

Parameters:
pPricePropertyName - new value to set

getPricePropertyName

public java.lang.String getPricePropertyName()
the name of the property for the price of each price level

Returns:
property PricePropertyName

priceItem

public void priceItem(RepositoryItem pPrice,
                      ItemPriceInfo pPriceQuote,
                      CommerceItem pItem,
                      RepositoryItem pPricingModel,
                      java.util.Locale pLocale,
                      RepositoryItem pProfile,
                      java.util.Map pExtraParameters)
               throws PricingException
Sets the tiered price with the given determined price

This method calls getPriceLevels to determine the list of price levels that should be used to price the item.

Specified by:
priceItem in interface ItemSchemePriceCalculator
Parameters:
pPrice - the price as extracted from the PriceList
pPriceQuote - ItemPriceInfo representing the current price quote for the item
pItem - The item to price
pPricingModel - A RepositoryItem representing a PricingModel
pLocale - the locale in which this item should be priced
pProfile - The user's profile
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Throws:
PricingException - if there was a problem pricing the input pItem
See Also:
getPriceLevels(ItemPriceSource, RepositoryItem, ItemPriceInfo, CommerceItem, RepositoryItem, Locale, RepositoryItem, Map)

getPriceLevels

public java.util.List getPriceLevels(ItemPriceSource pItemPriceSource,
                                     RepositoryItem pPrice,
                                     ItemPriceInfo pPriceQuote,
                                     CommerceItem pItem,
                                     RepositoryItem pPricingModel,
                                     java.util.Locale pLocale,
                                     RepositoryItem pProfile,
                                     java.util.Map pExtraParameters)
                              throws PricingException
This method is called by the calculator to provide the List of priceLevel repository items used to price the given commerce item.

This method first checks for a ItemPriceSource and returns its list volume levels. Otherwise, it returns the levels from the given price repository item.

Parameters:
pItemPriceSource - the ItemPriceSource that is being use to price the item. The value can be null when no source is being used.
pPrice - the price object found for the item. This value can be null when a price source is being used.
pPriceQuote - the current price info
pItem - the item being priced
pPricingModel -
pLocale -
pProfile -
pExtraParameters - the extra parameter map
Returns:
the List of priceLevel repository items
Throws:
PricingException

getItemPriceSource

public ItemPriceSource getItemPriceSource(ItemPriceInfo pPriceQuote,
                                          CommerceItem pItem,
                                          RepositoryItem pPricingModel,
                                          java.util.Locale pLocale,
                                          RepositoryItem pProfile,
                                          java.util.Map pExtraParameters)
This method is called by the calculator to return the ItemPriceSource that should be used to price the given CommerceItem

Specified by:
getItemPriceSource in interface ItemPriceSourceHandler
Parameters:
pPriceQuote - the new ItemPriceInfo for that's being generated in the pricing operation
pItem - the commerce item that's being priced
pPricingModel - the current pricing model
pLocale - the locale
pProfile - the customer profile reference
pExtraParameters - the extra parameter map passed to the pricing operation.
Returns:
If not null, the ItemPriceSource that should be used to price the item.
See Also:
PricingTools.getItemPriceSource(ItemPriceInfo, CommerceItem, RepositoryItem, Locale, RepositoryItem, Map)

populateItemPriceSource

public boolean populateItemPriceSource(ItemPriceSource pItemPriceSource,
                                       Order pOrder,
                                       CommerceItem pCommerceItem,
                                       CommerceItem pParentCommerceItem,
                                       java.util.Map pExtraParameters)
Generates the ItemPriceSource listVolumeLevels based on the PricingAdjustments added by this calculator to the given CommerceItem. The PricingAdjustments are used to reverse engineer the levels used to price the item. Note that the levels can only be determined up to the last one used to originally price the item.

Specified by:
populateItemPriceSource in interface ItemPriceSourceHandler
Parameters:
pItemPriceSource - the source being generated and populated with pricing data.
pOrder - the Order
pCommerceItem - the item for which the source is being created
pParentCommerceItem - the item that contained pCommerceItem
pExtraParameters - a Map of extra parameters objects that was passed to the initial call to generate the source objects.
Returns:
return true if any of the ItemPriceSource properties were updated

shouldConsumeSource

public boolean shouldConsumeSource(ItemPriceSource pItemPriceSource)
This implementation is only here to satisfy the interface. It is not actually called by the calculator since the parent price list calculator decides which scheme calculator should price the item based on the priceListScheme in the ItemPriceSource

Specified by:
shouldConsumeSource in interface ItemPriceSourceHandler