atg.commerce.pricing
Class PricingEngineService

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.pricing.PricingEngineService
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, Schedulable, java.util.EventListener
Direct Known Subclasses:
ItemPricingEngineImpl, OrderPricingEngineImpl, ShippingPricingEngineImpl, TaxPricingEngineImpl

public abstract class PricingEngineService
extends GenericService
implements Schedulable

A GenericService version of a PricingEngine. PricingEngine implementations can extend this class in order to leverage scheduling, global promotions, locale, and other configuration functionality from the PricingEngineService.

Properties:


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String EXTRA_PARAM_QUALIFIERSERVICE
           
protected  java.util.List mGlobalPromotions
           
protected  java.util.Map mPricingCalculatorServices
          Cache of calculator names to calculator service instances
 
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
PricingEngineService()
           
 
Method Summary
protected  boolean addPromotion(RepositoryItem pPromotion, java.util.Date pNow)
          This method determines if the given promotion should qualify for use in determining pricing.
 void addPromotionToList(RepositoryItem pPromotion, java.util.List pPricingModels, RepositoryItem pProfile)
          Adds a new promotion to the list of pricing models.
protected  void checkAndAddPromotions(java.util.Collection pSource, java.util.Collection pDestination, java.util.Date pNow, RepositoryItem pProfile)
          Receives a collection of promotionStatus objects which are cycled through to determine which of these promotions has expired, and which should be added to the pricingModels used.
protected  void checkAndMergePromotions(java.util.Collection pSource, java.util.Collection pCheckedMerge, java.util.Collection pDestination, java.util.Date pNow, RepositoryItem pProfile)
          Merges together two lists of promotions in the correct sorted order.
protected  boolean checkPromotionExpiration(RepositoryItem pPromotion, java.util.Date pNow)
          Return true if the promotion has expired and should be removed from the user's collection of active promotions
protected  AmountInfo createPriceInfo()
          Returns a new instance of the of the class defined through the priceInfoClass property.
 void doStartService()
          Loads the global promotions.
 void doStopService()
          Stops the schedule for updating the global promotions
protected  void expirePromotion(RepositoryItem pPromotion, RepositoryItem pProfile)
          Called if checkPromotionExpiration determines that a promotion has expired and should no longer be active.
protected  java.util.List findGlobalPromotions()
          Return the set of global promotions for this pricing engine
protected  java.util.List getAdjustmentPricingModels(AmountInfo pPriceInfo)
          Gets the pricingModels from the priceInfo's "adjustments" property These are the promotions the order has qualified for, and should not be evaluated for closeness
 boolean getAlwaysLoadGlobalPromotions()
          Gets whether or not to always load the global promotions rather than using the cache.
protected  java.lang.Object getCalculator(RepositoryItem pPricingModel)
          Return the pricing calculator that should be used for the given promotion.
 java.lang.Object getCalculatorForCalculatorType(java.lang.String pCalculatorType)
          Returns the calculator service for the given type.
 ServiceMap getCalculatorTypeCalculators()
           
 CalculatorInfo[] getCalculatorTypes()
          Gets the information for the calculators this pricing engine supports
 ClosenessQualifierEvaluator getClosenessQualifierEvaluator()
           
protected  java.lang.String getCurrencyCode(java.util.Locale pLocale)
          Return the currency code which should be used for the given locale.
 java.util.Locale getDefaultLocale()
          Returns property DefaultLocale
 java.util.List getGlobalPromotions()
          Returns property GlobalPromotions
 RqlStatement getGlobalPromotionsQuery()
          Returns property GlobalPromotionsQuery
 CurrentDate getGlobalPromotionsSchedulableDate()
          Returns property GlobalPromotionsSchedulableDate
protected  java.util.List getInitialPromotions(RepositoryItem pProfile)
          Helper method that returns a List of promotions for given a Profile.
 java.lang.Class getPriceInfoClass()
          Returns property PriceInfoClass
