public class DefaultPromotionsService extends AbstractPromotionsService implements PromotionsService
AbstractService.SerializableDTOmodelService, sessionService, txManagertenant| Constructor and Description |
|---|
DefaultPromotionsService() |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanupCart(CartModel cart)
Delete the the stored promotion results for a Cart.
|
java.util.List<? extends AbstractPromotionModel> |
getAbstractProductPromotions(java.util.Collection<PromotionGroupModel> promotionGroups,
ProductModel product)
Get the ordered list of
AbstractPromotionModel instances that are related to the ProductModel
specified. |
java.util.List<? extends AbstractPromotionModel> |
getAbstractProductPromotions(java.util.Collection<PromotionGroupModel> promotionGroups,
ProductModel product,
boolean evaluateRestrictions,
java.util.Date date)
Get the ordered list of
AbstractPromotionModel instances that are related to the ProductModel
specified. |
PromotionGroupModel |
getDefaultPromotionGroup()
Lookup the default promotion group created by the promotions extension.
|
java.util.List<OrderPromotionModel> |
getOrderPromotions(java.util.Collection<PromotionGroupModel> promotionGroups)
Get the ordered list of
OrderPromotion instances. |
java.util.List<OrderPromotionModel> |
getOrderPromotions(java.util.Collection<PromotionGroupModel> promotionGroups,
boolean evaluateRestrictions)
Get the ordered list of
OrderPromotion instances. |
java.util.List<OrderPromotionModel> |
getOrderPromotions(java.util.Collection<PromotionGroupModel> promotionGroups,
boolean evaluateRestrictions,
java.util.Date date)
Get the ordered list of
OrderPromotion instances. |
java.util.List<OrderPromotionModel> |
getOrderPromotions(java.util.Collection<PromotionGroupModel> promotionGroups,
boolean evaluateRestrictions,
ProductModel product)
Get the ordered list of
OrderPromotion instances. |
java.util.List<OrderPromotionModel> |
getOrderPromotions(java.util.Collection<PromotionGroupModel> promotionGroups,
boolean evaluateRestrictions,
ProductModel product,
java.util.Date date)
Get the ordered list of
OrderPromotion instances. |
java.util.List<OrderPromotionModel> |
getOrderPromotions(java.util.Collection<PromotionGroupModel> promotionGroups,
java.util.Date date)
Get the ordered list of
OrderPromotion instances. |
java.util.List<OrderPromotionModel> |
getOrderPromotions(java.util.Collection<PromotionGroupModel> promotionGroups,
ProductModel product)
Get the ordered list of
OrderPromotion instances. |
java.util.List<OrderPromotionModel> |
getOrderPromotions(java.util.Collection<PromotionGroupModel> promotionGroups,
ProductModel product,
java.util.Date date)
Get the ordered list of
OrderPromotion instances. |
java.util.List<ProductPromotionModel> |
getProductPromotions(java.util.Collection<PromotionGroupModel> promotionGroups,
ProductModel product)
Get the ordered list of
ProductPromotion instances that are related to the ProductModel specified. |
java.util.List<ProductPromotionModel> |
getProductPromotions(java.util.Collection<PromotionGroupModel> promotionGroups,
ProductModel product,
boolean evaluateRestrictions,
java.util.Date date)
Get the ordered list of
ProductPromotion instances that are related to the ProductModel specified. |
java.lang.String |
getPromotionDescription(AbstractPromotionModel promotion)
Get the description of given promotion.
|
PromotionGroupModel |
getPromotionGroup(java.lang.String identifier)
Lookup a promotion group with the given identifier.
|
PromotionOrderResults |
getPromotionResults(AbstractOrderModel order)
Get the promotion results for the specified order.
|
PromotionOrderResults |
getPromotionResults(java.util.Collection<PromotionGroupModel> promotionGroups,
AbstractOrderModel order,
boolean evaluateRestrictions,
PromotionsManager.AutoApplyMode productPromotionMode,
PromotionsManager.AutoApplyMode orderPromotionMode,
java.util.Date date)
Get the promotion results for the specified order.
|
protected PromotionsManager |
getPromotionsManager() |
java.util.Collection<AbstractPromotionRestrictionModel> |
getRestrictions(AbstractPromotionModel promotion)
Get the collection of
AbstractPromotionRestrictionModel instances. |
protected void |
refreshOrder(AbstractOrderModel order) |
protected void |
saveIfModified(AbstractOrderModel order) |
void |
transferPromotionsToOrder(AbstractOrderModel source,
OrderModel target,
boolean onlyTransferAppliedPromotions)
Transfer the promotions applied to a cart to a new order.
|
PromotionOrderResults |
updatePromotions(java.util.Collection<PromotionGroupModel> promotionGroups,
AbstractOrderModel order)
Update the promotions on the specified
AbstractOrder object. |
PromotionOrderResults |
updatePromotions(java.util.Collection<PromotionGroupModel> promotionGroups,
AbstractOrderModel order,
boolean evaluateRestrictions,
PromotionsManager.AutoApplyMode productPromotionMode,
PromotionsManager.AutoApplyMode orderPromotionMode,
java.util.Date date)
Update the promotions on the specified
AbstractOrderModel object. |
getCart, getOrder, getOrder, getProduct, getPromotion, getPromotion, getPromotion, getPromotionGroup, getResult, getSessionContext, refreshModifiedModelsAftergetModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManagerafterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplaceprotected PromotionsManager getPromotionsManager()
public void cleanupCart(CartModel cart)
PromotionsServicecleanupCart in interface PromotionsServicecart - The Cart to delete the results forpublic PromotionGroupModel getDefaultPromotionGroup()
PromotionsServicegetDefaultPromotionGroup in interface PromotionsServicepublic java.util.List<OrderPromotionModel> getOrderPromotions(java.util.Collection<PromotionGroupModel> promotionGroups)
PromotionsServiceOrderPromotion instances.getOrderPromotions in interface PromotionsServicepromotionGroups - The promotion groups to evaluateOrderPromotionpublic java.util.List<OrderPromotionModel> getOrderPromotions(java.util.Collection<PromotionGroupModel> promotionGroups, java.util.Date date)
PromotionsServiceOrderPromotion instances.getOrderPromotions in interface PromotionsServicepromotionGroups - The promotion groups to evaluatedate - The date to check for promotions, typically the current dateOrderPromotionpublic java.util.List<OrderPromotionModel> getOrderPromotions(java.util.Collection<PromotionGroupModel> promotionGroups, ProductModel product)
PromotionsServiceOrderPromotion instances.getOrderPromotions in interface PromotionsServicepromotionGroups - The promotion groups to evaluateproduct - The product to pass to restrictionsOrderPromotionpublic java.util.List<OrderPromotionModel> getOrderPromotions(java.util.Collection<PromotionGroupModel> promotionGroups, ProductModel product, java.util.Date date)
PromotionsServiceOrderPromotion instances.getOrderPromotions in interface PromotionsServicepromotionGroups - The promotion groups to evaluateproduct - The product to pass to restrictionsdate - The date to check for promotions, typically the current dateOrderPromotionpublic java.util.List<OrderPromotionModel> getOrderPromotions(java.util.Collection<PromotionGroupModel> promotionGroups, boolean evaluateRestrictions)
PromotionsServiceOrderPromotion instances.getOrderPromotions in interface PromotionsServicepromotionGroups - 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<OrderPromotionModel> getOrderPromotions(java.util.Collection<PromotionGroupModel> promotionGroups, boolean evaluateRestrictions, java.util.Date date)
PromotionsServiceOrderPromotion instances.getOrderPromotions in interface PromotionsServicepromotionGroups - 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<OrderPromotionModel> getOrderPromotions(java.util.Collection<PromotionGroupModel> promotionGroups, boolean evaluateRestrictions, ProductModel product)
PromotionsServiceOrderPromotion instances.getOrderPromotions in interface PromotionsServicepromotionGroups - 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<OrderPromotionModel> getOrderPromotions(java.util.Collection<PromotionGroupModel> promotionGroups, boolean evaluateRestrictions, ProductModel product, java.util.Date date)
PromotionsServiceOrderPromotion instances.getOrderPromotions in interface PromotionsServicepromotionGroups - 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<ProductPromotionModel> getProductPromotions(java.util.Collection<PromotionGroupModel> promotionGroups, ProductModel product)
PromotionsServiceProductPromotion instances that are related to the ProductModel specified.getProductPromotions in interface PromotionsServicepromotionGroups - The promotion groups to evaluateproduct - The product that the promotions are related toProductPromotion related to the ProductModel specifiedpublic java.util.List<ProductPromotionModel> getProductPromotions(java.util.Collection<PromotionGroupModel> promotionGroups, ProductModel product, boolean evaluateRestrictions, java.util.Date date)
PromotionsServiceProductPromotion instances that are related to the ProductModel specified.getProductPromotions in interface PromotionsServicepromotionGroups - 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 ProductModel specifiedpublic java.util.List<? extends AbstractPromotionModel> getAbstractProductPromotions(java.util.Collection<PromotionGroupModel> promotionGroups, ProductModel product)
PromotionsServiceAbstractPromotionModel instances that are related to the ProductModel
specified.getAbstractProductPromotions in interface PromotionsServicepromotionGroups - The promotion groups to evaluateproduct - The product that the promotions are related toAbstractPromotionModel related to the ProductModel specifiedpublic java.util.List<? extends AbstractPromotionModel> getAbstractProductPromotions(java.util.Collection<PromotionGroupModel> promotionGroups, ProductModel product, boolean evaluateRestrictions, java.util.Date date)
PromotionsServiceAbstractPromotionModel instances that are related to the ProductModel
specified.getAbstractProductPromotions in interface PromotionsServicepromotionGroups - 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 dateAbstractPromotionModel related to the ProductModel specifiedpublic PromotionGroupModel getPromotionGroup(java.lang.String identifier)
getPromotionGroup in interface PromotionsServiceidentifier - identifier of the promotion group to look forpublic PromotionOrderResults getPromotionResults(AbstractOrderModel order)
PromotionsServicePromotionsService.updatePromotions(java.util.Collection<de.hybris.platform.promotions.model.PromotionGroupModel>, de.hybris.platform.core.model.order.AbstractOrderModel) for the same order.
If any of the promotion results are invalid then they will be ignored.getPromotionResults in interface PromotionsServiceorder - The order to get the promotion results forpublic PromotionOrderResults getPromotionResults(java.util.Collection<PromotionGroupModel> promotionGroups, AbstractOrderModel order, boolean evaluateRestrictions, PromotionsManager.AutoApplyMode productPromotionMode, PromotionsManager.AutoApplyMode orderPromotionMode, java.util.Date date)
PromotionsServicePromotionsService.updatePromotions(java.util.Collection<de.hybris.platform.promotions.model.PromotionGroupModel>, de.hybris.platform.core.model.order.AbstractOrderModel) for the same order.
If any of the promotion results are invalid then this method will recalculate the promotions by calling
PromotionsService.updatePromotions(java.util.Collection<de.hybris.platform.promotions.model.PromotionGroupModel>, de.hybris.platform.core.model.order.AbstractOrderModel).getPromotionResults in interface PromotionsServicepromotionGroups - 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.public void transferPromotionsToOrder(AbstractOrderModel source, OrderModel target, boolean onlyTransferAppliedPromotions)
PromotionsServicetransferPromotionsToOrder in interface PromotionsServicesource - 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 PromotionOrderResults updatePromotions(java.util.Collection<PromotionGroupModel> promotionGroups, AbstractOrderModel order)
PromotionsServiceAbstractOrder 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 PromotionsService.getPromotionResults(de.hybris.platform.core.model.order.AbstractOrderModel).updatePromotions in interface PromotionsServicepromotionGroups - The promotion groups to evaluateorder - The order object to update with the results of the promotionspublic PromotionOrderResults updatePromotions(java.util.Collection<PromotionGroupModel> promotionGroups, AbstractOrderModel order, boolean evaluateRestrictions, PromotionsManager.AutoApplyMode productPromotionMode, PromotionsManager.AutoApplyMode orderPromotionMode, java.util.Date date)
PromotionsServiceAbstractOrderModel object.
The resulting promotions can be retrieved later by calling PromotionsService.getPromotionResults(de.hybris.platform.core.model.order.AbstractOrderModel). The order must be
calculated before calling this method. PromotionsService.updatePromotions(java.util.Collection<de.hybris.platform.promotions.model.PromotionGroupModel>, de.hybris.platform.core.model.order.AbstractOrderModel) must be called after calling
AbstractOrder.recalculate() on the AbstractOrderModel. 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 PromotionsService.getPromotionResults(de.hybris.platform.core.model.order.AbstractOrderModel). After this method is called, please call getModelService().refresh(order)
or getModelService().save(order).updatePromotions in interface PromotionsServicepromotionGroups - 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.protected void refreshOrder(AbstractOrderModel order)
protected void saveIfModified(AbstractOrderModel order)
public java.util.Collection<AbstractPromotionRestrictionModel> getRestrictions(AbstractPromotionModel promotion)
PromotionsServiceAbstractPromotionRestrictionModel instances.getRestrictions in interface PromotionsServicepromotion - the promotion which restrictions should be returnedAbstractPromotionRestrictionModel instances attached to this promotion.public java.lang.String getPromotionDescription(AbstractPromotionModel promotion)
PromotionsServicegetPromotionDescription in interface PromotionsServicepromotion - the promotion to get the description forCopyright © 2018 SAP SE. All Rights Reserved.