public abstract class ItemPriceCalculator extends GenericService implements ItemPricingCalculator, ItemPriceSourceHandler
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:
priceSource which
represents an item's price.
priceSource
if the CommerceItem doesn't have its [pricePropertyName] property set.
getPriceSource returns the
catalogRef property of the input CommerceItem. If false,
getPriceSource returns the productRef property.
catalogRef property of the input
CommerceItem if priceFromCatalogRef is true. If
priceFromCatalogRef is false,
getPriceSource returns the productRef property.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
SERVICE_INFO_KEYDEFAULT_LOG_TRACE_STATUSDEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS| Constructor and Description |
|---|
ItemPriceCalculator() |
| Modifier and Type | Method and Description |
|---|---|
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 get the
ItemPriceSource that
should be used to price the given CommerceItem |
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.
|
java.lang.Object |
getPriceSource(ItemPriceInfo pPriceQuote,
CommerceItem pItem,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters)
Returns the object that should be used as a price source for the
given commerce item.
|
PricingTools |
getPricingTools()
pricing tools to help with price calculation
|
boolean |
isPriceFromCatalogRef()
Returns property PriceFromCatalogRef.
|
boolean |
isRequirePriceValue()
Returns property RequirePriceValue
|
boolean |
populateItemPriceSource(ItemPriceSource pItemPriceSource,
Order pOrder,
CommerceItem pCommerceItem,
CommerceItem pParentCommerceItem,
java.util.Map pExtraParameters)
This is a no-op implementation that returns false.
|
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 |
setPricingTools(PricingTools pPricingTools)
pricing tools to help with price calculation
|
void |
setRequirePriceValue(boolean pRequirePriceValue)
Sets property RequirePriceValue
|
boolean |
shouldConsumeSource(ItemPriceSource pItemPriceSource)
Determines if the price source should be consumed by the calculator.
|
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, stopServicevlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarningpublic static final java.lang.String CLASS_VERSION
public void setPricingTools(PricingTools pPricingTools)
pPricingTools - new value to setpublic PricingTools getPricingTools()
public void setLoggingIdentifier(java.lang.String pLoggingIdentifier)
pLoggingIdentifier - new value to setpublic java.lang.String getLoggingIdentifier()
public void setPricePropertyName(java.lang.String pPricePropertyName)
pPricePropertyName - the new value to setpublic java.lang.String getPricePropertyName()
public void setRequirePriceValue(boolean pRequirePriceValue)
public boolean isRequirePriceValue()
public void setPriceFromCatalogRef(boolean pPriceFromCatalogRef)
public boolean isPriceFromCatalogRef()
protected java.lang.Object getPriceSource(CommerceItem pItem) throws PricingException
priceFromCatalogRef property as
a switch to determine if the catalogRef or productRef should be returned
from the CommerceItemPricingExceptionpublic ItemPriceSource getItemPriceSource(ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
ItemPriceSource that
should be used to price the given CommerceItem
This implemenation returns the item's matching source from the extra parameters
getItemPriceSource in interface ItemPriceSourceHandlerpPriceQuote - the new ItemPriceInfo for that's being generated in the pricing operationpItem - the commerce item that's being pricedpPricingModel - the current pricing modelpLocale - the localepProfile - the customer profile referencepExtraParameters - the extra parameter map passed to the pricing operation.PricingTools.getItemPriceSource(ItemPriceInfo, CommerceItem, RepositoryItem, Locale, RepositoryItem, Map)public java.lang.Object getPriceSource(ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
pricePropertyName.
This implementation first checks for a ItemPriceSource and returns it, if
found. Otherwise, it delegates to the getPriceSource(CommerceItem) method
PricingExceptiongetPriceSource(CommerceItem)protected double getPrice(java.lang.Object pPriceSource)
throws PricingException
PricingExceptionpublic void priceItem(ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
The list price is determined from price source object returned by getPriceSource
priceItem in interface ItemPricingCalculatorpPriceQuote - ItemPriceInfo representing the current price quote for the itempItem - The item to pricepPricingModel - A RepositoryItem representing a PricingModelpProfile - The user's profilepExtraParameters - A Map of extra parameters to be used in the pricing, may be nullPricingExceptiongetPriceSource(ItemPriceInfo, CommerceItem, RepositoryItem, Locale, RepositoryItem, Map)protected abstract void priceItem(double pPrice,
ItemPriceInfo pPriceQuote,
CommerceItem pItem,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters)
throws PricingException
pPrice - the price as extracted from the itempPriceQuote - ItemPriceInfo representing the current price quote for the itempItem - The item to pricepPricingModel - A RepositoryItem representing a PricingModelpProfile - The user's profilepExtraParameters - A Map of extra parameters to be used in the pricing, may be nullPricingExceptionpublic void priceEachItem(java.util.List pPriceQuotes,
java.util.List pItems,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters)
throws PricingException
priceEachItem in interface ItemPricingCalculatorpPriceQuotes - List of ItemPriceInfo objects representing the current price quotes for each itempItems - The items to price (individually)pPricingModel - A RepositoryItem representing a PricingModelpProfile - The user's profilepExtraParameters - A Map of extra parameters to be used in the pricing, may be nullPricingExceptionpublic 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
priceItems in interface ItemPricingCalculatorpPriceQuotes - List of ItemPriceInfo objects representing the current price quotes for the itemspItems - The items to pricepPricingModels - A RepositoryItem representing a PricingModelpProfile - The user's profilepOrder - The Order object of which the List of items are a part, may be nullpExtraParameters - A Map of extra parameters to be used in the pricing, may be nullPricingExceptionpublic boolean populateItemPriceSource(ItemPriceSource pItemPriceSource, Order pOrder, CommerceItem pCommerceItem, CommerceItem pParentCommerceItem, java.util.Map pExtraParameters)
populateItemPriceSource in interface ItemPriceSourceHandlerpItemPriceSource - the source being generated and populated with pricing data.pOrder - the OrderpCommerceItem - the item for which the source is being createdpParentCommerceItem - the item that contained pCommerceItempExtraParameters - a Map of extra parameters objects that was passed to the initial call to generate the source objects.ItemPriceSource properties were updatedpublic boolean shouldConsumeSource(ItemPriceSource pItemPriceSource)
This implementation always returns false. Subclasses override this method to make a determination based on the contents of the source.
shouldConsumeSource in interface ItemPriceSourceHandlerpItemPriceSource - the source that was given to price the item.