protected  java.lang.String getPricingCurrencyCode(RepositoryItem pProfile, java.lang.String pPriceListPropertyName, boolean pUseDefaultPriceList, java.util.Map pExtraParameters, java.util.Locale pLocale)
          Gets the locale currency code for pricing.
 java.util.Comparator getPricingModelComparator()
          Returns property PricingModelComparator
 PricingModelEvaluationVetoer[] getPricingModelEvaluationVetoers()
           
 PricingModelHolderVetoer[] getPricingModelHolderVetoers()
           
 PricingModelProperties getPricingModelProperties()
          Returns a bean that contains properties for a PricingModel
 PricingTools getPricingTools()
          Returns property PricingTools
 java.lang.String[] getProfileProperties()
          The profile properties to inspect for pricing models
 RepositoryItemDescriptor[] getPromotionItemDescriptors()
          Returns the promotion item descriptors
 java.lang.String[] getPromotionItemTypes()
          Returns property PromotionItemTypes
 java.util.List getPromotions(RepositoryItem pProfile)
           
 Repository getPromotionsRepository()
          The repository which contains the promotions
 PromotionTools getPromotionTools()
          Returns property PromotionTools
 Qualifier getQualifierService()
           
 Qualifier getQualifierService(java.util.Map pExtraParameters)
          Gets the Qualifier service to use.
 Qualifier getQualifierService(RepositoryItem pPricingModel, java.util.Map pExtraParameters)
          Gets the Qualifier service to use.
 Scheduler getScheduler()
          Returns property Scheduler
 Schedule getUpdateSchedule()
          Returns property UpdateSchedule
 java.util.List getUserOnlyPromotions(RepositoryItem pProfile)
           
 boolean isUseMerge()
          If true then this flag turns on an efficient merge algorithm to merge profile and global promotions.
protected  boolean isValidItemDescriptor(RepositoryItem pPromotion)
          This method determines if the given promotion's item descriptor matches that of the PricingEngine configured item descriptors, promotionItemDescriptors
 void loadGlobalPromotions()
          Find and load the global promotions.
 void performScheduledTask(Scheduler pScheduler, ScheduledJob pJob)
          Reload the global promotions
protected  java.util.List<atg.commerce.pricing.PricingEngineService.ValidEvaluationVetoer> prepareEvaluationVetoers(PricingEngineService pPricingEngine, PricingContext pPricingContext, java.util.Map pExtraParametersMap)
          Iterates over the configured pricing model evaluation vetoers and calls the prepare method for each.
protected  java.util.List<atg.commerce.pricing.PricingEngineService.ValidHolderVetoer> prepareHolderVetoers(PricingEngineService pPricingEngine, RepositoryItem pProfile)
          Iterates over the configured pricing model holdr vetoers and calls the prepare method for each.
protected  java.lang.Object resolveCalculator(java.lang.String pCalcServiceString)
          Resolves the passed in calculator service nucleus path to a service reference.
 void setAlwaysLoadGlobalPromotions(boolean pAlwaysLoadGlobalPromotions)
          Sets whether or not to always load the global promotions rather than using the cache.
 void setCalculatorTypeCalculators(ServiceMap pCalculatorTypeCalculators)
           
 void setClosenessQualifierEvaluator(ClosenessQualifierEvaluator pClosenessQualifierEvaluator)
          Component that evaluates if an order or item meets the closenessQualifiers for relevant promotions
 void setDefaultLocale(java.util.Locale pDefaultLocale)
          Sets property DefaultLocale
 void setGlobalPromotionsQuery(RqlStatement pGlobalPromotionsQuery)
          Sets property GlobalPromotionsQuery
 void setGlobalPromotionsSchedulableDate(CurrentDate pGlobalPromotionsSchedulableDate)
          Sets property GlobalPromotionsSchedulableDate
 void setPriceInfoClass(java.lang.Class pPriceInfoClass)
          Sets property PriceInfoClass
 void setPricingModelComparator(java.util.Comparator pPricingModelComparator)
          Sets property PricingModelComparator
 void setPricingModelEvaluationVetoers(PricingModelEvaluationVetoer[] pPricingModelEvaluationVetoers)
           
 void setPricingModelHolderVetoers(PricingModelHolderVetoer[] pPricingModelHolderVetoers)
           
 void setPricingModelProperties(PricingModelProperties pPricingModelProperties)
           
 void setPricingTools(PricingTools pPricingTools)
          Sets property PricingTools
 void setProfileProperties(java.lang.String[] pProfileProperties)
           
 void setPromotionItemTypes(java.lang.String[] pPromotionItemTypes)
          Sets property PromotionItemTypes
 void setPromotionsRepository(Repository pPromotionsRepository)
           
 void setPromotionTools(PromotionTools pPromotionTools)
          Sets property PromotionTools
 void setQualifierService(Qualifier pQualifierService)
           
 void setScheduler(Scheduler pScheduler)
          Sets property Scheduler
 void setUpdateSchedule(Schedule pUpdateSchedule)
          Sets property UpdateSchedule
 void setUseMerge(boolean pUseMerge)
           
