atg.commerce.pricing.priceLists
Class ItemPriceCalculator

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.pricing.priceLists.ItemPriceCalculator
All Implemented Interfaces:
ItemPricingCalculator, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener
Direct Known Subclasses:
ConfigurableItemPriceListCalculator

public class ItemPriceCalculator
extends GenericService
implements ItemPricingCalculator

This class can either price a single commerce item or price a list of commerce items. It will first select the priceList to use based on the profilePriceListPropertyName property, then it will delegate the pricing to different ItemSchemePriceCalculators based on the item's pricing scheme by the pricingSchemePropertyName property.

Properties:

See Also:
ItemPricingCalculator

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
ItemPriceCalculator()
           
 
Method Summary
protected  RepositoryItem getDifferentPriceList(ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Get the price list from the extra parameters.
 java.lang.String getLoggingIdentifier()
          the ID that this class uses to identify itself in logs
 PriceListManager getPriceListManager()
          Returns the reference to the PriceListManager which handles the operations of the PriceList
protected  java.lang.String getPricingScheme(RepositoryItem pPrice)
          Return the pricing scheme in the Price RepositoryItem
 java.util.Properties getPricingSchemeNames()
          Returns the key/Value pair for the allowed scheme names and its corresponding Calculator
 java.lang.String getPricingSchemePropertyName()
          the name of the property for the PricingScheme
 java.lang.String getProfilePriceListPropertyName()
          The name of the property in the profile that stores the price list.
 boolean isNoPriceIsError()
          If this is true, and the price list is null or there is not price in the price list, then an error is thrown.
 boolean isUseDefaultPriceList()
          If true and ProfilePriceListPropertyName is null, then the value of PriceListManager.automaticallyUseDefaultPriceList determines if the default price list is used.
 void priceEachItem(java.util.List pPriceQuotes, java.util.List pItems, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price each of a List of items in a context
 void priceItem(ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price a single item in a context.
 void priceItems(java.util.List pPriceQuotes, java.util.List pItems, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, Order pOrder, java.util.Map pExtraParameters)
          Price a List of items together in a context
 void setLoggingIdentifier(java.lang.String pLoggingIdentifier)
          the ID that this class uses to identify itself in logs
 void setNoPriceIsError(boolean pNoPriceIsError)
          If this is true, and the price list is null or there is not price in the price list, then an error is thrown.
 void setPriceListManager(PriceListManager pPriceListManager)
          Sets property PriceListManager which handles the operations of the PriceList
 void setPricingSchemeNames(java.util.Properties pPricingSchemeNames)
          the key/Value pair for the allowed scheme names and its corresponding Calculator
 void setPricingSchemePropertyName(java.lang.String pPricingSchemePropertyName)
          the name of the property for the PricingScheme
 void setProfilePriceListPropertyName(java.lang.String pProfilePriceListPropertyName)
          The name of the property in the profile that stores the price list.
 void setUseDefaultPriceList(boolean pUseDefaultPriceList)
          If true and the profiles ProfilePriceListPropertyName is null, then the default price list from the PriceListManager is used.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, 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, 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

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values
Constructor Detail

ItemPriceCalculator

public ItemPriceCalculator()
Method Detail

setLoggingIdentifier

public void setLoggingIdentifier(java.lang.String pLoggingIdentifier)
the ID that this class uses to identify itself in logs

Parameters:
pLoggingIdentifier - new value to set

getLoggingIdentifier

public java.lang.String getLoggingIdentifier()
the ID that this class uses to identify itself in logs

Returns:
property LoggingIdentifier

setPricingSchemePropertyName

public void setPricingSchemePropertyName(java.lang.String pPricingSchemePropertyName)
the name of the property for the PricingScheme

Parameters:
pPricingSchemePropertyName - new value to set

getPricingSchemePropertyName

public java.lang.String getPricingSchemePropertyName()
the name of the property for the PricingScheme

Returns:
property PricingSchemePropertyName

setProfilePriceListPropertyName

public void setProfilePriceListPropertyName(java.lang.String pProfilePriceListPropertyName)
The name of the property in the profile that stores the price list.

Parameters:
pProfilePriceListPropertyName - The new value to set

getProfilePriceListPropertyName

public java.lang.String getProfilePriceListPropertyName()
The name of the property in the profile that stores the price list.

Returns:
The name of the property in the profile

setUseDefaultPriceList

public void setUseDefaultPriceList(boolean pUseDefaultPriceList)
If true and the profiles ProfilePriceListPropertyName is null, then the default price list from the PriceListManager is used. If false, and ProfilePriceListPropertyName is null, then nothing happens. Defaults to true.

Parameters:
pUseDefaultPriceList - The new value to set

isUseDefaultPriceList

public boolean isUseDefaultPriceList()
If true and ProfilePriceListPropertyName is null, then the value of PriceListManager.automaticallyUseDefaultPriceList determines if the default price list is used. If false, then the default price list is never used. The default is true

Returns:
The value of useDefaultPriceList

setNoPriceIsError

public void setNoPriceIsError(boolean pNoPriceIsError)
If this is true, and the price list is null or there is not price in the price list, then an error is thrown. If this is false and the price list is null, then nothing happens. Default is true.

Parameters:
pNoIsError - The new value to set

isNoPriceIsError

public boolean isNoPriceIsError()
If this is true, and the price list is null or there is not price in the price list, then an error is thrown. If this is false and the price list is null, then nothing happens. Default is true.

Returns:
The value of noPriceIsError

setPriceListManager

public void setPriceListManager(PriceListManager pPriceListManager)
Sets property PriceListManager which handles the operations of the PriceList

Parameters:
pPriceListManager - the new value to set

getPriceListManager

public PriceListManager getPriceListManager()
Returns the reference to the PriceListManager which handles the operations of the PriceList

Returns:
the reference to the PriceListManager

setPricingSchemeNames

public void setPricingSchemeNames(java.util.Properties pPricingSchemeNames)
the key/Value pair for the allowed scheme names and its corresponding Calculator

Parameters:
pPricingSchemeNames - new value to set

getPricingSchemeNames

public java.util.Properties getPricingSchemeNames()
Returns the key/Value pair for the allowed scheme names and its corresponding Calculator

Returns:
the key/Value pair for the allowed scheme names and its corresponding Calculator

getPricingScheme

protected java.lang.String getPricingScheme(RepositoryItem pPrice)
                                     throws PricingException
Return the pricing scheme in the Price RepositoryItem

Throws:
PricingException

priceItem

public void priceItem(ItemPriceInfo pPriceQuote,
                      CommerceItem pItem,
                      RepositoryItem pPricingModel,
                      java.util.Locale pLocale,
                      RepositoryItem pProfile,
                      java.util.Map pExtraParameters)
               throws PricingException
Price a single item in a context. It will use the price list in the profile (most common usage) or the price list in the pExtraParameters map. In either case, it looks for profilePriceListPropertyName

Specified by:
priceItem in interface ItemPricingCalculator
Parameters:
pPriceQuote - ItemPriceInfo representing the current price quote for the item
pItem - The item to price
pPricingModel - A RepositoryItem representing a PricingModel
pProfile - The user's profile
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null You may override the price list in the profile by providing a price list (or price list id) in this map. Use profilePriceListPropertyName as the key
Throws:
PricingException

priceEachItem

public void priceEachItem(java.util.List pPriceQuotes,
                          java.util.List pItems,
                          RepositoryItem pPricingModel,
                          java.util.Locale pLocale,
                          RepositoryItem pProfile,
                          java.util.Map pExtraParameters)
                   throws PricingException
Price each of a List of items in a context

Specified by:
priceEachItem in interface ItemPricingCalculator
Parameters:
pPriceQuotes - List of ItemPriceInfo objects representing the current price quotes for each item
pItems - The items to price (individually)
pPricingModel - A RepositoryItem representing a PricingModel
pProfile - The user's profile
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Throws:
PricingException

priceItems

public void priceItems(java.util.List pPriceQuotes,
                       java.util.List pItems,
                       RepositoryItem pPricingModel,
                       java.util.Locale pLocale,
                       RepositoryItem pProfile,
                       Order pOrder,
                       java.util.Map pExtraParameters)
                throws PricingException
Price a List of items together in a context

Specified by:
priceItems in interface ItemPricingCalculator
Parameters:
pPriceQuotes - List of ItemPriceInfo objects representing the current price quotes for the items
pItems - The items to price
pPricingModels - A RepositoryItem representing a PricingModel
pProfile - The user's profile
pOrder - The Order object of which the List of items are a part, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Throws:
PricingException

getDifferentPriceList

protected RepositoryItem getDifferentPriceList(ItemPriceInfo pPriceQuote,
                                               CommerceItem pItem,
                                               RepositoryItem pPricingModel,
                                               java.util.Locale pLocale,
                                               RepositoryItem pProfile,
                                               java.util.Map pExtraParameters)
                                        throws PriceListException
Get the price list from the extra parameters. This should return null if you would rather use the price list out of the profile. This implementation only uses pExtraParameters. The rest are passed in just in case you might need them for a subclass. If this method returns null (which is the default) then the profile's priceList is used. This method looks in pExtraParameters for profilePriceListPropertyName. If it is present, then the price list mapped to by that key is returned. If the value in the map is a String, then it is assumed that this is a price list id, and PriceListManager is used to look up the price.

Returns:
a priceList repositoryItem, or null
Throws:
PriceListException