public class PromotionsManager extends GeneratedPromotionsManager
updatePromotions(java.util.Collection<de.hybris.platform.promotions.jalo.PromotionGroup>, de.hybris.platform.jalo.order.AbstractOrder) methods to evaluate the promotions that can be applied to a cart or order.getPromotionResults(de.hybris.platform.jalo.order.AbstractOrder) methods to retrieve the promotions calculated for an order.getProductPromotions(java.util.Collection<de.hybris.platform.promotions.jalo.PromotionGroup>, de.hybris.platform.jalo.product.Product) methods to retrieve the promotions that a Product can be part of.
cleanupCart(de.hybris.platform.jalo.order.Cart) method to removed these items.getProductPromotions(java.util.Collection<de.hybris.platform.promotions.jalo.PromotionGroup>, de.hybris.platform.jalo.product.Product),
updatePromotions(java.util.Collection<de.hybris.platform.promotions.jalo.PromotionGroup>, de.hybris.platform.jalo.order.AbstractOrder),
getPromotionResults(de.hybris.platform.jalo.order.AbstractOrder),
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
PromotionsManager.AutoApplyMode
Which changes should the promotions manager apply to an order automatically.
|
static class |
PromotionsManager.RestrictionSetResult
Class representing the result of evaluating a set of restrictions.
|
Extension.RestrictedLanguagesProvider, Extension.RightsProviderManager.GenericManagerSingletonCreator, Manager.ManagerSingletonCreatorCATEGORYPROMOTIONRELATION_MARKMODIFIED, CATEGORYPROMOTIONRELATION_SRC_ORDERED, CATEGORYPROMOTIONRELATION_TGT_ORDERED, DEFAULT_INITIAL_ATTRIBUTES, ORDER2PROMOTIONRESULTSRELATIONALLPROMOTIONRESULTSHANDLER, PRODUCTPROMOTIONRELATION_MARKMODIFIED, PRODUCTPROMOTIONRELATION_SRC_ORDERED, PRODUCTPROMOTIONRELATION_TGT_ORDERED| Constructor and Description |
|---|
PromotionsManager() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
autoApplyApplies(PromotionsManager.AutoApplyMode productPromotionMode,
PromotionsManager.AutoApplyMode orderPromotionMode,
AbstractPromotion promotion) |
protected java.lang.String |
buildQueryForDistinctProductPromotionQuery(Product product,
SessionContext ctx,
java.util.Map<java.lang.String,java.lang.Object> args) |
void |
cleanupCart(Cart cart)
Delete the the stored promotion results for a Cart.
|
void |
cleanupCart(SessionContext ctx,
Cart cart)
Delete the the stored promotion results for a Cart.
|
void |
cleanupOrphanedResults()
Delete any promotion results that are orphaned.
|
void |
cleanupOrphanedResults(SessionContext ctx)
Delete any promotion results that are orphaned.
|
void |
createEssentialData(java.util.Map params,
JspContext jspc)
Implement this method to create initial objects.
|
PromotionGroup |
createPromotionGroup(SessionContext ctx,
java.lang.String identifier)
Create a new
PromotionGroup instance. |
PromotionNullAction |
createPromotionNullAction(SessionContext ctx)
Create a new
PromotionNullAction instance. |
PromotionOrderAddFreeGiftAction |
createPromotionOrderAddFreeGiftAction(SessionContext ctx,
Product product,
PromotionResult result)
Create a new
PromotionOrderAddFreeGiftAction instance. |
PromotionOrderAdjustTotalAction |
createPromotionOrderAdjustTotalAction(SessionContext ctx,
double totalAdjustment)
Create a new
PromotionOrderAdjustTotalAction instance. |
PromotionOrderChangeDeliveryModeAction |
createPromotionOrderChangeDeliveryModeAction(SessionContext ctx,
DeliveryMode deliveryMode)
Create a new
PromotionOrderChangeDeliveryModeAction instance. |
PromotionOrderEntryAdjustAction |
createPromotionOrderEntryAdjustAction(SessionContext ctx,
AbstractOrderEntry entry,
double adjustment)
This does not store the order entry but records its information so that a similar order entry with the same
product and quantity can be located in this and other orders.
|
PromotionOrderEntryAdjustAction |
createPromotionOrderEntryAdjustAction(SessionContext ctx,
AbstractOrderEntry entry,
long quantity,
double adjustment)
Create a new
PromotionOrderEntryAdjustAction instance. |
PromotionOrderEntryAdjustAction |
createPromotionOrderEntryAdjustAction(SessionContext ctx,
Product product,
long quantity,
double adjustment)
Deprecated.
Since 4.4 use
createPromotionOrderEntryAdjustAction(SessionContext, AbstractOrderEntry, long, double),
see PRO-75
Create a new PromotionOrderEntryAdjustAction instance. |
PromotionOrderEntryConsumed |
createPromotionOrderEntryConsumed(SessionContext ctx,
java.lang.String code,
AbstractOrderEntry orderEntry,
long quantity)
Create a new
PromotionOrderEntryConsumed instance. |
PromotionOrderEntryConsumed |
createPromotionOrderEntryConsumed(SessionContext ctx,
java.lang.String code,
AbstractOrderEntry orderEntry,
long quantity,
double adjustedUnitPrice)
Create a new
PromotionOrderEntryConsumed instance. |
PromotionPriceRow |
createPromotionPriceRow(Currency currency,
double price)
Create a new
PromotionPriceRow instance. |
PromotionPriceRow |
createPromotionPriceRow(SessionContext ctx,
Currency currency,
double price)
Create a new
PromotionPriceRow instance. |
PromotionQuantityAndPricesRow |
createPromotionQuantityAndPricesRow(SessionContext ctx,
long quantity,
java.util.Collection<PromotionPriceRow> prices)
Create a new
PromotionQuantityAndPricesRow instance. |
PromotionResult |
createPromotionResult(SessionContext ctx,
AbstractPromotion promotion,
AbstractOrder order,
float certainty)
Create a new
PromotionResult instance. |
protected void |
deleteStoredPromotionResults(SessionContext ctx,
AbstractOrder order,
boolean undoActions)
Delete the the stored promotion results for an AbstractOrder.
|
protected java.util.List<PromotionResult> |
evaluatePromotion(SessionContext ctx,
PromotionEvaluationContext promoContext,
AbstractPromotion promotion) |
PromotionsManager.RestrictionSetResult |
evaluateRestrictions(SessionContext ctx,
java.util.List<Product> products,
AbstractOrder order,
AbstractPromotion promo,
java.util.Date date)
Evaluate all of the restrictions for a given promotion and return a result object containing the allowed items.
|
PromotionsManager.RestrictionSetResult |
evaluateRestrictions(SessionContext ctx,
java.util.List<Product> products,
AbstractOrder order,
java.util.Collection<AbstractPromotionRestriction> restrictions,
java.util.Date date)
Evaluate the specified restrictions and return a result object containing the allowed items.
|
<T extends AbstractPromotion> |
filterPromotionsByRestrictions(SessionContext ctx,
java.util.List<T> allPromotions,
Product product,
java.util.Date date)
Filter a list of promotions by their restrictions
|
static java.util.List<AbstractPromotion> |
findOrderAndProductPromotionsSortByPriority(SessionContext ctx,
JaloSession jaloSession,
java.util.Collection<PromotionGroup> promotionGroups,
java.util.Collection<Product> products,
java.util.Date date)
Find all promotions that can be evaluated on the list of product specified.
|
protected static void |
fixupVouchersReapplyVouchers(SessionContext ctx,
AbstractOrder order,
java.util.List<Voucher> vouchers)
Method to fixup the vouchers applied to the order.
|
protected static java.util.List<Voucher> |
fixupVouchersRemoveVouchers(SessionContext ctx,
AbstractOrder order)
Method to fixup the vouchers applied to the order.
|
static java.util.Collection<Product> |
getBaseProductsForOrder(SessionContext ctx,
AbstractOrder order)
Get the list of products and base products in the order.
|
protected ComposedType |
getComposedType(java.lang.Class aClass)
Lookup a composed type for a class
|
PromotionGroup |
getDefaultPromotionGroup()
Lookup the default promotion group created by the promotions extension.
|
PromotionGroup |
getDefaultPromotionGroup(SessionContext ctx)
Lookup the default promotion group created by the promotions extension.
|
static PromotionsManager |
getInstance()
Get the instance of this manager.
|
protected SessionContext |
getLanguageNeutralSessionContext()
Create a language neutral session context
|
java.util.List<OrderPromotion> |
getOrderPromotions(java.util.Collection<PromotionGroup> promotionGroups)
Get the ordered list of
OrderPromotion instances. |
java.util.List<OrderPromotion> |
getOrderPromotions(java.util.Collection<PromotionGroup> promotionGroups,
boolean evaluateRestrictions)
Get the ordered list of
OrderPromotion instances. |
java.util.List<OrderPromotion> |
getOrderPromotions(java.util.Collection<PromotionGroup> promotionGroups,
boolean evaluateRestrictions,
java.util.Date date)
Get the ordered list of
OrderPromotion instances. |
java.util.List<OrderPromotion> |
getOrderPromotions(java.util.Collection<PromotionGroup> promotionGroups,
boolean evaluateRestrictions,
Product product)
Get the ordered list of
OrderPromotion instances. |
java.util.List<OrderPromotion> |
getOrderPromotions(java.util.Collection<PromotionGroup> promotionGroups,
boolean evaluateRestrictions,
Product product,
java.util.Date date)
Get the ordered list of
OrderPromotion instances. |
java.util.List<OrderPromotion> |
getOrderPromotions(java.util.Collection<PromotionGroup> promotionGroups,
java.util.Date date)
Get the ordered list of
OrderPromotion instances. |
java.util.List<OrderPromotion> |
getOrderPromotions(java.util.Collection<PromotionGroup> promotionGroups,
Product product)
Get the ordered list of
OrderPromotion instances. |
java.util.List<OrderPromotion> |
getOrderPromotions(java.util.Collection<PromotionGroup> promotionGroups,
Product product,
java.util.Date date)
Get the ordered list of
OrderPromotion instances. |
java.util.List<OrderPromotion> |
getOrderPromotions(SessionContext ctx,
java.util.Collection<PromotionGroup> promotionGroups,
boolean evaluateRestrictions,
Product product,
java.util.Date date)
Get the ordered list of
OrderPromotion instances. |
java.util.List<ProductPromotion> |
getProductPromotions(java.util.Collection<PromotionGroup> promotionGroups,
Product product)
Get the ordered list of
ProductPromotion instances that are related to the Product specified. |
java.util.List<ProductPromotion> |
getProductPromotions(java.util.Collection<PromotionGroup> promotionGroups,
Product product,
boolean evaluateRestrictions,
java.util.Date date)
Get the ordered list of
ProductPromotion instances that are related to the Product specified. |
java.util.List<ProductPromotion> |
getProductPromotions(SessionContext ctx,
java.util.Collection<PromotionGroup> promotionGroups,
Product product,
boolean evaluateRestrictions,
java.util.Date date)
Get the ordered list of
ProductPromotion instances that are related to the Product specified. |
PromotionGroup |
getPromotionGroup(java.lang.String identifier)
Lookup a promotion group with the given identifier.
|
PromotionOrderResults |
getPromotionResults(AbstractOrder order)
Get the promotion results for the specified order.
|
PromotionOrderResults |
getPromotionResults(SessionContext ctx,
AbstractOrder order)
Get the promotion results for the specified order.
|
PromotionOrderResults |
getPromotionResults(SessionContext ctx,
java.util.Collection<PromotionGroup> promotionGroups,
AbstractOrder order,
boolean evaluateRestrictions,
PromotionsManager.AutoApplyMode productPromotionMode,
PromotionsManager.AutoApplyMode orderPromotionMode,
java.util.Date date)
Get the promotion results for the specified order.
|
protected java.util.List<PromotionResult> |
getPromotionResultsInternal(SessionContext ctx,
AbstractOrder order)
Get the list of promotion results for the specified order.
|
protected void |
initialiseDefaultLocalisedValues(SessionContext languageNeutralSessionContext,
ComposedType type)
Set default values for localized attributes on the type specified.
|
protected void |
initialiseDefaultLocalisedValues(SessionContext languageNeutralSessionContext,
java.util.Set<ComposedType> types)
Set the default values on the set of types specified.
|
protected boolean |
keepApplied(PromotionsManager.AutoApplyMode productPromotionMode,
PromotionsManager.AutoApplyMode orderPromotionMode,
AbstractPromotion promotion,
boolean autoApply) |
protected static java.lang.String |
makeActionGUID()
Create a new unique string to identify an action instance.
|
void |
notifyInitializationEnd(java.util.Map<java.lang.String,java.lang.String> params,
JspContext ctx) |
void |
notifyInitializationStart(java.util.Map<java.lang.String,java.lang.String> params,
JspContext ctx) |
void |
transferPromotionsToOrder(AbstractOrder source,
Order target,
boolean onlyTransferAppliedPromotions)
Transfer the promotions applied to a cart to a new order.
|
void |
transferPromotionsToOrder(SessionContext ctx,
AbstractOrder source,
Order target,
boolean onlyTransferAppliedPromotions)
Transfer the promotions applied to a cart to a new order.
|
PromotionOrderResults |
updatePromotions(java.util.Collection<PromotionGroup> promotionGroups,
AbstractOrder order)
Update the promotions on the specified
AbstractOrder object. |
PromotionOrderResults |
updatePromotions(SessionContext ctx,
java.util.Collection<PromotionGroup> promotionGroups,
AbstractOrder order)
Update the promotions on the specified
AbstractOrder object. |
PromotionOrderResults |
updatePromotions(SessionContext ctx,
java.util.Collection<PromotionGroup> promotionGroups,
AbstractOrder order,
boolean evaluateRestrictions,
PromotionsManager.AutoApplyMode productPromotionMode,
PromotionsManager.AutoApplyMode orderPromotionMode,
java.util.Date date)
Update the promotions on the specified
AbstractOrder object. |
protected PromotionOrderResults |
updatePromotionsNotThreadSafe(SessionContext ctx,
java.util.Collection<PromotionGroup> promotionGroups,
AbstractOrder order,
boolean evaluateRestrictions,
PromotionsManager.AutoApplyMode productPromotionMode,
PromotionsManager.AutoApplyMode orderPromotionMode,
java.util.Date date) |
addToAllPromotionResults, addToAllPromotionResults, addToPromotions, addToPromotions, addToPromotions, addToPromotions, createAbstractPromotionAction, createAbstractPromotionAction, createAbstractPromotionRestriction, createAbstractPromotionRestriction, createCachedPromotionNullAction, createCachedPromotionNullAction, createCachedPromotionOrderAddFreeGiftAction, createCachedPromotionOrderAddFreeGiftAction, createCachedPromotionOrderAdjustTotalAction, createCachedPromotionOrderAdjustTotalAction, createCachedPromotionOrderChangeDeliveryModeAction, createCachedPromotionOrderChangeDeliveryModeAction, createCachedPromotionOrderEntryAdjustAction, createCachedPromotionOrderEntryAdjustAction, createCachedPromotionOrderEntryConsumed, createCachedPromotionOrderEntryConsumed, createCachedPromotionResult, createCachedPromotionResult, createOrderPromotion, createOrderPromotion, createOrderThresholdChangeDeliveryModePromotion, createOrderThresholdChangeDeliveryModePromotion, createOrderThresholdDiscountPromotion, createOrderThresholdDiscountPromotion, createOrderThresholdFreeGiftPromotion, createOrderThresholdFreeGiftPromotion, createOrderThresholdFreeVoucherPromotion, createOrderThresholdFreeVoucherPromotion, createOrderThresholdPerfectPartnerPromotion, createOrderThresholdPerfectPartnerPromotion, createProductBOGOFPromotion, createProductBOGOFPromotion, createProductBundlePromotion, createProductBundlePromotion, createProductFixedPricePromotion, createProductFixedPricePromotion, createProductMultiBuyPromotion, createProductMultiBuyPromotion, createProductOneToOnePerfectPartnerPromotion, createProductOneToOnePerfectPartnerPromotion, createProductPercentageDiscountPromotion, createProductPercentageDiscountPromotion, createProductPerfectPartnerBundlePromotion, createProductPerfectPartnerBundlePromotion, createProductPerfectPartnerPromotion, createProductPerfectPartnerPromotion, createProductPromotion, createProductPromotion, createProductSteppedMultiBuyPromotion, createProductSteppedMultiBuyPromotion, createPromotionGroup, createPromotionGroup, createPromotionNullAction, createPromotionNullAction, createPromotionOrderAddFreeGiftAction, createPromotionOrderAddFreeGiftAction, createPromotionOrderAdjustTotalAction, createPromotionOrderAdjustTotalAction, createPromotionOrderChangeDeliveryModeAction, createPromotionOrderChangeDeliveryModeAction, createPromotionOrderEntryAdjustAction, createPromotionOrderEntryAdjustAction, createPromotionOrderEntryConsumed, createPromotionOrderEntryConsumed, createPromotionPriceRow, createPromotionPriceRow, createPromotionProductRestriction, createPromotionProductRestriction, createPromotionQuantityAndPricesRow, createPromotionQuantityAndPricesRow, createPromotionResult, createPromotionResult, createPromotionUserRestriction, createPromotionUserRestriction, getAllPromotionResults, getAllPromotionResults, getDefaultAttributeModes, getName, getPreviousDeliveryMode, getPreviousDeliveryMode, getPromotions, getPromotions, getPromotions, getPromotions, getPromotionsCount, getPromotionsCount, getPromotionsCount, getPromotionsCount, removeFromAllPromotionResults, removeFromAllPromotionResults, removeFromPromotions, removeFromPromotions, removeFromPromotions, removeFromPromotions, setAllPromotionResults, setAllPromotionResults, setPreviousDeliveryMode, setPreviousDeliveryMode, setPromotions, setPromotions, setPromotions, setPromotionscheckBeforeItemRemoval, createProjectData, createSampleData, getCreatorDescription, getCreatorName, getCreatorParameterDefault, getCreatorParameterNames, getCreatorParameterPossibleValues, getRemote, isCreatorDisabled, notifyItemRemoval, onFirstSessionCreation, writeReplaceafterItemCreation, beforeItemCreation, destroy, extractNonRequiredRemoteFromItem, extractRequiredRemoteFromItem, getAllValuesSessionContext, getAttribute, getAttributeMap, getFirstItemByAttribute, getFirstItemByAttribute, getRemoteManagerClass, getSession, getSingletonManagerInstance, getTenant, getTransientObject, getTransientObjectMap, init, setAttribute, setTenant, setTransientObject, wrappublic void notifyInitializationStart(java.util.Map<java.lang.String,java.lang.String> params,
JspContext ctx)
notifyInitializationStart in class Extensionpublic void notifyInitializationEnd(java.util.Map<java.lang.String,java.lang.String> params,
JspContext ctx)
notifyInitializationEnd in class Extensionpublic static PromotionsManager getInstance()
public void createEssentialData(java.util.Map params,
JspContext jspc)
throws java.lang.Exception
createEssentialData in class Extensionparams - the parameters provided by user for creation of objects for the extensionjspc - the jsp context; you can use it to write progress information to the jsp page during creationjava.lang.Exception - if something goes wrongprotected SessionContext getLanguageNeutralSessionContext()
protected void initialiseDefaultLocalisedValues(SessionContext languageNeutralSessionContext, java.util.Set<ComposedType> types)
languageNeutralSessionContext - - instance of SessionContexttypes - - set of composed type instancesprotected void initialiseDefaultLocalisedValues(SessionContext languageNeutralSessionContext, ComposedType type)
languageNeutralSessionContext - - instance of SessionContexttype - The type to localize attributes onprotected ComposedType getComposedType(java.lang.Class aClass)
public final java.util.List<ProductPromotion> getProductPromotions(java.util.Collection<PromotionGroup> promotionGroups, Product product)
ProductPromotion instances that are related to the Product specified.promotionGroups - The promotion groups to evaluateproduct - The product that the promotions are related toProductPromotion related to the Product specifiedpublic final java.util.List<ProductPromotion> getProductPromotions(java.util.Collection<PromotionGroup> promotionGroups, Product product, boolean evaluateRestrictions, java.util.Date date)
ProductPromotion instances that are related to the Product specified.promotionGroups - The promotion groups to evaluateproduct - The product that the promotions are related toevaluateRestrictions - Flag, pass false to ignore any restrictions specified on the promotions, pass true to observe the
restrictions.date - The date to check for promotions, typically the current dateProductPromotion related to the Product specifiedpublic java.util.List<ProductPromotion> getProductPromotions(SessionContext ctx, java.util.Collection<PromotionGroup> promotionGroups, Product product, boolean evaluateRestrictions, java.util.Date date)
ProductPromotion instances that are related to the Product specified.ctx - The session contextpromotionGroups - The promotion groups to evaluateproduct - The product that the promotions are related toevaluateRestrictions - Flag, pass false to ignore any restrictions specified on the promotions, pass true to observe the
restrictions.date - The date to check for promotions, typically the current dateProductPromotion related to the Product specifiedprotected java.lang.String buildQueryForDistinctProductPromotionQuery(Product product, SessionContext ctx, java.util.Map<java.lang.String,java.lang.Object> args)
public java.util.List<OrderPromotion> getOrderPromotions(java.util.Collection<PromotionGroup> promotionGroups)
OrderPromotion instances.promotionGroups - The promotion groups to evaluateOrderPromotionpublic java.util.List<OrderPromotion> getOrderPromotions(java.util.Collection<PromotionGroup> promotionGroups, java.util.Date date)
OrderPromotion instances.promotionGroups - The promotion groups to evaluatedate - The date to check for promotions, typically the current dateOrderPromotionpublic java.util.List<OrderPromotion> getOrderPromotions(java.util.Collection<PromotionGroup> promotionGroups, Product product)
OrderPromotion instances.promotionGroups - The promotion groups to evaluateproduct - The product to pass to restrictionsOrderPromotionpublic java.util.List<OrderPromotion> getOrderPromotions(java.util.Collection<PromotionGroup> promotionGroups, Product product, java.util.Date date)
OrderPromotion instances.promotionGroups - The promotion groups to evaluateproduct - The product to pass to restrictionsdate - The date to check for promotions, typically the current dateOrderPromotionpublic java.util.List<OrderPromotion> getOrderPromotions(java.util.Collection<PromotionGroup> promotionGroups, boolean evaluateRestrictions)
OrderPromotion instances.promotionGroups - The promotion groups to evaluateevaluateRestrictions - Flag, pass false to ignore any restrictions specified on the promotions, pass true to observe the
restrictions.OrderPromotionpublic java.util.List<OrderPromotion> getOrderPromotions(java.util.Collection<PromotionGroup> promotionGroups, boolean evaluateRestrictions, java.util.Date date)
OrderPromotion instances.promotionGroups - The promotion groups to evaluateevaluateRestrictions - Flag, pass false to ignore any restrictions specified on the promotions, pass true to observe the
restrictions.date - The date to check for promotions, typically the current dateOrderPromotionpublic java.util.List<OrderPromotion> getOrderPromotions(java.util.Collection<PromotionGroup> promotionGroups, boolean evaluateRestrictions, Product product)
OrderPromotion instances.promotionGroups - The promotion groups to evaluateevaluateRestrictions - Flag, pass false to ignore any restrictions specified on the promotions, pass true to observe the
restrictions.product - The product to pass to restrictions if evaluateRestrictions is trueOrderPromotionpublic java.util.List<OrderPromotion> getOrderPromotions(java.util.Collection<PromotionGroup> promotionGroups, boolean evaluateRestrictions, Product product, java.util.Date date)
OrderPromotion instances.promotionGroups - The promotion groups to evaluateevaluateRestrictions - Flag, pass false to ignore any restrictions specified on the promotions, pass true to observe the
restrictions.product - The product to pass to restrictions if evaluateRestrictions is truedate - The date to check for promotions, typically the current dateOrderPromotionpublic java.util.List<OrderPromotion> getOrderPromotions(SessionContext ctx, java.util.Collection<PromotionGroup> promotionGroups, boolean evaluateRestrictions, Product product, java.util.Date date)
OrderPromotion instances.ctx - The session contextpromotionGroups - The promotion groups to evaluateevaluateRestrictions - Flag, pass false to ignore any restrictions specified on the promotions, pass true to observe the
restrictions.product - The product to pass to restrictions if evaluateRestrictions is truedate - The date to check for promotions, typically the current dateOrderPromotionpublic <T extends AbstractPromotion> java.util.List<T> filterPromotionsByRestrictions(SessionContext ctx, java.util.List<T> allPromotions, Product product, java.util.Date date)
allPromotions - The promotions list to filterproduct - Optional product to pass when evaluating restrictionsdate - The restriction datepublic final PromotionOrderResults updatePromotions(java.util.Collection<PromotionGroup> promotionGroups, AbstractOrder order)
AbstractOrder object.
This method will automatically apply all possible product promotional updates to the cart, but not apply order
level promotions. Any previously applied order level promotions will remain applied. Promotions are evaluated at
the current system time.
The promotion results are stored in the database and the same PromotionOrderResults can be obtained later
by calling getPromotionResults(de.hybris.platform.jalo.order.AbstractOrder).promotionGroups - The promotion groups to evaluateorder - The order object to update with the results of the promotionsupdatePromotions(SessionContext, Collection, AbstractOrder),
updatePromotions(SessionContext, Collection, AbstractOrder, boolean, AutoApplyMode, AutoApplyMode, Date),
getPromotionResults(de.hybris.platform.jalo.order.AbstractOrder),
getPromotionResults(de.hybris.platform.jalo.SessionContext, de.hybris.platform.jalo.order.AbstractOrder),
getPromotionResults(SessionContext, Collection, AbstractOrder, boolean, AutoApplyMode, AutoApplyMode, Date)public PromotionOrderResults updatePromotions(SessionContext ctx, java.util.Collection<PromotionGroup> promotionGroups, AbstractOrder order)
AbstractOrder object.
This method will automatically apply all possible product promotional updates to the cart, but not apply order
level promotions. Any previously applied order level promotions will remain applied. Promotions are evaluated at
the current system time.
The promotion results are stored in the database and the same PromotionOrderResults can be obtained later
by calling getPromotionResults(de.hybris.platform.jalo.order.AbstractOrder).ctx - The hybris session contextpromotionGroups - The promotion groups to evaluateorder - The order object to update with the results of the promotionsupdatePromotions(SessionContext, Collection, AbstractOrder, boolean, AutoApplyMode, AutoApplyMode, Date),
getPromotionResults(de.hybris.platform.jalo.order.AbstractOrder),
getPromotionResults(de.hybris.platform.jalo.SessionContext, de.hybris.platform.jalo.order.AbstractOrder),
getPromotionResults(SessionContext, Collection, AbstractOrder, boolean, AutoApplyMode, AutoApplyMode, Date)public PromotionOrderResults updatePromotions(SessionContext ctx, java.util.Collection<PromotionGroup> promotionGroups, AbstractOrder order, boolean evaluateRestrictions, PromotionsManager.AutoApplyMode productPromotionMode, PromotionsManager.AutoApplyMode orderPromotionMode, java.util.Date date)
AbstractOrder object.
The resulting promotions can be retrieved later by calling getPromotionResults(de.hybris.platform.jalo.order.AbstractOrder). The order must be
calculated before calling this method. updatePromotions(java.util.Collection<de.hybris.platform.promotions.jalo.PromotionGroup>, de.hybris.platform.jalo.order.AbstractOrder) must be called after calling
AbstractOrder.recalculate() on the AbstractOrder. Where the PromotionsManager.AutoApplyMode is set to
PromotionsManager.AutoApplyMode.KEEP_APPLIED the state of any previously applied PromotionResult is recorded and if
it is still in the fired state (PromotionResult.isApplied()) after reevaluating the promotions it will be
automatically reapplied.
The promotion results are stored in the database and the same PromotionOrderResults can be obtained later
by calling getPromotionResults(de.hybris.platform.jalo.order.AbstractOrder).ctx - The hybris session contextpromotionGroups - The promotion groups to evaluateorder - The AbstractOrder object to update the promotions forevaluateRestrictions - If true any promotion restrictions will be observed, if false all promotion restrictions
are ignoredproductPromotionMode - The auto apply mode. This determines whether this method applies any product promotional changes to line
items or discounts to the overall amountorderPromotionMode - The auto apply mode. This determines whether this method applies any order promotional changes to line
items or discounts to the overall amountdate - The effective date for the promotions to check. Use this to to see the effects of promotions in the past
or future.getPromotionResults(de.hybris.platform.jalo.order.AbstractOrder),
getPromotionResults(de.hybris.platform.jalo.SessionContext, de.hybris.platform.jalo.order.AbstractOrder),
getPromotionResults(SessionContext, Collection, AbstractOrder, boolean, AutoApplyMode, AutoApplyMode, Date)protected PromotionOrderResults updatePromotionsNotThreadSafe(SessionContext ctx, java.util.Collection<PromotionGroup> promotionGroups, AbstractOrder order, boolean evaluateRestrictions, PromotionsManager.AutoApplyMode productPromotionMode, PromotionsManager.AutoApplyMode orderPromotionMode, java.util.Date date)
protected boolean keepApplied(PromotionsManager.AutoApplyMode productPromotionMode, PromotionsManager.AutoApplyMode orderPromotionMode, AbstractPromotion promotion, boolean autoApply)
protected boolean autoApplyApplies(PromotionsManager.AutoApplyMode productPromotionMode, PromotionsManager.AutoApplyMode orderPromotionMode, AbstractPromotion promotion)
protected java.util.List<PromotionResult> evaluatePromotion(SessionContext ctx, PromotionEvaluationContext promoContext, AbstractPromotion promotion)
protected static java.util.List<Voucher> fixupVouchersRemoveVouchers(SessionContext ctx, AbstractOrder order)
ctx - the hybris session contextorder - the order to fixupprotected static void fixupVouchersReapplyVouchers(SessionContext ctx, AbstractOrder order, java.util.List<Voucher> vouchers)
ctx - the hybris session contextorder - the order to fixupvouchers - the vouchers to reapplypublic static java.util.List<AbstractPromotion> findOrderAndProductPromotionsSortByPriority(SessionContext ctx, JaloSession jaloSession, java.util.Collection<PromotionGroup> promotionGroups, java.util.Collection<Product> products, java.util.Date date)
ctx - The hybris contextjaloSession - The jalo sessionpromotionGroups - The promotion groups to evaluateproducts - The list of products to find associated promotions fordate - The date to test against promotionspublic static java.util.Collection<Product> getBaseProductsForOrder(SessionContext ctx, AbstractOrder order)
ctx - the hybris contextorder - the orderpublic final PromotionOrderResults getPromotionResults(AbstractOrder order)
updatePromotions(java.util.Collection<de.hybris.platform.promotions.jalo.PromotionGroup>, de.hybris.platform.jalo.order.AbstractOrder) for the same order.
If any of the promotion results are invalid then they will be ignored.order - The order to get the promotion results forupdatePromotions(Collection, AbstractOrder),
updatePromotions(SessionContext, Collection, AbstractOrder),
updatePromotions(SessionContext, Collection, AbstractOrder, boolean, AutoApplyMode, AutoApplyMode, Date)public PromotionOrderResults getPromotionResults(SessionContext ctx, AbstractOrder order)
updatePromotions(java.util.Collection<de.hybris.platform.promotions.jalo.PromotionGroup>, de.hybris.platform.jalo.order.AbstractOrder) for the same order.
If any of the promotion results are invalid then they will be ignored. To force the list of promotions to be
recalculated either call updatePromotions(java.util.Collection<de.hybris.platform.promotions.jalo.PromotionGroup>, de.hybris.platform.jalo.order.AbstractOrder) or call the version of
getPromotionResults(SessionContext, Collection, AbstractOrder, boolean, AutoApplyMode, AutoApplyMode, Date)
.ctx - The session contextorder - The order to get the promotion results forupdatePromotions(Collection, AbstractOrder),
updatePromotions(SessionContext, Collection, AbstractOrder),
updatePromotions(SessionContext, Collection, AbstractOrder, boolean, AutoApplyMode, AutoApplyMode, Date)public PromotionOrderResults getPromotionResults(SessionContext ctx, java.util.Collection<PromotionGroup> promotionGroups, AbstractOrder order, boolean evaluateRestrictions, PromotionsManager.AutoApplyMode productPromotionMode, PromotionsManager.AutoApplyMode orderPromotionMode, java.util.Date date)
updatePromotions(java.util.Collection<de.hybris.platform.promotions.jalo.PromotionGroup>, de.hybris.platform.jalo.order.AbstractOrder) for the same order.
If any of the promotion results are invalid then this method will recalculate the promotions by calling
updatePromotions(java.util.Collection<de.hybris.platform.promotions.jalo.PromotionGroup>, de.hybris.platform.jalo.order.AbstractOrder).ctx - The hybris session contextpromotionGroups - The promotion groups to evaluateorder - The AbstractOrder object to get the promotions forevaluateRestrictions - If true any promotion restrictions will be observed, if false all promotion restrictions
are ignoredproductPromotionMode - The auto apply mode. This determines whether this method applies any product promotional changes to line
items or discounts to the overall amountorderPromotionMode - The auto apply mode. This determines whether this method applies any order promotional changes to line
items or discounts to the overall amountdate - The effective date for the promotions to check. Use this to to see the effects of promotions in the past
or future.updatePromotions(Collection, AbstractOrder),
updatePromotions(SessionContext, Collection, AbstractOrder),
updatePromotions(SessionContext, Collection, AbstractOrder, boolean, AutoApplyMode, AutoApplyMode, Date)protected java.util.List<PromotionResult> getPromotionResultsInternal(SessionContext ctx, AbstractOrder order)
ctx - The session contextorder - The order to get the promotion results forprotected void deleteStoredPromotionResults(SessionContext ctx, AbstractOrder order, boolean undoActions)
ctx - The session contextorder - The order to delete the results forundoActions - Undo the actions before deleting the promotion resultspublic final void cleanupCart(Cart cart)
cart - The Cart to delete the results forpublic void cleanupCart(SessionContext ctx, Cart cart)
ctx - The session contextcart - The Cart to delete the results forpublic final void cleanupOrphanedResults()
cleanupCart(de.hybris.platform.jalo.order.Cart) method should be used instead. This
method can be used in an admin context if required.public void cleanupOrphanedResults(SessionContext ctx)
cleanupCart(de.hybris.platform.jalo.order.Cart) method should be used instead. This
method can be used in an admin context if required.ctx - The session contextpublic final void transferPromotionsToOrder(AbstractOrder source, Order target, boolean onlyTransferAppliedPromotions)
source - The cart that has promotionstarget - The order that promotions should be applied toonlyTransferAppliedPromotions - Flag to indicate that only applied promotions should be transfered. If false all promotion results will
be transferedpublic void transferPromotionsToOrder(SessionContext ctx, AbstractOrder source, Order target, boolean onlyTransferAppliedPromotions)
ctx - The session contextsource - The cart that has promotionstarget - The order that promotions should be applied toonlyTransferAppliedPromotions - Flag to indicate that only applied promotions should be transfered. If false all promotion results will
be transferedpublic final PromotionsManager.RestrictionSetResult evaluateRestrictions(SessionContext ctx, java.util.List<Product> products, AbstractOrder order, AbstractPromotion promo, java.util.Date date)
ctx - The current contextproducts - The products to be considered for restrictionorder - The current orderpromo - The promotion to evaluatedate - The effective date to evaluate the restrictions onpublic PromotionsManager.RestrictionSetResult evaluateRestrictions(SessionContext ctx, java.util.List<Product> products, AbstractOrder order, java.util.Collection<AbstractPromotionRestriction> restrictions, java.util.Date date)
ctx - The current contextproducts - The products to be considered for restrictionorder - The current orderrestrictions - The set of restrictions to evaluatedate - The effective date to evaluate the restrictions onpublic PromotionGroup getDefaultPromotionGroup()
public PromotionGroup getDefaultPromotionGroup(SessionContext ctx)
ctx - The session contextpublic PromotionGroup getPromotionGroup(java.lang.String identifier)
identifier - identifier of the promotion group to look forjava.lang.IllegalArgumentException - if identifier is nullpublic PromotionOrderEntryConsumed createPromotionOrderEntryConsumed(SessionContext ctx, java.lang.String code, AbstractOrderEntry orderEntry, long quantity)
PromotionOrderEntryConsumed instance.ctx - The session contextcode - The object's codeorderEntry - The AbstractOrderEntry that is the base order entry for the objectquantity - The quantity mapped through from the base order entryPromotionOrderEntryConsumedpublic PromotionOrderEntryConsumed createPromotionOrderEntryConsumed(SessionContext ctx, java.lang.String code, AbstractOrderEntry orderEntry, long quantity, double adjustedUnitPrice)
PromotionOrderEntryConsumed instance.ctx - The session contextcode - The object's codeorderEntry - The AbstractOrderEntry that is the base order entry for the objectquantity - The quantity mapped through from the base order entryadjustedUnitPrice - The adjusted unit pricePromotionOrderEntryConsumedpublic PromotionResult createPromotionResult(SessionContext ctx, AbstractPromotion promotion, AbstractOrder order, float certainty)
PromotionResult instance.ctx - The session contextpromotion - The AbstractPromotion that created the PromotionResultorder - The AbstractOrder that the PromotionResult is related tocertainty - The certainty of firing in the range 0 to 1. 1.0 is fired, less than 1.0 is could fire.PromotionResultpublic PromotionOrderAdjustTotalAction createPromotionOrderAdjustTotalAction(SessionContext ctx, double totalAdjustment)
PromotionOrderAdjustTotalAction instance.ctx - The session contexttotalAdjustment - The amount to adjust the order total (positive increases order total, negative decreases)PromotionOrderAdjustTotalActionpublic PromotionOrderAddFreeGiftAction createPromotionOrderAddFreeGiftAction(SessionContext ctx, Product product, PromotionResult result)
PromotionOrderAddFreeGiftAction instance.ctx - The session contextproduct - The Product to give awayresult - The PromotionResult that owns this action.PromotionOrderAddFreeGiftActionpublic PromotionOrderChangeDeliveryModeAction createPromotionOrderChangeDeliveryModeAction(SessionContext ctx, DeliveryMode deliveryMode)
PromotionOrderChangeDeliveryModeAction instance.ctx - The session contextdeliveryMode - The DeliveryMode to set on the orderPromotionOrderChangeDeliveryModeActionpublic PromotionPriceRow createPromotionPriceRow(Currency currency, double price)
PromotionPriceRow instance.currency - The Currency that the price is specified inprice - The price valuePromotionPriceRowpublic PromotionPriceRow createPromotionPriceRow(SessionContext ctx, Currency currency, double price)
PromotionPriceRow instance.ctx - The session contextcurrency - The Currency that the price is specifed inprice - The price valuePromotionPriceRowpublic PromotionQuantityAndPricesRow createPromotionQuantityAndPricesRow(SessionContext ctx, long quantity, java.util.Collection<PromotionPriceRow> prices)
PromotionQuantityAndPricesRow instance.ctx - The session contextquantity - The quantityprices - The prices for the quantityPromotionQuantityAndPricesRow@Deprecated public PromotionOrderEntryAdjustAction createPromotionOrderEntryAdjustAction(SessionContext ctx, Product product, long quantity, double adjustment)
createPromotionOrderEntryAdjustAction(SessionContext, AbstractOrderEntry, long, double),
see PRO-75
Create a new PromotionOrderEntryAdjustAction instance.ctx - The session contextproduct - The Product to adjustquantity - The quantity to adjustadjustment - The adjustment to makePromotionOrderEntryAdjustActionpublic PromotionOrderEntryAdjustAction createPromotionOrderEntryAdjustAction(SessionContext ctx, AbstractOrderEntry entry, long quantity, double adjustment)
PromotionOrderEntryAdjustAction instance.ctx - The session contextentry - The AbstractOrderEntry to adjustquantity - The quantity to adjustadjustment - The adjustment to makePromotionOrderEntryAdjustActionpublic PromotionOrderEntryAdjustAction createPromotionOrderEntryAdjustAction(SessionContext ctx, AbstractOrderEntry entry, double adjustment)
ctx - The session contextentry - The AbstractOrderEntry to adjustadjustment - The adjustment to makePromotionOrderEntryAdjustActionpublic PromotionGroup createPromotionGroup(SessionContext ctx, java.lang.String identifier)
PromotionGroup instance.ctx - The session contextidentifier - The identifier for the promotion groupPromotionGrouppublic PromotionNullAction createPromotionNullAction(SessionContext ctx)
PromotionNullAction instance.ctx - The session contextPromotionNullActionprotected static java.lang.String makeActionGUID()
Copyright © 2018 SAP SE. All Rights Reserved.