public class DefaultItemChoiceConfigurationService extends Object implements ItemChoiceConfigurationService
Constructor and Description |
---|
DefaultItemChoiceConfigurationService(org.springframework.context.MessageSource messageSource,
com.broadleafcommerce.common.extension.TypeFactory typeFactory) |
Modifier and Type | Method and Description |
---|---|
protected void |
addItemConfigError(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem,
@NonNull ItemChoice itemChoice,
@NonNull String errorCode,
@NonNull String errorMessage) |
protected List<com.broadleafcommerce.cart.client.domain.CartItem> |
findAndHydrateDependentsInCategory(@NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> dependentCartItems,
@NonNull ItemChoice itemChoice) |
protected List<com.broadleafcommerce.cart.client.domain.CartItem> |
findAndHydrateDependentsMatchingItemChoice(@NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> dependentCartItems,
@NonNull ItemChoice itemChoice) |
protected List<com.broadleafcommerce.cart.client.domain.CartItem> |
findAndHydrateDependentsMatchingProducts(@NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> dependentCartItems,
@NonNull ItemChoice itemChoice) |
protected List<com.broadleafcommerce.cart.client.domain.CartItem> |
findAndHydrateDependentsMatchingVariants(@NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> dependentCartItems,
@NonNull ItemChoice itemChoice) |
protected MatchingDependentsContext |
findDependentsMatchingItemChoice(@NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> dependentCartItems,
@NonNull ItemChoice itemChoice) |
protected String |
getMessage(@NonNull String errorMessage,
Object... args) |
protected org.springframework.context.MessageSource |
getMessageSource() |
protected com.broadleafcommerce.common.extension.TypeFactory |
getTypeFactory() |
protected void |
hydrateItemChoicePricingDetails(@NonNull ItemChoice itemChoice,
@NonNull com.broadleafcommerce.cart.client.domain.CartItem dependentCartItem)
Hydrates the pricing details for the parent
ItemChoice on the dependent CartItem representing a specific choice. |
protected boolean |
isDiscountAllowed(@NonNull ItemChoice itemChoice) |
protected boolean |
isDiscountAllowed(@NonNull ItemChoice itemChoice,
SpecificItemChoice specificItemChoice) |
void |
populateItemChoice(com.broadleafcommerce.cart.client.domain.CartItem cartItem,
ProductOption option,
List<com.broadleafcommerce.cart.client.domain.CartItem> potentialDependentItems)
Populates item choices in
CartItem.getDependentCartItems() and hydrates them with
pricing information from ItemChoice and SpecificItemChoice . |
void |
validateItemChoice(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem,
@NonNull ProductOption option,
@NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> potentialDependentItems)
Perform validation against the provided
CartItem for the given ProductOption
of type ProductOptionType.isItemChoice(String) . |
protected void |
validateMaxQuantity(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem,
@NonNull ItemChoice itemChoice,
@NonNull MatchingDependentsContext matchingCartItems,
@NonNull ProductOption option) |
protected void |
validateMinQuantity(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem,
@NonNull ItemChoice itemChoice,
@NonNull MatchingDependentsContext matchingCartItems,
@NonNull ProductOption option) |
public DefaultItemChoiceConfigurationService(org.springframework.context.MessageSource messageSource, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
public void populateItemChoice(com.broadleafcommerce.cart.client.domain.CartItem cartItem, ProductOption option, List<com.broadleafcommerce.cart.client.domain.CartItem> potentialDependentItems)
ItemChoiceConfigurationService
CartItem.getDependentCartItems()
and hydrates them with
pricing information from ItemChoice
and SpecificItemChoice
.populateItemChoice
in interface ItemChoiceConfigurationService
cartItem
- The CartItem
on which to populate ItemChoices
.option
- The ProductOption
(and its ProductOption.getItemChoice()
for
the item to populate and hydratepotentialDependentItems
- The list of dependent cart items
to pick from
when populating ItemChoice
.protected List<com.broadleafcommerce.cart.client.domain.CartItem> findAndHydrateDependentsMatchingItemChoice(@NonNull @NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> dependentCartItems, @NonNull @NonNull ItemChoice itemChoice)
protected List<com.broadleafcommerce.cart.client.domain.CartItem> findAndHydrateDependentsInCategory(@NonNull @NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> dependentCartItems, @NonNull @NonNull ItemChoice itemChoice)
protected List<com.broadleafcommerce.cart.client.domain.CartItem> findAndHydrateDependentsMatchingProducts(@NonNull @NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> dependentCartItems, @NonNull @NonNull ItemChoice itemChoice)
protected List<com.broadleafcommerce.cart.client.domain.CartItem> findAndHydrateDependentsMatchingVariants(@NonNull @NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> dependentCartItems, @NonNull @NonNull ItemChoice itemChoice)
protected void hydrateItemChoicePricingDetails(@NonNull @NonNull ItemChoice itemChoice, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem dependentCartItem)
ItemChoice
on the dependent CartItem
representing a specific choice. This information will be needed when
pricing since the ItemChoice.getOverridePrice()
should be used if the specific item
doesn't have its own rather than using the underlying Product's
or
Variant's
.itemChoice
- The parent ItemChoice
of the dependentCartItem
representing
a SpecificItemChoice
.dependentCartItem
- The CartItem
representing a SpecificItemChoice
protected boolean isDiscountAllowed(@NonNull @NonNull ItemChoice itemChoice)
protected boolean isDiscountAllowed(@NonNull @NonNull ItemChoice itemChoice, SpecificItemChoice specificItemChoice)
public void validateItemChoice(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull ProductOption option, @NonNull @NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> potentialDependentItems)
ItemChoiceConfigurationService
CartItem
for the given ProductOption
of type ProductOptionType.isItemChoice(String)
. This will also hydrate
CartItem
with pricing information from ItemChoice
and
SpecificItemChoice
.validateItemChoice
in interface ItemChoiceConfigurationService
cartItem
- The CartItem
to perform item choice
validation
against.option
- The ProductOption
(and it's ProductOption.getItemChoice()
we
are using to validate the cart against.potentialDependentItems
- The list of dependent cart items
to pick from
when validating ItemChoice
.protected MatchingDependentsContext findDependentsMatchingItemChoice(@NonNull @NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> dependentCartItems, @NonNull @NonNull ItemChoice itemChoice)
protected void validateMinQuantity(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull ItemChoice itemChoice, @NonNull @NonNull MatchingDependentsContext matchingCartItems, @NonNull @NonNull ProductOption option)
protected void validateMaxQuantity(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull ItemChoice itemChoice, @NonNull @NonNull MatchingDependentsContext matchingCartItems, @NonNull @NonNull ProductOption option)
protected String getMessage(@NonNull @NonNull String errorMessage, @Nullable Object... args)
protected void addItemConfigError(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull ItemChoice itemChoice, @NonNull @NonNull String errorCode, @NonNull @NonNull String errorMessage)
protected org.springframework.context.MessageSource getMessageSource()
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
Copyright © 2021. All rights reserved.