atg.commerce.pricing
Class ItemPriceCalculator

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

public abstract class ItemPriceCalculator
extends GenericService
implements ItemPricingCalculator

Superclass for all CommerceItem calculators. Consolidates functionality that some item price calculators have in common. ItemPriceCalculator extends ApplicationLoggingImpl, so classes that extend this one have access to Nucleus logging services. This class contains a single abstract method: priceItem. Extending classes implement this method to leverage this class's other CommerceItem pricing methods.

Properties:

See Also:
ItemListPriceCalculator, ItemSalePriceCalculator

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
 java.lang.String getLoggingIdentifier()
          the ID that this class uses to identify itself in logs
protected  double getPrice(java.lang.Object pPriceSource)
          Return the price that should be used in pricing.
 java.lang.String getPricePropertyName()
          Returns the name of the property of the catalogRef property of CommerceItem which contains the price
protected  java.lang.Object getPriceSource(CommerceItem pItem)
          Return the object which should be used as the source for pricing.
 boolean isPriceFromCatalogRef()
          Returns property PriceFromCatalogRef.
 boolean isRequirePriceValue()
          Returns property RequirePriceValue
 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
protected abstract  void priceItem(double pPrice, ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Set the price info given the determined price
 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 setPriceFromCatalogRef(boolean pPriceFromCatalogRef)
          Sets property PriceFromCatalogRef
 void setPricePropertyName(java.lang.String pPricePropertyName)
          Returns the name of the property of the catalogRef property of CommerceItem which contains the price
 void setRequirePriceValue(boolean pRequirePriceValue)
          Sets property RequirePriceValue
 
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

setPricePropertyName

public void setPricePropertyName(java.lang.String pPricePropertyName)
Returns the name of the property of the catalogRef property of CommerceItem which contains the price

Parameters:
pPricePropertyName - the new value to set

getPricePropertyName

public java.lang.String getPricePropertyName()
Returns the name of the property of the catalogRef property of CommerceItem which contains the price

Returns:
the property pricePropertyName

setRequirePriceValue

public void setRequirePriceValue(boolean pRequirePriceValue)
Sets property RequirePriceValue


isRequirePriceValue

public boolean isRequirePriceValue()
Returns property RequirePriceValue


setPriceFromCatalogRef

public void setPriceFromCatalogRef(boolean pPriceFromCatalogRef)
Sets property PriceFromCatalogRef


isPriceFromCatalogRef

public boolean isPriceFromCatalogRef()
Returns property PriceFromCatalogRef.

Returns:
true if the price should be extracted from the catalogRef (aka sku). Otherwise extract the price from the product object

getPriceSource

protected java.lang.Object getPriceSource(CommerceItem pItem)
                                   throws PricingException
Return the object which should be used as the source for pricing. This method uses the priceFromCatalogRef property as a switch to determine if the catalogRef or productRef should be returned from the CommerceItem

Throws:
PricingException

getPrice

protected double getPrice(java.lang.Object pPriceSource)
                   throws PricingException
Return the price that should be used in pricing. Return -1 if no pricing should take place for this object

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

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
Throws:
PricingException

priceItem

protected abstract void priceItem(double pPrice,
                                  ItemPriceInfo pPriceQuote,
                                  CommerceItem pItem,
                                  RepositoryItem pPricingModel,
                                  java.util.Locale pLocale,
                                  RepositoryItem pProfile,
                                  java.util.Map pExtraParameters)
                           throws PricingException
Set the price info given the determined price

Parameters:
pPrice - the price as extracted from the item
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
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