Class DefaultStaleCartItemsService

    • Constructor Detail

      • DefaultStaleCartItemsService

        public DefaultStaleCartItemsService()
    • 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 the CartItems from the cart if the appropriate product doesn't exist and creates the CartAlert about removed items.
        Specified by:
        removeStaleCartItems in interface StaleCartItemsService
        Parameters:
        cart - the cart to check the stale items
        price - whether or not to re-price the cart
        updateCart - whether or not to update Cart pricing and save the cart after the removal
        paymentLockTokens - 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 the CartItems from the cart if the appropriate product doesn't exist and creates the CartAlert about removed items.
        Specified by:
        removeStaleCartItems in interface StaleCartItemsService
        Parameters:
        cart - the cart to check the stale items
        productList - the list of the products for the cart items
        price - whether or not to re-price the cart
        updateCart - whether or not to update Cart pricing and save the cart after the removal
        paymentLockTokens - 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 the CartAlert about removed items.
        Specified by:
        removeStaleCartItems in interface StaleCartItemsService
        Parameters:
        cart - the cart to check the stale items
        cartItemsToRemove - the list of the items to remove
        price - whether or not to re-price the cart
        updateCart - whether or not to update Cart pricing and save the cart after the removal
        paymentLockTokens - 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 removed CartItems based on the original list of items and the updated Cart.
        Parameters:
        originalCartItems - a list of CartItems before removing any items from Cart
        updatedCart - the updated Cart 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 of CartAlerts indicating that the product was not found from the given CartItems.
        Parameters:
        cartItems - a list of CartItems to build the CartAlerts from
        Returns:
        a list of CartAlerts indicating that the product was not found for the given CartItems
      • getMessage

        protected String getMessage​(@NonNull
                                    @NonNull String errorMessage,
                                    @Nullable
                                    Object... args)
      • setCartOperationService

        @Autowired
        @Lazy
        public void setCartOperationService​(CartOperationService cartOperationService)
      • setCatalogProvider

        @Autowired
        public void setCatalogProvider​(CatalogProvider catalogProvider)
      • 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()