Class DefaultCartItemConfigurationService

    • Method Detail

      • hasVariantDistinguishingOptions

        protected boolean hasVariantDistinguishingOptions​(@NonNull
                                                          @NonNull Product product)
      • hydrateIncludedProductDependentItems

        public void hydrateIncludedProductDependentItems​(com.broadleafcommerce.cart.client.domain.CartItem cartItem,
                                                         List<com.broadleafcommerce.cart.client.domain.CartItem> potentialDependentItems,
                                                         Product product,
                                                         boolean isAdd)
        Description copied from interface: CartItemConfigurationService
        Populate IncludedProduct information on CartItem.getDependentCartItems() based on the product configuration.
        Specified by:
        hydrateIncludedProductDependentItems in interface CartItemConfigurationService
        Parameters:
        cartItem - The cart item on which to populate dependent item product configuration information.
        potentialDependentItems - The list of CartItem.getDependentCartItems() to pick from to find a match for an IncludedProduct.
        product - The product with configuration to be used for hydration.
        isAdd - Whether we are in an add-to-cart flow
      • hydrateItemChoiceDependentItems

        public void hydrateItemChoiceDependentItems​(com.broadleafcommerce.cart.client.domain.CartItem cartItem,
                                                    List<com.broadleafcommerce.cart.client.domain.CartItem> potentialDependentItems,
                                                    Product product)
        Description copied from interface: CartItemConfigurationService
        Populate ItemChoice information on CartItem.getDependentCartItems() based on the product configuration.
        Specified by:
        hydrateItemChoiceDependentItems in interface CartItemConfigurationService
        Parameters:
        cartItem - The cart item on which to populate dependent item product configuration information.
        potentialDependentItems - The list of CartItem.getDependentCartItems() to pick from to find a match for an ItemChoice.
        product - The product with configuration to be used for hydration.
      • validateItemAndDependentsHavePositiveQuantities

        protected void validateItemAndDependentsHavePositiveQuantities​(com.broadleafcommerce.cart.client.domain.CartItem item)
        A basic requirement is that all items added to a cart have a positive quantity. This method validates the given item and all of its nested dependents to ensure they have a positive quantity. Config errors will be registered on the item if the validation does not pass.
        Parameters:
        item - the item which should be validated to have a positive quantity for itself and dependents
      • requiredAttributesMissing

        protected boolean requiredAttributesMissing​(@NonNull
                                                    @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem)
      • addItemConfigError

        protected void addItemConfigError​(@NonNull
                                          @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem,
                                          @NonNull
                                          @NonNull String errorCode,
                                          @NonNull
                                          @NonNull String errorMessage)
      • getMessage

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

        protected org.springframework.context.MessageSource getMessageSource()
      • getTypeFactory

        protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()