Class DefaultCartStatusManager
java.lang.Object
com.broadleafcommerce.cartoperation.service.status.DefaultCartStatusManager
- All Implemented Interfaces:
CartStatusManager
-
Constructor Summary
ConstructorDescriptionDefaultCartStatusManager
(List<CartStatusHandler> cartStatusHandlers, CartProvider cartProvider, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected ChangeCartStatusRequest
buildChangeCartStatusRequestForValidation
(@NonNull CartStatusValidationRequest validationRequest) Builds aChangeCartStatusRequest
used for validation purposes for checkout submission.com.broadleafcommerce.cart.client.domain.Cart
changeStatus
(@NonNull ChangeCartStatusRequest changeStatusRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Changes theCart.getStatus()
to a specified status.protected CartProvider
protected List<CartStatusHandler>
protected com.broadleafcommerce.common.extension.TypeFactory
protected Supplier<UnsupportedOperationException>
getUnsupportedOperationExceptionSupplier
(@NonNull ChangeCartStatusRequest changeStatusRequest) void
validateStatusIsReadableByUser
(@NonNull CartStatusValidationRequest validationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines if the givenCart
is readable by the currently authenticated user based on its status and workflow.void
validateStatusIsUpdatableByUser
(@NonNull CartStatusValidationRequest validationRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines if the givenCart
is updatable by the currently authenticated user based on its current status and workflow.void
validateStatusTransition
(@NonNull ChangeCartStatusRequest changeStatusRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates the status transition is valid.
-
Constructor Details
-
DefaultCartStatusManager
public DefaultCartStatusManager(List<CartStatusHandler> cartStatusHandlers, CartProvider cartProvider, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
changeStatus
public com.broadleafcommerce.cart.client.domain.Cart changeStatus(@NonNull @NonNull ChangeCartStatusRequest changeStatusRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CartStatusManager
Changes theCart.getStatus()
to a specified status.- Specified by:
changeStatus
in interfaceCartStatusManager
- Parameters:
changeStatusRequest
- theChangeCartStatusRequest
to facilitate the cart status changecontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- the
Cart
with the updated status
-
validateStatusTransition
public void validateStatusTransition(@NonNull @NonNull ChangeCartStatusRequest changeStatusRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CartStatusManager
Validates the status transition is valid.- Specified by:
validateStatusTransition
in interfaceCartStatusManager
- Parameters:
changeStatusRequest
- theChangeCartStatusRequest
to facilitate the cart status changecontextInfo
- context information surrounding sandboxing and multitenant state
-
validateStatusIsReadableByUser
public void validateStatusIsReadableByUser(@NonNull @NonNull CartStatusValidationRequest validationRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CartStatusManager
Determines if the givenCart
is readable by the currently authenticated user based on its status and workflow.- Specified by:
validateStatusIsReadableByUser
in interfaceCartStatusManager
- Parameters:
validationRequest
- theCartStatusValidationRequest
containing the details for the validationcontextInfo
- context information surrounding sandboxing and multitenant state- See Also:
-
validateStatusIsUpdatableByUser
public void validateStatusIsUpdatableByUser(@NonNull @NonNull CartStatusValidationRequest validationRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CartStatusManager
Determines if the givenCart
is updatable by the currently authenticated user based on its current status and workflow.For example, the flow being processed may be
DefaultCartOperationFlows.UPDATE_CONTACT_INFO
, which is allowed for aDefaultQuoteStatuses.PUBLISHED
quote. However, other operations such as add item to quote may not be permitted in theDefaultQuoteStatuses.PUBLISHED
status.- Specified by:
validateStatusIsUpdatableByUser
in interfaceCartStatusManager
- Parameters:
validationRequest
- theCartStatusValidationRequest
containing the details for the validationcontextInfo
- context information surrounding sandboxing and multitenant state- See Also:
-
buildChangeCartStatusRequestForValidation
protected ChangeCartStatusRequest buildChangeCartStatusRequestForValidation(@NonNull @NonNull CartStatusValidationRequest validationRequest) Builds aChangeCartStatusRequest
used for validation purposes for checkout submission.- Parameters:
validationRequest
- theCartStatusValidationRequest
containing the details for the validation- Returns:
- a
ChangeCartStatusRequest
based on the given params
-
getUnsupportedOperationExceptionSupplier
protected Supplier<UnsupportedOperationException> getUnsupportedOperationExceptionSupplier(@NonNull @NonNull ChangeCartStatusRequest changeStatusRequest) -
getCartStatusHandlers
-
getCartProvider
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-