Class DefaultStaleCartItemsService
- java.lang.Object
-
- com.broadleafcommerce.cartoperation.service.DefaultStaleCartItemsService
-
- All Implemented Interfaces:
StaleCartItemsService
public class DefaultStaleCartItemsService extends Object implements StaleCartItemsService
The default implementation forStaleCartItemsService
.- Author:
- Dima Myroniuk (dmyroniuk)
-
-
Constructor Summary
Constructors Constructor Description DefaultStaleCartItemsService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<com.broadleafcommerce.cart.client.domain.CartAlert>
buildProductNotFoundCartAlerts(List<com.broadleafcommerce.cart.client.domain.CartItem> cartItems)
Builds a list ofCartAlerts
indicating that the product was not found from the givenCartItems
.protected CartOperationService
getCartOperationService()
protected CatalogProvider
getCatalogProvider()
protected String
getMessage(@NonNull String errorMessage, Object... args)
protected org.springframework.context.MessageSource
getMessageSource()
protected List<com.broadleafcommerce.cart.client.domain.CartItem>
getRemovedCartItems(List<com.broadleafcommerce.cart.client.domain.CartItem> originalCartItems, com.broadleafcommerce.cart.client.domain.Cart updatedCart)
Gets a list of removedCartItems
based on the original list of items and the updatedCart
.protected com.broadleafcommerce.common.extension.TypeFactory
getTypeFactory()
com.broadleafcommerce.cart.client.domain.Cart
removeStaleCartItems(com.broadleafcommerce.cart.client.domain.Cart cart, boolean price, boolean updateCart, Map<String,String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Removes theCartItems
from the cart if the appropriate product doesn't exist and creates theCartAlert
about removed items.com.broadleafcommerce.cart.client.domain.Cart
removeStaleCartItems(com.broadleafcommerce.cart.client.domain.Cart cart, ProductList productList, boolean price, boolean updateCart, Map<String,String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Removes theCartItems
from the cart if the appropriate product doesn't exist and creates theCartAlert
about removed items.com.broadleafcommerce.cart.client.domain.Cart
removeStaleCartItems(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItemsToRemove, boolean price, boolean updateCart, Map<String,String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Removes the specified cart items from the cart and adds theCartAlert
about removed items.void
setCartOperationService(CartOperationService cartOperationService)
void
setCatalogProvider(CatalogProvider catalogProvider)
void
setMessageSource(org.springframework.context.MessageSource messageSource)
void
setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.broadleafcommerce.cartoperation.service.StaleCartItemsService
removeStaleCartItems, removeStaleCartItems, removeStaleCartItems
-
-
-
-
Method Detail
-
removeStaleCartItems
public com.broadleafcommerce.cart.client.domain.Cart removeStaleCartItems(com.broadleafcommerce.cart.client.domain.Cart cart, boolean price, boolean updateCart, Map<String,String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Description copied from interface:StaleCartItemsService
Removes theCartItems
from the cart if the appropriate product doesn't exist and creates theCartAlert
about removed items.- Specified by:
removeStaleCartItems
in interfaceStaleCartItemsService
- Parameters:
cart
- the cart to check the stale itemsprice
- whether or not to re-price the cartupdateCart
- whether or not to updateCart
pricing and save the cart after the removalpaymentLockTokens
- Tokens that grant this service access to act upon the payment. The presence of these tokens indicates that this execution flow owns the lock.contextInfo
- context information about sandboxing and multitenant state- Returns:
- the cart without stale cart items
-
removeStaleCartItems
public com.broadleafcommerce.cart.client.domain.Cart removeStaleCartItems(com.broadleafcommerce.cart.client.domain.Cart cart, ProductList productList, boolean price, boolean updateCart, Map<String,String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Description copied from interface:StaleCartItemsService
Removes theCartItems
from the cart if the appropriate product doesn't exist and creates theCartAlert
about removed items.- Specified by:
removeStaleCartItems
in interfaceStaleCartItemsService
- Parameters:
cart
- the cart to check the stale itemsproductList
- the list of the products for the cart itemsprice
- whether or not to re-price the cartupdateCart
- whether or not to updateCart
pricing and save the cart after the removalpaymentLockTokens
- Tokens that grant this service access to act upon the payment. The presence of these tokens indicates that this execution flow owns the lock.contextInfo
- context information about sandboxing and multitenant state- Returns:
- the cart without stale cart items
-
removeStaleCartItems
public com.broadleafcommerce.cart.client.domain.Cart removeStaleCartItems(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItemsToRemove, boolean price, boolean updateCart, Map<String,String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Description copied from interface:StaleCartItemsService
Removes the specified cart items from the cart and adds theCartAlert
about removed items.- Specified by:
removeStaleCartItems
in interfaceStaleCartItemsService
- Parameters:
cart
- the cart to check the stale itemscartItemsToRemove
- the list of the items to removeprice
- whether or not to re-price the cartupdateCart
- whether or not to updateCart
pricing and save the cart after the removalpaymentLockTokens
- Tokens that grant this service access to act upon the payment. The presence of these tokens indicates that this execution flow owns the lock.contextInfo
- context information about sandboxing and multitenant state- Returns:
- the cart without stale cart items
-
getRemovedCartItems
protected List<com.broadleafcommerce.cart.client.domain.CartItem> getRemovedCartItems(List<com.broadleafcommerce.cart.client.domain.CartItem> originalCartItems, com.broadleafcommerce.cart.client.domain.Cart updatedCart)
Gets a list of removedCartItems
based on the original list of items and the updatedCart
.- Parameters:
originalCartItems
- a list ofCartItems
before removing any items fromCart
updatedCart
- the updatedCart
after items are removed- Returns:
- a list of removed
CartItems
-
buildProductNotFoundCartAlerts
protected List<com.broadleafcommerce.cart.client.domain.CartAlert> buildProductNotFoundCartAlerts(List<com.broadleafcommerce.cart.client.domain.CartItem> cartItems)
Builds a list ofCartAlerts
indicating that the product was not found from the givenCartItems
.- Parameters:
cartItems
- a list ofCartItems
to build theCartAlerts
from- Returns:
- a list of
CartAlerts
indicating that the product was not found for the givenCartItems
-
getMessage
protected String getMessage(@NonNull @NonNull String errorMessage, @Nullable Object... args)
-
setCartOperationService
@Autowired @Lazy public void setCartOperationService(CartOperationService cartOperationService)
-
getCartOperationService
protected CartOperationService getCartOperationService()
-
setCatalogProvider
@Autowired public void setCatalogProvider(CatalogProvider catalogProvider)
-
getCatalogProvider
protected CatalogProvider getCatalogProvider()
-
setTypeFactory
@Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-
setMessageSource
@Autowired public void setMessageSource(org.springframework.context.MessageSource messageSource)
-
getMessageSource
protected org.springframework.context.MessageSource getMessageSource()
-
-