protected  java.util.Collection<RepositoryItem> vetoPromotionsForEvaluation(PricingContext pPricingContext, java.util.Map pExtraParametersMap, java.util.Collection<RepositoryItem> pPricingModels)
          Validates the passed in promotions against the configured vetoers for evaluation.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, 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, reResolveThis, 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 java.lang.String CLASS_VERSION
Class version string


EXTRA_PARAM_QUALIFIERSERVICE

public static final java.lang.String EXTRA_PARAM_QUALIFIERSERVICE
See Also:
Constant Field Values

mPricingCalculatorServices

protected java.util.Map mPricingCalculatorServices
Cache of calculator names to calculator service instances


mGlobalPromotions

protected java.util.List mGlobalPromotions
Constructor Detail

PricingEngineService

public PricingEngineService()
Method Detail

isUseMerge

public boolean isUseMerge()
If true then this flag turns on an efficient merge algorithm to merge profile and global promotions. If false then the standard java sorting algorithm will be used instead to combine the lists.

If the number of profile based promotions is typically very large it may be more efficient to disable this flag. Defaults to true.

Returns:
useMerge boolean

setUseMerge

public void setUseMerge(boolean pUseMerge)

getCalculatorTypeCalculators

public ServiceMap getCalculatorTypeCalculators()

setCalculatorTypeCalculators

public void setCalculatorTypeCalculators(ServiceMap pCalculatorTypeCalculators)

getPricingModelEvaluationVetoers

public PricingModelEvaluationVetoer[] getPricingModelEvaluationVetoers()

setPricingModelEvaluationVetoers

public void setPricingModelEvaluationVetoers(PricingModelEvaluationVetoer[] pPricingModelEvaluationVetoers)

getPricingModelHolderVetoers

public PricingModelHolderVetoer[] getPricingModelHolderVetoers()

setPricingModelHolderVetoers

public void setPricingModelHolderVetoers(PricingModelHolderVetoer[] pPricingModelHolderVetoers)

getQualifierService

public Qualifier getQualifierService()

setQualifierService

public void setQualifierService(Qualifier pQualifierService)

getPromotionItemDescriptors

public RepositoryItemDescriptor[] getPromotionItemDescriptors()
Returns the promotion item descriptors


setPromotionTools

public void setPromotionTools(PromotionTools pPromotionTools)
Sets property PromotionTools


getPromotionTools

public PromotionTools getPromotionTools()
Returns property PromotionTools


setPricingTools

public void setPricingTools(PricingTools pPricingTools)
Sets property PricingTools


getPricingTools

public PricingTools getPricingTools()
Returns property PricingTools


setScheduler

public void setScheduler(Scheduler pScheduler)
Sets property Scheduler


getScheduler

public Scheduler getScheduler()
Returns property Scheduler


setUpdateSchedule

public void setUpdateSchedule(Schedule pUpdateSchedule)
Sets property UpdateSchedule


getUpdateSchedule

public Schedule getUpdateSchedule()
Returns property UpdateSchedule


setDefaultLocale

public void setDefaultLocale(java.util.Locale pDefaultLocale)
Sets property DefaultLocale


getDefaultLocale

public java.util.Locale getDefaultLocale()
Returns property DefaultLocale


getGlobalPromotions

public java.util.List getGlobalPromotions()
Returns property GlobalPromotions


setPriceInfoClass

public void setPriceInfoClass(java.lang.Class pPriceInfoClass)
Sets property PriceInfoClass


getPriceInfoClass

public java.lang.Class getPriceInfoClass()
Returns property PriceInfoClass


setPricingModelComparator

public void setPricingModelComparator(java.util.Comparator pPricingModelComparator)
Sets property PricingModelComparator


getPricingModelComparator

public java.util.Comparator getPricingModelComparator()
Returns property PricingModelComparator


setClosenessQualifierEvaluator

public void setClosenessQualifierEvaluator(ClosenessQualifierEvaluator pClosenessQualifierEvaluator)
Component that evaluates if an order or item meets the closenessQualifiers for relevant promotions

Parameters:
pClosenessQualifierEvaluator - the component that evaluates if an order or item meets the closenessQualifiers for relevant promotions

getClosenessQualifierEvaluator

public ClosenessQualifierEvaluator getClosenessQualifierEvaluator()
Returns:
the component that evaluates if an order or item meets the closenessQualifiers for relevant promotions

