public abstract class PricingEngineService extends GenericService implements Schedulable
Properties:
globalPromotionsQuery
. Re-running
that query generates a new list of global promotions.
globalPromotionsQuery
is periodically run.
Modifier and Type | Class and Description |
---|---|
protected class |
PricingEngineService.EmptyItemPriceInfo
Internal class used to set up as yet unpriced commerce items used outside
of item pricing.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
static java.lang.String |
ERR_CANNOT_CREATE_VETO_PROMOTION_ANALYSIS_MESSAGE |
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
|
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 |
---|
PricingEngineService() |
Modifier and Type | Method and Description |
---|---|
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 |
applyPromotionProcessing(atg.commerce.pricing.PromotionProcessingComponent[] pPromotionProcessingComponents,
java.util.Collection<RepositoryItem> pPricingModels,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
Apply the given promotion processing components.
|
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 ItemPriceInfo |
createEmptyItemPriceInfo()
Creates a basic ItemPriceInfo to use for commerce items that
have not yet been priced but which are being referenced outside of
item pricing, e.g.
|
protected void |
createMaxCouponsPerOrderLimitExclusionMessage(java.lang.Object[] pSkippedPromotionDetails,
java.util.Map<java.lang.String,atg.web.messaging.UserMessage> pMaxCouponsPerOrderAppMessages,
RepositoryItem pPricingModel,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
Creates a 'Maximum Coupons Per Order' exclusion message but only if the promotion being excluded would have
otherwise qualified (@see #didPromotionQualify).
|
protected AmountInfo |
createPriceInfo()
Returns a new instance of the of the class defined through the
priceInfoClass
property. |
protected void |
createStackingRuleExclusionMessage(java.lang.Object[] pSkippedPromotionDetails,
java.util.Map<java.lang.String,atg.web.messaging.UserMessage> pStackingRuleAppMessages,
RepositoryItem pPricingModel,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
Creates a Stacking Rule exclusion message but only if the promotion being excluded would have otherwise
qualified (@see #didPromotionQualify).
|
protected void |
createVetoPromotionMessage(java.lang.String pVetoReason,
RepositoryItem pPricingModel,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
This method creates a veto promotion message.
|
protected boolean |
didPromotionApply(RepositoryItem pPricingModel,
AmountInfo pPriceInfo,
java.util.Map pExtraParameters)
Returns
true if the promotion applied, false otherwise. |
protected boolean |
didPromotionQualify(RepositoryItem pPricingModel,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
Returns
true if a promotion qualified, false otherwise. |
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 void |
generateMaxCouponsPerOrderInfo(PricingContext pPricingContext,
java.lang.Integer pMaxNumOfCouponsPerOrder,
java.lang.Integer pNumberOfCouponsUsed,
java.util.Map<java.lang.String,atg.web.messaging.UserMessage> pMaxCouponsPerOrderAppMessages,
java.util.Map pExtraParameters)
Generates "max coupons per order" tracking information and exclusion messages based
on the information linked to the applied promotions from pricing engines that have
not been processed.
|
protected void |
generateStackingRuleInfo(PricingContext pPricingContext,
java.util.Map<RepositoryItem,RepositoryItem> pIncludedPromotions,
java.util.Map<RepositoryItem,RepositoryItem> pExcludedPromotions,
java.util.Map<RepositoryItem,RepositoryItem> pExcludedStackingRules,
java.util.Map<RepositoryItem,java.lang.Integer> pStackingRuleUsage,
java.util.Map<java.lang.String,atg.web.messaging.UserMessage> pStackingRuleAppMessages,
java.util.Map pExtraParameters)
Generates stacking rule tracking information and stacking rule exclusion messages based
on the information linked to the applied promotions from pricing engines that have
not been processed.
|
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.util.List<RepositoryItem> |
getAppliedPromotions(AmountInfo pPriceInfo)
Returns a list of applied promotions for the given price info.
|
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.
|
protected java.util.Locale |
getLocale(PricingContext pPricingContext,
java.util.Map pExtraParameters)
Gets the locale to use.
|
protected java.lang.String |
getMaxNoOfCouponsPerOrderLimitReachedMessageIdentifier()
Value for 'Maximum Coupons Per Order' limit reached message identifier.
|
java.lang.Class |
getPriceInfoClass()
Returns property PriceInfoClass
|
protected java.util.List<AmountInfo> |
getPriceInfoDetails(PricingContext pPricingContext,
java.util.Map pExtraParameters)
Returns price info details.
|
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
|
protected java.lang.String |
getStackingRuleOrderLimitReachedMessageIdentifier()
Value for stacking rule order limit reached message identifier.
|
protected java.lang.String |
getStackingRulePromotionExcludedMessageIdentifier()
Value for stacking rule promotion excluded message identifier.
|
Schedule |
getUpdateSchedule()
Returns property UpdateSchedule
|
java.util.List |
getUserOnlyPromotions(RepositoryItem pProfile) |
protected boolean |
isPromotionLinkedToCoupon(java.util.Map pPromotionStatusMap,
RepositoryItem pPricingModel) |
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 void |
pricingComplete(java.util.Map pExtraParameters)
Carry out any required operations after a pricing engine has executed.
|
protected void |
pricingStart(java.util.Map pExtraParameters)
Carry out any required operations prior to a pricing engine executing.
|
protected void |
processCQPromotionAnalysisInformation(java.util.Map pExtraParametersMap)
Helper method used to set closeness qualifier information in the promotion analysis information holder object.
|
protected boolean |
processDidPromotionApply(RepositoryItem pPricingModel,
AmountInfo pPriceInfo,
java.util.Set<RepositoryItem> pPromotionsNotApplied,
boolean pProcessStackingRules,
java.util.Map<RepositoryItem,RepositoryItem> pIncludedPromotions,
java.util.Map<RepositoryItem,RepositoryItem> pExcludedPromotions,
java.util.Map<RepositoryItem,RepositoryItem> pExcludedStackingRules,
java.util.Map<RepositoryItem,java.lang.Integer> pStackingRuleUsage,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
Deprecated.
|
protected boolean |
processDidPromotionApply(RepositoryItem pPricingModel,
AmountInfo pPriceInfo,
java.util.Set<RepositoryItem> pPromotionsNotApplied,
PricingContext pPricingContext,
java.util.Map pExtraParameters)
Processes the applied status of a promotion.
|
protected java.util.List |
removeExpiredPromotions(java.util.List<RepositoryItem> pPricingModels)
Builds up a new list of promotions, none of which will be expired.
|
protected void |
resetEmptyItemPriceInfos(Order pOrder)
Utility method to revert item price infos back to null if they
were temporarily set to use the EmptyItemPriceInfo for pricing.
|
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
|
protected void |
setupMaxCouponsPerOrderCollection(PricingContext pPricingContext,
java.util.Map pExtraParameters)
Sets up the 'max number of coupons per order' info collections:
1.
|
protected void |
setupStackingRuleCollections(PricingContext pPricingContext,
java.util.Map pExtraParameters)
Sets up the stacking rule info collections:
1.
|
void |
setUseMerge(boolean pUseMerge) |
protected java.lang.Object[] |
skipPromotion(PricingContext pPricingContext,
RepositoryItem pPricingModel,
int pMaxNumOfCouponsPerOrder,
int pNumberOfCouponsUsed,
java.util.Map pExtraParameters)
Determines whether or not the given promotion should not be applied.
|
protected java.lang.Object[] |
skipPromotion(PricingContext pPricingContext,
RepositoryItem pPricingModel,
java.util.Map<RepositoryItem,RepositoryItem> pIncludedPromotions,
java.util.Map<RepositoryItem,RepositoryItem> pExcludedPromotions,
java.util.Map<RepositoryItem,RepositoryItem> pExcludedStackingRules,
java.util.Map<RepositoryItem,java.lang.Integer> pStackingRuleUsage,
java.util.Map pExtraParameters)
Determines whether or not the given promotion should not be applied.
|
protected java.lang.Integer |
updateMaxCouponsPerOrderTracking(java.lang.Integer pNumberOfCouponsUsed,
java.util.Map pExtraParameters)
Updates the "maximum coupon per order" tracking information and increments the value of
key atg.commerce.pricing.Constants.NO_OF_COUPONS_USED_IN_ORDER in the extra-parameters
|
protected void |
updateStackingRuleTracking(RepositoryItem pPricingModel,
java.util.Map<RepositoryItem,RepositoryItem> pIncludedPromotions,
java.util.Map<RepositoryItem,RepositoryItem> pExcludedPromotions,
java.util.Map<RepositoryItem,RepositoryItem> pExcludedStackingRules,
java.util.Map<RepositoryItem,java.lang.Integer> pStackingRuleUsage,
java.util.Map pExtraParameters)
Updates the stacking rule tracking information, based upon the details relating to the applied
promotion.
|
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.
|
protected boolean |
wasPromotionSkipped(PricingContext pPricingContext,
RepositoryItem pPricingModel,
int pMaxNumOfCouponsPerOrder,
int pNumberOfCouponsUsed,
java.util.Map<java.lang.String,atg.web.messaging.UserMessage> pMaxCouponsPerOrderAppMessages,
java.util.Map pExtraParameters)
This method determines if a promotion was skipped, based on the "max number of coupons per order" restriction.
|
protected boolean |
wasPromotionSkipped(PricingContext pPricingContext,
RepositoryItem pPricingModel,
java.util.Map<RepositoryItem,RepositoryItem> pIncludedPromotions,
java.util.Map<RepositoryItem,RepositoryItem> pExcludedPromotions,
java.util.Map<RepositoryItem,RepositoryItem> pExcludedStackingRules,
java.util.Map<RepositoryItem,java.lang.Integer> pStackingRuleUsage,
java.util.Map<java.lang.String,atg.web.messaging.UserMessage> pStackingRuleAppMessages,
java.util.Map pExtraParameters)
This method determines if a promotion was skipped, based on the stacking rule exclusion.
|
addLogListener, createAdminServlet, 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 static java.lang.String CLASS_VERSION
public static final java.lang.String EXTRA_PARAM_QUALIFIERSERVICE
public static final java.lang.String ERR_CANNOT_CREATE_VETO_PROMOTION_ANALYSIS_MESSAGE
protected java.util.Map mPricingCalculatorServices
protected java.util.List mGlobalPromotions
public boolean isUseMerge()
If the number of profile based promotions is typically very large it may be more efficient to disable this flag. Defaults to true.
public void setUseMerge(boolean pUseMerge)
public ServiceMap getCalculatorTypeCalculators()
public void setCalculatorTypeCalculators(ServiceMap pCalculatorTypeCalculators)
public PricingModelEvaluationVetoer[] getPricingModelEvaluationVetoers()
public void setPricingModelEvaluationVetoers(PricingModelEvaluationVetoer[] pPricingModelEvaluationVetoers)
public PricingModelHolderVetoer[] getPricingModelHolderVetoers()
public void setPricingModelHolderVetoers(PricingModelHolderVetoer[] pPricingModelHolderVetoers)
public Qualifier getQualifierService()
public void setQualifierService(Qualifier pQualifierService)
public RepositoryItemDescriptor[] getPromotionItemDescriptors()
public void setPromotionTools(PromotionTools pPromotionTools)
public PromotionTools getPromotionTools()
public void setPricingTools(PricingTools pPricingTools)
public PricingTools getPricingTools()
public void setScheduler(Scheduler pScheduler)
public Scheduler getScheduler()
public void setUpdateSchedule(Schedule pUpdateSchedule)
public Schedule getUpdateSchedule()
public void setDefaultLocale(java.util.Locale pDefaultLocale)
public java.util.Locale getDefaultLocale()
public java.util.List getGlobalPromotions()
public void setPriceInfoClass(java.lang.Class pPriceInfoClass)
public java.lang.Class getPriceInfoClass()
public void setPricingModelComparator(java.util.Comparator pPricingModelComparator)
public java.util.Comparator getPricingModelComparator()
public void setClosenessQualifierEvaluator(ClosenessQualifierEvaluator pClosenessQualifierEvaluator)
pClosenessQualifierEvaluator
- the component that evaluates if an order
or item meets the closenessQualifiers for relevant promotionspublic ClosenessQualifierEvaluator getClosenessQualifierEvaluator()
public void setPricingModelProperties(PricingModelProperties pPricingModelProperties)
public PricingModelProperties getPricingModelProperties()
public void setProfileProperties(java.lang.String[] pProfileProperties)
public java.lang.String[] getProfileProperties()
public void setPromotionsRepository(Repository pPromotionsRepository)
public Repository getPromotionsRepository()
public void setPromotionItemTypes(java.lang.String[] pPromotionItemTypes)
public java.lang.String[] getPromotionItemTypes()
public void setGlobalPromotionsQuery(RqlStatement pGlobalPromotionsQuery)
public RqlStatement getGlobalPromotionsQuery()
public void setGlobalPromotionsSchedulableDate(CurrentDate pGlobalPromotionsSchedulableDate)
public CurrentDate getGlobalPromotionsSchedulableDate()
public void setAlwaysLoadGlobalPromotions(boolean pAlwaysLoadGlobalPromotions)
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).
pAlwaysLoadGlobalPromotions
- boolean defaults to falsepublic boolean getAlwaysLoadGlobalPromotions()
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).
protected java.util.List findGlobalPromotions()
public void loadGlobalPromotions() throws PricingException
findGlobalPromotions
. The list returned by this operation
is made available through the globalPromotions
property.PricingException
public void doStartService() throws ServiceException
doStartService
in class GenericService
ServiceException
- if the Service had a problem starting uppublic void doStopService() throws ServiceException
doStopService
in class GenericService
ServiceException
- if an error occurred during the operationpublic void performScheduledTask(Scheduler pScheduler, ScheduledJob pJob)
performScheduledTask
in interface Schedulable
pScheduler
- calling the jobpJob
- the ScheduledJobprotected java.lang.String getCurrencyCode(java.util.Locale pLocale)
protected java.lang.String getPricingCurrencyCode(RepositoryItem pProfile, java.lang.String pPriceListPropertyName, boolean pUseDefaultPriceList, java.util.Map pExtraParameters, java.util.Locale pLocale)
pProfile
- RepositoryItem profilepPriceListPropertyName
- String name of the price list property in the profilepUseDefaultPriceList
- boolean, true to use the default price list if neededpExtraParameters
- Optional map of extra parameters which may include the price listpLocale
- Locale to use if no price list or default locale is foundprotected AmountInfo createPriceInfo() throws PricingException
priceInfoClass
property.PricingException
- if there was a problem instantiating the objectprotected java.util.List getInitialPromotions(RepositoryItem pProfile) throws PricingException
pProfile
- The user's profile from which the engine will extract promotionsPricingException
protected java.util.List removeExpiredPromotions(java.util.List<RepositoryItem> pPricingModels)
pPricingModels
- original list of promotions to work withpublic void addPromotionToList(RepositoryItem pPromotion, java.util.List pPricingModels, RepositoryItem pProfile)
pPromotion
- pPricingModels
- pProfile
- PricingException
checkAndAddPromotions(Collection, Collection, Date, RepositoryItem)
public java.util.List getUserOnlyPromotions(RepositoryItem pProfile) throws PricingException
PricingException
public java.util.List getPromotions(RepositoryItem pProfile) throws PricingException
PricingException
protected void checkAndAddPromotions(java.util.Collection pSource, java.util.Collection pDestination, java.util.Date pNow, RepositoryItem pProfile)
protected void applyPromotionProcessing(atg.commerce.pricing.PromotionProcessingComponent[] pPromotionProcessingComponents, java.util.Collection<RepositoryItem> pPricingModels, PricingContext pPricingContext, java.util.Map pExtraParameters) throws PricingException
pPromotionProcessingComponents
- Array of PromotionProcessingComponent's to invokepPricingContext
- PricingContextpPricingModels
- Collection of PricingModel to processpExtraParameters
- Map of extra parameters, may be nullPricingException
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.
pPricingEngine
- PricingEngineService that called this vetoerpPricingContext
- PricingContext for this pricing operationpExtraParametersMap
- Map of extra parameters if neededprotected java.util.Collection<RepositoryItem> vetoPromotionsForEvaluation(PricingContext pPricingContext, java.util.Map pExtraParametersMap, java.util.Collection<RepositoryItem> pPricingModels)
pPricingContext
- PricingContext for pricingpExtraParametersMap
- Map of extra parameters if neededpPricingModels
- Collection of promotion itemsprotected 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.
pPricingEngine
- PricingEngineService that called this vetoerpProfile
- RepositoryItem profile for the holder sessionprotected void checkAndMergePromotions(java.util.Collection pSource, java.util.Collection pCheckedMerge, java.util.Collection pDestination, java.util.Date pNow, RepositoryItem pProfile)
Note: It is assumed that pCheckedMerge has already been checked e.g. via checkAndAddPromotions.
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
- - todaypProfile
- - RepositoryItem profileprotected boolean addPromotion(RepositoryItem pPromotion, java.util.Date pNow)
pPromotion
- the promotion that should be verifiedpNow
- the current dateprotected boolean isValidItemDescriptor(RepositoryItem pPromotion)
pPromotion
- the promotion that should be verifiedprotected boolean checkPromotionExpiration(RepositoryItem pPromotion, java.util.Date pNow)
pPromotion
- the promotion that should be verifiedpNow
- the current dateprotected void expirePromotion(RepositoryItem pPromotion, RepositoryItem pProfile)
checkPromotionExpiration
determines that a promotion has expired and
should no longer be active. Currently this method calls PromotionTools.expirePromotion.pProfile
- the profile for which a promotion has expiredpPromotion
- the promotion which has expiredpublic CalculatorInfo[] getCalculatorTypes()
public java.lang.Object getCalculatorForCalculatorType(java.lang.String pCalculatorType) throws PricingException
pCalculatorType
- String typePricingException
- if a non-null calculator could not be foundprotected java.lang.Object getCalculator(RepositoryItem pPricingModel) throws PricingException
pPricingModel
- The promotion to examine for its PricingCalculatorPricingException
protected java.lang.Object resolveCalculator(java.lang.String pCalcServiceString) throws PricingException
pCalcServiceString
- String nucleus path to the calculator servicePricingException
- if the service could not be resolvedprotected java.util.List getAdjustmentPricingModels(AmountInfo pPriceInfo)
pPriceInfo
- the priceInfo objectpublic Qualifier getQualifierService(java.util.Map pExtraParameters)
pExtraParameters
- Map of optional extra parameters. May be null.PromotionTools.getQualifierService(RepositoryItem, Map, Qualifier)
public Qualifier getQualifierService(RepositoryItem pPricingModel, java.util.Map pExtraParameters)
pPricingModel
- RepositoryItem promotion item to check. May be null.pExtraParameters
- Map of optional extra parameters. May be null.PromotionTools.getQualifierService(RepositoryItem, Map, Qualifier)
@Deprecated protected boolean processDidPromotionApply(RepositoryItem pPricingModel, AmountInfo pPriceInfo, java.util.Set<RepositoryItem> pPromotionsNotApplied, boolean pProcessStackingRules, java.util.Map<RepositoryItem,RepositoryItem> pIncludedPromotions, java.util.Map<RepositoryItem,RepositoryItem> pExcludedPromotions, java.util.Map<RepositoryItem,RepositoryItem> pExcludedStackingRules, java.util.Map<RepositoryItem,java.lang.Integer> pStackingRuleUsage, PricingContext pPricingContext, java.util.Map pExtraParameters) throws PricingException
pPricingModel
- the promotion being analysedpPriceInfo
- the price info from which to extract all applied promotionspPromotionsNotApplied
- collection used to track promotions that did not applypProcessStackingRules
- boolean indicating if stacking rule information should be processedpIncludedPromotions
- promotions to be includedpExcludedPromotions
- promotions to be excludedpExcludedStackingRules
- stacking rules to be excludedpStackingRuleUsage
- stacking rule usagepPricingContext
- PricingContextpExtraParameters
- where the tracking collections should be createdtrue
if the promotion appliedPricingException
- if there was a problem processing the promotion applied statusprotected boolean processDidPromotionApply(RepositoryItem pPricingModel, AmountInfo pPriceInfo, java.util.Set<RepositoryItem> pPromotionsNotApplied, PricingContext pPricingContext, java.util.Map pExtraParameters) throws PricingException
pPricingModel
- the promotion being analysedpPriceInfo
- the price info from which to extract all applied promotionspPromotionsNotApplied
- collection used to track promotions that did not applypPricingContext
- PricingContextpExtraParameters
- where the tracking collections should be createdtrue
if the promotion appliedPricingException
- if there was a problem processing the promotion applied statusprotected boolean didPromotionApply(RepositoryItem pPricingModel, AmountInfo pPriceInfo, java.util.Map pExtraParameters)
true
if the promotion applied, false
otherwise.
A promotion can be deemed to have been applied if it is found to have caused a pricing
adjustment.pPricingModel
- the promotion currently being evaluatedpPriceInfo
- pricing information for the current itempExtraParameters
- contains the tracking collectionstrue
if the promotion applied, false
otherwiseprotected void setupStackingRuleCollections(PricingContext pPricingContext, java.util.Map pExtraParameters) throws PricingException
pPricingContext
- PricingContext for pricingpExtraParameters
- where the tracking collections should be createdPricingException
- if something went wrongprotected void setupMaxCouponsPerOrderCollection(PricingContext pPricingContext, java.util.Map pExtraParameters) throws PricingException
pPricingContext
- PricingContext for pricingpExtraParameters
- where the tracking collections should be createdPricingException
- if something went wrongprotected void generateMaxCouponsPerOrderInfo(PricingContext pPricingContext, java.lang.Integer pMaxNumOfCouponsPerOrder, java.lang.Integer pNumberOfCouponsUsed, java.util.Map<java.lang.String,atg.web.messaging.UserMessage> pMaxCouponsPerOrderAppMessages, java.util.Map pExtraParameters) throws PricingException
pPricingContext
- PricingContext for pricingpMaxNumOfCouponsPerOrder
- the maximum number of coupons that can be usedpNumberOfCouponsUsed
- the number of coupons used so farpMaxCouponsPerOrderAppMessages
- collection of messages to be sentpExtraParameters
- where the tracking collections should be createdPricingException
- if something went wrongprotected void generateStackingRuleInfo(PricingContext pPricingContext, java.util.Map<RepositoryItem,RepositoryItem> pIncludedPromotions, java.util.Map<RepositoryItem,RepositoryItem> pExcludedPromotions, java.util.Map<RepositoryItem,RepositoryItem> pExcludedStackingRules, java.util.Map<RepositoryItem,java.lang.Integer> pStackingRuleUsage, java.util.Map<java.lang.String,atg.web.messaging.UserMessage> pStackingRuleAppMessages, java.util.Map pExtraParameters) throws PricingException
pPricingContext
- PricingContext for pricingpIncludedPromotions
- promotions to be includedpExcludedPromotions
- promotions to be excludedpExcludedStackingRules
- stacking rules to be excludedpStackingRuleUsage
- stacking rule usagepStackingRuleAppMessages
- collection of messages to be sentpExtraParameters
- where the tracking collections should be createdPricingException
- if something went wrongprotected boolean wasPromotionSkipped(PricingContext pPricingContext, RepositoryItem pPricingModel, java.util.Map<RepositoryItem,RepositoryItem> pIncludedPromotions, java.util.Map<RepositoryItem,RepositoryItem> pExcludedPromotions, java.util.Map<RepositoryItem,RepositoryItem> pExcludedStackingRules, java.util.Map<RepositoryItem,java.lang.Integer> pStackingRuleUsage, java.util.Map<java.lang.String,atg.web.messaging.UserMessage> pStackingRuleAppMessages, java.util.Map pExtraParameters) throws PricingException
true
if the promotion was skipped and false
otherwise.
If a promotion is skipped, an exclusion message may or may not be generated. Messages are only sent that
are relevant to what a user has in their shopping cart.pPricingModel
- a promotionpPricingContext
- PricingContext for pricingpIncludedPromotions
- promotions to be includedpExcludedPromotions
- promotions to be excludedpExcludedStackingRules
- stacking rules to be excludedpStackingRuleUsage
- stacking rule usagepStackingRuleAppMessages
- collection of messages to be sentpExtraParameters
- extra parameterstrue
if the promotion is to be skipped, false
otherwisePricingException
- if something went wrongprotected boolean wasPromotionSkipped(PricingContext pPricingContext, RepositoryItem pPricingModel, int pMaxNumOfCouponsPerOrder, int pNumberOfCouponsUsed, java.util.Map<java.lang.String,atg.web.messaging.UserMessage> pMaxCouponsPerOrderAppMessages, java.util.Map pExtraParameters) throws PricingException
true
if the promotion was skipped and false
otherwise.
If a promotion is skipped, an exclusion message may or may not be generated. Messages are only sent that
are relevant to what a user has in their shopping cart.pPricingContext
- PricingContext for pricingpPricingModel
- a promotionpMaxNumOfCouponsPerOrder
- Maximum number of Promotions that can be used within an order.pNumberOfCouponsUsed
- the number of coupons already used during this pricing operation.pMaxCouponsPerOrderAppMessages
- collection of messages to be sentpExtraParameters
- extra parameterstrue
if the promotion is to be skipped, false
otherwisePricingException
- if something went wrongprotected boolean isPromotionLinkedToCoupon(java.util.Map pPromotionStatusMap, RepositoryItem pPricingModel)
pPromotionStatusMap
- A map of coupon-linked promotions to the corresponding promotion-statuspPricingModel
- Promotion in scopeprotected void updateStackingRuleTracking(RepositoryItem pPricingModel, java.util.Map<RepositoryItem,RepositoryItem> pIncludedPromotions, java.util.Map<RepositoryItem,RepositoryItem> pExcludedPromotions, java.util.Map<RepositoryItem,RepositoryItem> pExcludedStackingRules, java.util.Map<RepositoryItem,java.lang.Integer> pStackingRuleUsage, java.util.Map pExtraParameters)
pPricingModel
- the applied promotionpIncludedPromotions
- promotions to be includedpExcludedPromotions
- promotions to be excludedpExcludedStackingRules
- stacking rules to be excludedpStackingRuleUsage
- stacking rule usagepExtraParameters
- contains the tracking collectionsprotected java.lang.Integer updateMaxCouponsPerOrderTracking(java.lang.Integer pNumberOfCouponsUsed, java.util.Map pExtraParameters)
pNumberOfCouponsUsed
- The number of coupons used in order earlierpExtraParameters
- the extra parametersprotected java.lang.Object[] skipPromotion(PricingContext pPricingContext, RepositoryItem pPricingModel, java.util.Map<RepositoryItem,RepositoryItem> pIncludedPromotions, java.util.Map<RepositoryItem,RepositoryItem> pExcludedPromotions, java.util.Map<RepositoryItem,RepositoryItem> pExcludedStackingRules, java.util.Map<RepositoryItem,java.lang.Integer> pStackingRuleUsage, java.util.Map pExtraParameters)
pPricingContext
- PricingContext for pricingpPricingModel
- the promotion currently being evaluatedpIncludedPromotions
- promotions to be includedpExcludedPromotions
- promotions to be excludedpExcludedStackingRules
- stacking rules to be excludedpStackingRuleUsage
- stacking rule usagepExtraParameters
- contains the tracking collectionsnull
if this promotion should not be skippedprotected java.lang.Object[] skipPromotion(PricingContext pPricingContext, RepositoryItem pPricingModel, int pMaxNumOfCouponsPerOrder, int pNumberOfCouponsUsed, java.util.Map pExtraParameters)
pPricingContext
- PricingContext for pricingpPricingModel
- the promotion currently being evaluatedpMaxNumOfCouponsPerOrder
- The maximum number of coupons per order.pNumberOfCouponsUsed
- The number of coupons already used during this pricing operationpExtraParameters
- contains the evaluation informationnull
if this promotion should not be skippedprotected java.lang.String getStackingRuleOrderLimitReachedMessageIdentifier()
protected java.lang.String getMaxNoOfCouponsPerOrderLimitReachedMessageIdentifier()
protected java.lang.String getStackingRulePromotionExcludedMessageIdentifier()
protected java.util.List<RepositoryItem> getAppliedPromotions(AmountInfo pPriceInfo)
pPriceInfo
- the price info from which to extract all applied promotionsprotected void createStackingRuleExclusionMessage(java.lang.Object[] pSkippedPromotionDetails, java.util.Map<java.lang.String,atg.web.messaging.UserMessage> pStackingRuleAppMessages, RepositoryItem pPricingModel, PricingContext pPricingContext, java.util.Map pExtraParameters) throws PricingException
pSkippedPromotionDetails
- details of a skipped/excluded promotionpStackingRuleAppMessages
- collection of messages to be sentpPricingModel
- promotion being evaluatedpPricingContext
- pricing contextpExtraParameters
- extra parametersPricingException
- if something went wrongprotected void createVetoPromotionMessage(java.lang.String pVetoReason, RepositoryItem pPricingModel, PricingContext pPricingContext, java.util.Map pExtraParameters)
pVetoReason
- the reason to veto the promotionpPricingModel
- promotion which is being vetoedpPricingContext
- pricing contextpExtraParameters
- extra parameters map which holds the miscellaneous informationprotected void createMaxCouponsPerOrderLimitExclusionMessage(java.lang.Object[] pSkippedPromotionDetails, java.util.Map<java.lang.String,atg.web.messaging.UserMessage> pMaxCouponsPerOrderAppMessages, RepositoryItem pPricingModel, PricingContext pPricingContext, java.util.Map pExtraParameters) throws PricingException
pSkippedPromotionDetails
- details of a skipped/excluded promotionpMaxCouponsPerOrderAppMessages
- collection of messages to be sentpPricingModel
- promotion being evaluatedpPricingContext
- pricing contextpExtraParameters
- extra parametersPricingException
- if something went wrongprotected void processCQPromotionAnalysisInformation(java.util.Map pExtraParametersMap) throws PricingException
pExtraParametersMap
- any extra information that might need to be passed inPricingException
- if the condition and offer information could not be processedprotected java.util.Locale getLocale(PricingContext pPricingContext, java.util.Map pExtraParameters)
pPricingContext
- PricingContext which may contain the localepExtraParameters
- Map of extra parameters (optional)protected boolean didPromotionQualify(RepositoryItem pPricingModel, PricingContext pPricingContext, java.util.Map pExtraParameters) throws PricingException
true
if a promotion qualified, false
otherwise.
The default for this method is true
. This method should be overridden in
the pricing engines to compute a more accurate answer.
pPricingModel
- promotion to checkpPricingContext
- PricingContextpExtraParameters
- Map of extra parameters, may be nulltrue
if the promotion qualified, false
otherwisePricingException
- if something went wrongprotected java.util.List<AmountInfo> getPriceInfoDetails(PricingContext pPricingContext, java.util.Map pExtraParameters)
pPricingContext
- PricingContextpExtraParameters
- Map of extra parameters, may be nulltrue
if the promotion qualified, false
otherwisePricingException
- if something went wrongprotected void pricingStart(java.util.Map pExtraParameters)
pExtraParameters
- Map of extra parameters, may be nullprotected void pricingComplete(java.util.Map pExtraParameters)
pExtraParameters
- Map of extra parameters, may be nullprotected ItemPriceInfo createEmptyItemPriceInfo()
Care should be taken to only use this ItemPriceInfo temporarily for pricing and not to persist it with the order.
protected void resetEmptyItemPriceInfos(Order pOrder)
pOrder
- Order containing commerce items