atg.commerce.pricing.priceLists
Class ItemSalesPriceCalculator

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

A calculator that sets the sales price for a commerce item.

See Also:
ItemSchemePriceCalculator

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
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
ItemSalesPriceCalculator()
           
 
Method Summary
 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
 PricingTools getPricingTools()
          pricing tools to help with price calculation
 java.lang.Double getSalePrice(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 sale price to price the given commerce item.
 java.lang.String getSalesPricePropertyName()
          the name of the property for the SalesPrice
 boolean populateItemPriceSource(ItemPriceSource pItemPriceSource, Order pOrder, CommerceItem pCommerceItem, CommerceItem pParentCommerceItem, java.util.Map pExtraParameters)
          Sets the sale price property of the given source based on the matching PricingAdjustment found on the given commerce item.
 void priceItem(RepositoryItem pPrice, ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Sets the sales price with the given determined price
 void setPricingTools(PricingTools pPricingTools)
          pricing tools to help with price calculation
 void setSalesPricePropertyName(java.lang.String pSalesPricePropertyName)
          the name of the property for the SalesPrice
 boolean shouldConsumeSource(ItemPriceSource pItemPriceSource)
          This method is called to determine the given source should be used by the calculator to price the item.
 
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

Constructor Detail

ItemSalesPriceCalculator

public ItemSalesPriceCalculator()
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

setSalesPricePropertyName

public void setSalesPricePropertyName(java.lang.String pSalesPricePropertyName)
the name of the property for the SalesPrice

Parameters:
pSalesPricePropertyName - new value to set

getSalesPricePropertyName

public java.lang.String getSalesPricePropertyName()
the name of the property for the SalesPrice

Returns:
property SalesPricePropertyName

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 sales price with the given determined price

This method calls getSalePrice to determine the sale price 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:
getSalePrice(ItemPriceSource, RepositoryItem, ItemPriceInfo, CommerceItem, RepositoryItem, Locale, RepositoryItem, Map)

getSalePrice

public java.lang.Double getSalePrice(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 sale price to price the given commerce item.

This method first checks for a ItemPriceSource and returns its sale price. Otherwise, it returns the sale price 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)
Sets the sale price property of the given source based on the matching PricingAdjustment found on the given commerce 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 - an extra parameter map that was original passed to the call to generate the source objects
Returns:
return true an adjustment was found and the sale price set.
See Also:
#findAdjustment(ItemPriceInfo)

shouldConsumeSource

public boolean shouldConsumeSource(ItemPriceSource pItemPriceSource)
This method is called to determine the given source should be used by the calculator to price the item. A false return means the calculator will bypass its processing completely and return normally.

This implementation always returns true 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