setPricingModelProperties

public void setPricingModelProperties(PricingModelProperties pPricingModelProperties)

getPricingModelProperties

public PricingModelProperties getPricingModelProperties()
Returns a bean that contains properties for a PricingModel


setProfileProperties

public void setProfileProperties(java.lang.String[] pProfileProperties)

getProfileProperties

public java.lang.String[] getProfileProperties()
The profile properties to inspect for pricing models


setPromotionsRepository

public void setPromotionsRepository(Repository pPromotionsRepository)

getPromotionsRepository

public Repository getPromotionsRepository()
The repository which contains the promotions


setPromotionItemTypes

public void setPromotionItemTypes(java.lang.String[] pPromotionItemTypes)
Sets property PromotionItemTypes


getPromotionItemTypes

public java.lang.String[] getPromotionItemTypes()
Returns property PromotionItemTypes


setGlobalPromotionsQuery

public void setGlobalPromotionsQuery(RqlStatement pGlobalPromotionsQuery)
Sets property GlobalPromotionsQuery


getGlobalPromotionsQuery

public RqlStatement getGlobalPromotionsQuery()
Returns property GlobalPromotionsQuery


setGlobalPromotionsSchedulableDate

public void setGlobalPromotionsSchedulableDate(CurrentDate pGlobalPromotionsSchedulableDate)
Sets property GlobalPromotionsSchedulableDate


getGlobalPromotionsSchedulableDate

public CurrentDate getGlobalPromotionsSchedulableDate()
Returns property GlobalPromotionsSchedulableDate


setAlwaysLoadGlobalPromotions

public void setAlwaysLoadGlobalPromotions(boolean pAlwaysLoadGlobalPromotions)
Sets whether or not to always load the global promotions rather than using the cache.

Setting this property to true will ensure the global promotions are loaded from the repository if they haven't expired by the current date and time, i.e. it will not use the globalPromotionsSchedulableDate in the query.

This should be set to true for preview to allow merch users to see the latest promotion changes (see COMMERCE-168402).

Parameters:
pAlwaysLoadGlobalPromotions - boolean defaults to false

getAlwaysLoadGlobalPromotions

public boolean getAlwaysLoadGlobalPromotions()
Gets whether or not to always load the global promotions rather than using the cache.

If this property is true it will ensure the global promotions are loaded from the repository if they haven't expired by the current date and time, i.e. it will not use the globalPromotionsSchedulableDate in the query.

This would be set to true for preview to allow merch users to see the latest promotion changes (see COMMERCE-168402).

Returns:
boolean

findGlobalPromotions

protected java.util.List findGlobalPromotions()
Return the set of global promotions for this pricing engine


loadGlobalPromotions

public void loadGlobalPromotions()
                          throws PricingException
Find and load the global promotions. The global promotions are found through the method findGlobalPromotions. The list returned by this operation is made available through the globalPromotions property.

Throws:
PricingException

doStartService

public void doStartService()
                    throws ServiceException
Loads the global promotions.

Overrides:
doStartService in class GenericService
Throws:
ServiceException - if the Service had a problem starting up

doStopService

public void doStopService()
                   throws ServiceException
Stops the schedule for updating the global promotions

Overrides:
doStopService in class GenericService
Throws:
ServiceException - if an error occurred during the operation

performScheduledTask

public void performScheduledTask(Scheduler pScheduler,
                                 ScheduledJob pJob)
Reload the global promotions

Specified by:
performScheduledTask in interface Schedulable
Parameters:
pScheduler - calling the job
pJob - the ScheduledJob

getCurrencyCode

protected java.lang.String getCurrencyCode(java.util.Locale pLocale)
Return the currency code which should be used for the given locale. If the supplied locale parameter is null, then use the default locale.


getPricingCurrencyCode

protected java.lang.String getPricingCurrencyCode(RepositoryItem pProfile,
                                                  java.lang.String pPriceListPropertyName,
                                                  boolean pUseDefaultPriceList,
                                                  java.util.Map pExtraParameters,
                                                  java.util.Locale pLocale)
Gets the locale currency code for pricing. Gets the locale to use from PricingTools.getPricingLocale method which will try to get it from a price list if available.

Parameters:
pProfile - RepositoryItem profile
pPriceListPropertyName - String name of the price list property in the profile
pUseDefaultPriceList - boolean, true to use the default price list if needed
pExtraParameters - Optional map of extra parameters which may include the price list
pLocale - Locale to use if no price list or default locale is found
Returns:
String currency code to use for this pricing locale

