public class ItemSalePriceCalculator extends ItemPriceCalculator
Properties:
catalogRef
or productRef
of a CommerceItem.
ItemPriceInfo
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
ItemSalePriceCalculator() |
Modifier and Type | Method and Description |
---|---|
void |
doStartService()
This is called after a Service has been created, placed into the
naming hierarchy, and initialized with its configured property
values.
|
java.lang.String |
getOnSalePropertyName()
Returns property OnSalePropertyName
|
protected boolean |
onSale(java.lang.Object pPriceSource)
Returns true if the commerce item to be priced is on sale
|
boolean |
populateItemPriceSource(ItemPriceSource pItemPriceSource,
Order pOrder,
CommerceItem pCommerceItem,
CommerceItem pParentCommerceItem,
java.util.Map pExtraParameters)
Populates the sale price property of the source based on the PricingAdjustment added by this calculator and the source's list price value.
|
protected void |
priceItem(double pPrice,
ItemPriceInfo pPriceQuote,
CommerceItem pItem,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters)
Sets the sale price with the given determined price
|
void |
priceItem(ItemPriceInfo pPriceQuote,
CommerceItem pItem,
RepositoryItem pPricingModel,
java.util.Locale pLocale,
RepositoryItem pProfile,
java.util.Map pExtraParameters)
If the item should be priced as a sales item (method
onSale return true) then go ahead an price it |
void |
setOnSalePropertyName(java.lang.String pOnSalePropertyName)
Sets property OnSalePropertyName
|
boolean |
shouldConsumeSource(ItemPriceSource pItemPriceSource)
If the
onSale property is false or salePrice property is null,
false is returned. |
getItemPriceSource, getLoggingIdentifier, getPrice, getPricePropertyName, getPriceSource, getPriceSource, getPricingTools, isPriceFromCatalogRef, isRequirePriceValue, priceEachItem, priceItems, setLoggingIdentifier, setPriceFromCatalogRef, setPricePropertyName, setPricingTools, setRequirePriceValue
addLogListener, createAdminServlet, 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
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public void setOnSalePropertyName(java.lang.String pOnSalePropertyName)
public java.lang.String getOnSalePropertyName()
protected void priceItem(double pPrice, ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
priceItem
in class ItemPriceCalculator
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 nullPricingException
public void priceItem(ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters) throws PricingException
onSale
return true) then go ahead an price itpriceItem
in interface ItemPricingCalculator
priceItem
in class ItemPriceCalculator
pPriceQuote
- 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 nullPricingException
ItemPriceCalculator.getPriceSource(ItemPriceInfo, CommerceItem, RepositoryItem, Locale, RepositoryItem, Map)
protected boolean onSale(java.lang.Object pPriceSource) throws PricingException
PricingException
public void doStartService() throws ServiceException
GenericService
doStartService
in class GenericService
ServiceException
- if the Service had a problem starting uppublic boolean populateItemPriceSource(ItemPriceSource pItemPriceSource, Order pOrder, CommerceItem pCommerceItem, CommerceItem pParentCommerceItem, java.util.Map pExtraParameters)
populateItemPriceSource
in interface ItemPriceSourceHandler
populateItemPriceSource
in class ItemPriceCalculator
pItemPriceSource
- 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.public boolean shouldConsumeSource(ItemPriceSource pItemPriceSource)
onSale
property is false or salePrice
property is null,
false is returned. Otherwise true.shouldConsumeSource
in interface ItemPriceSourceHandler
shouldConsumeSource
in class ItemPriceCalculator
pItemPriceSource
- the source that was given to price the item.