public class DefaultCartResolverService extends Object implements CartResolverService
| Constructor and Description |
|---|
DefaultCartResolverService(CartOperationService cartOperationService,
com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
applicationMatches(com.broadleafcommerce.cart.client.domain.Cart cart,
String applicationId) |
protected boolean |
contextMatches(com.broadleafcommerce.cart.client.domain.Cart cart,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) |
protected boolean |
customerHasAccessToCart(com.broadleafcommerce.cart.client.domain.Cart cart,
com.broadleafcommerce.cart.client.domain.CustomerRef customer,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) |
protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils |
getAuthenticationUtils() |
protected CartOperationService |
getCartOperationService() |
Optional<com.broadleafcommerce.cart.client.domain.Cart> |
resolveCartById(String cartId,
com.broadleafcommerce.cart.client.domain.CustomerRef customer,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Resolves a
Cart given the cart ID, customer, and context. |
Optional<com.broadleafcommerce.cart.client.domain.Cart> |
resolveCartByStatus(@NonNull Collection<String> status,
com.broadleafcommerce.cart.client.domain.CustomerRef customer,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Resolves the
Cart with the first matching status for the given customer and context. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitresolveCartByStatus, resolveInProcessCartpublic DefaultCartResolverService(CartOperationService cartOperationService, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils)
public Optional<com.broadleafcommerce.cart.client.domain.Cart> resolveCartById(String cartId, @Nullable com.broadleafcommerce.cart.client.domain.CustomerRef customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
CartResolverServiceCart given the cart ID, customer, and context.
If the provided CustomerRef is not registered, this will resolve a guest cart for the
given ID and context. If the cart is found to be a customer cart, this will return as empty,
because an anonymous customer can only access guest carts.
If the provided CustomerRef is registered, this will resolve a customer cart for the
given customer, ID, and context. If the cart is found to be a guest cart, this will return as
empty.
If no cart is found, this will return an empty optional.
resolveCartById in interface CartResolverServicecartId - the cart IDcustomer - the customercontextInfo - the context infopublic Optional<com.broadleafcommerce.cart.client.domain.Cart> resolveCartByStatus(@NonNull @NonNull Collection<String> status, @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
CartResolverServiceCart with the first matching status for the given customer and context.
This method will iterate through each status, in given order, and attempt to retrieve a cart for that status. The first accessible cart retrieved for a status will be returned.
If no cart is found, this will return an empty optional.
resolveCartByStatus in interface CartResolverServicestatus - the statuses to checkcustomer - the customercontextInfo - the context infoprotected boolean contextMatches(com.broadleafcommerce.cart.client.domain.Cart cart,
@Nullable
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
protected boolean applicationMatches(com.broadleafcommerce.cart.client.domain.Cart cart,
@Nullable
String applicationId)
protected boolean customerHasAccessToCart(com.broadleafcommerce.cart.client.domain.Cart cart,
@Nullable
com.broadleafcommerce.cart.client.domain.CustomerRef customer,
@Nullable
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
protected CartOperationService getCartOperationService()
protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils()
Copyright © 2021. All rights reserved.