createPriceInfo

protected AmountInfo createPriceInfo()
                              throws PricingException
Returns a new instance of the of the class defined through the priceInfoClass property.

Throws:
PricingException - if there was a problem instantiating the object

getInitialPromotions

protected java.util.List getInitialPromotions(RepositoryItem pProfile)
                                       throws PricingException
Helper method that returns a List of promotions for given a Profile. This is used by the out-of-the-box implementations of the PricingEngine interface for the getPromotions method. Extensions of the various PricingEngines will override the getPromotions method to behave as business requirments dictate.

Parameters:
pProfile - The user's profile from which the engine will extract promotions
Returns:
List of RepositoryItems which represent promotions for use in pricing. The list which is a combination of the global and user specific promotions.
Throws:
PricingException

addPromotionToList

public void addPromotionToList(RepositoryItem pPromotion,
                               java.util.List pPricingModels,
                               RepositoryItem pProfile)
Adds a new promotion to the list of pricing models.

Parameters:
pPromotion -
pPricingModels -
pProfile -
Throws:
PricingException
See Also:
checkAndAddPromotions(Collection, Collection, Date, RepositoryItem)

getUserOnlyPromotions

public java.util.List getUserOnlyPromotions(RepositoryItem pProfile)
                                     throws PricingException
Throws:
PricingException

getPromotions

public java.util.List getPromotions(RepositoryItem pProfile)
                             throws PricingException
Throws:
PricingException

checkAndAddPromotions

protected void checkAndAddPromotions(java.util.Collection pSource,
                                     java.util.Collection pDestination,
                                     java.util.Date pNow,
                                     RepositoryItem pProfile)
Receives a collection of promotionStatus objects which are cycled through to determine which of these promotions has expired, and which should be added to the pricingModels used.


prepareEvaluationVetoers

protected java.util.List<atg.commerce.pricing.PricingEngineService.ValidEvaluationVetoer> prepareEvaluationVetoers(PricingEngineService pPricingEngine,
                                                                                                                   PricingContext pPricingContext,
                                                                                                                   java.util.Map pExtraParametersMap)

Iterates over the configured pricing model evaluation vetoers and calls the prepare method for each.

If a non null object is returned then it is added to the return list of ValidEvaluation Vetoer objects.

Parameters:
pPricingEngine - PricingEngineService that called this vetoer
pPricingContext - PricingContext for this pricing operation
pExtraParametersMap - Map of extra parameters if needed
Returns:
List of ValidVetoer for those vetoers that are valid.

vetoPromotionsForEvaluation

protected java.util.Collection<RepositoryItem> vetoPromotionsForEvaluation(PricingContext pPricingContext,
                                                                           java.util.Map pExtraParametersMap,
                                                                           java.util.Collection<RepositoryItem> pPricingModels)
Validates the passed in promotions against the configured vetoers for evaluation.

Parameters:
pPricingContext - PricingContext for pricing
pExtraParametersMap - Map of extra parameters if needed
pPricingModels - Collection of promotion items
Returns:
Collection of promotion items valid for evaluation

prepareHolderVetoers

protected java.util.List<atg.commerce.pricing.PricingEngineService.ValidHolderVetoer> prepareHolderVetoers(PricingEngineService pPricingEngine,
                                                                                                           RepositoryItem pProfile)

Iterates over the configured pricing model holdr vetoers and calls the prepare method for each.

If a non null object is returned then it is added to the return list of ValidHolderVetoer objects.

Parameters:
pPricingEngine - PricingEngineService that called this vetoer
pProfile - RepositoryItem profile for the holder session
Returns:
List of ValidVetoer for those vetoers that are valid

checkAndMergePromotions

protected void checkAndMergePromotions(java.util.Collection pSource,
                                       java.util.Collection pCheckedMerge,
                                       java.util.Collection pDestination,
                                       java.util.Date pNow,
                                       RepositoryItem pProfile)
Merges together two lists of promotions in the correct sorted order.
This is typically the global and user promotions.
Promotions are vetoed as required.

Note: It is assumed that pCheckedMerge has already been checked e.g. via checkAndAddPromotions.

Parameters:
pSource - - Source collection. It should be pre-sorted but this method will check expiry dates.
pCheckedMerge - Collection to merge into the source. It should be pre-sorted and pre-checked.
pDestination - - Destination Collection for the merge.
pNow - - today
pProfile - - RepositoryItem profile

addPromotion

protected boolean addPromotion(RepositoryItem pPromotion,
                               java.util.Date pNow)
This method determines if the given promotion should qualify for use in determining pricing.

Parameters:
pPromotion - the promotion that should be verified
pNow - the current date
pProfile - the user's profile
Returns:
true if the promotion should be added to the list of promotions which can be used for pricing

isValidItemDescriptor

protected boolean isValidItemDescriptor(RepositoryItem pPromotion)
This method determines if the given promotion's item descriptor matches that of the PricingEngine configured item descriptors, promotionItemDescriptors

Parameters:
pPromotion - the promotion that should be verified
Returns:
true if the promotion matches any of the pricing engine's configured item descriptors

checkPromotionExpiration

protected boolean checkPromotionExpiration(RepositoryItem pPromotion,
                                           java.util.Date pNow)
Return true if the promotion has expired and should be removed from the user's collection of active promotions

Parameters:
pPromotion - the promotion that should be verified
pNow - the current date
pProfile - the user's profile

expirePromotion

protected void expirePromotion(RepositoryItem pPromotion,
                               RepositoryItem pProfile)
Called if checkPromotionExpiration determines that a promotion has expired and should no longer be active. Currently this method calls PromotionTools.expirePromotion.

Parameters:
pProfile - the profile for which a promotion has expired
pPromotion - the promotion which has expired

getCalculatorTypes

public CalculatorInfo[] getCalculatorTypes()
Gets the information for the calculators this pricing engine supports

Returns:
CalculatorInfo[]

getCalculatorForCalculatorType

public java.lang.Object getCalculatorForCalculatorType(java.lang.String pCalculatorType)
                                                throws PricingException
Returns the calculator service for the given type.

Parameters:
pCalculatorType - String type
Returns:
Calculator reference
Throws:
PricingException - if a non-null calculator could not be found

getCalculator

protected java.lang.Object getCalculator(RepositoryItem pPricingModel)
                                  throws PricingException
Return the pricing calculator that should be used for the given promotion. Looks in member variable Map mPricingCalculatorServices for the PricingCalculator refered to by the PricingModel parameter. If the PricingCalculator is not in the Map, it is resolved in Nucleus and then stored in the Map for quick look up.

Parameters:
pPromotion - The promotion to examine for its PricingCalculator
Returns:
The PricingCalculator service found for the promotion
Throws:
PricingException

resolveCalculator

protected java.lang.Object resolveCalculator(java.lang.String pCalcServiceString)
                                      throws PricingException
Resolves the passed in calculator service nucleus path to a service reference. The method uses a cache for efficiency.

Parameters:
pCalcServiceString - String nucleus path to the calculator service
Returns:
Object service reference
Throws:
PricingException - if the service could not be resolved

getAdjustmentPricingModels

protected java.util.List getAdjustmentPricingModels(AmountInfo pPriceInfo)
Gets the pricingModels from the priceInfo's "adjustments" property These are the promotions the order has qualified for, and should not be evaluated for closeness

Parameters:
pPriceInfo - the priceInfo object
Returns:
a List of the pricingModels from the priceInfo's adjustments

getQualifierService

public Qualifier getQualifierService(java.util.Map pExtraParameters)
Gets the Qualifier service to use. First checks the extra parameters map for a Qualifier object with the key EXTRA_PARAM_QUALIFIERSERVICE. If no Qualifier is in the map then it gets the default Qualifier this service is configured with.

Parameters:
pExtraParameters - Map of optional extra parameters. May be null.
Returns:
Qualifier to use.
See Also:
PromotionTools.getQualifierService(RepositoryItem, Map, Qualifier)

getQualifierService

public Qualifier getQualifierService(RepositoryItem pPricingModel,
                                     java.util.Map pExtraParameters)
Gets the Qualifier service to use. First checks the extra parameters map for a Qualifier object with the key EXTRA_PARAM_QUALIFIERSERVICE. If no Qualifier is in the map then it checks the promotion item 'qualifierService' property. If still no Qualifier then it uses the default Qualifier this service is configured with.

Parameters:
pPricingModel - RepositoryItem promotion item to check. May be null.
pExtraParameters - Map of optional extra parameters. May be null.
Returns:
Qualifier to use.
See Also:
PromotionTools.getQualifierService(RepositoryItem, Map, Qualifier)