Class AbstractAccountCartStatusHandler
java.lang.Object
com.broadleafcommerce.cartoperation.service.status.AbstractCartStatusChangeHandler
com.broadleafcommerce.cartoperation.service.status.accountcart.AbstractAccountCartStatusHandler
- All Implemented Interfaces:
CartStatusHandler
- Direct Known Subclasses:
ReclaimAccountCartStatusChangeHandler
,RejectedAccountCartStatusChangeHandler
,RequiresApprovalAccountCartStatusChangeHandler
An abstract class to handle the account carts status changes.
- Author:
- Dima Myroniuk (dmyroniuk)
-
Field Summary
Fields inherited from class com.broadleafcommerce.cartoperation.service.status.AbstractCartStatusChangeHandler
INACCESSIBLE_CART_STATUS, USER_AUTHENTICATION_FAILED
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractAccountCartStatusHandler
(com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory, CartUtils cartUtils) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.cart.client.domain.CartActionAudit
buildCartActionAuditForAccountCartUpdate
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String actionType, String userType) boolean
canHandle
(ChangeCartStatusRequest changeStatusRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines if this handler can handle the status change.protected CartUtils
protected boolean
isAccountCart
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart) protected boolean
isCartOwner
(@NonNull ChangeCartStatusRequest changeStatusRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines if the givenCustomerRef
is the owner of the givenCart
.protected ChangeCartStatusRequest
postProcessStatusChange
(@NonNull ChangeCartStatusRequest changeStatusRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Perform any additional handling after theCart
has changed status.protected ChangeCartStatusRequest
processStatusChange
(@NonNull ChangeCartStatusRequest changeStatusRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Perform the status change of theCart
.Methods inherited from class com.broadleafcommerce.cartoperation.service.status.AbstractCartStatusChangeHandler
addCartActionAuditUserInfo, buildCartActionAuditToCreate, canBeReadByUser, canBeTransitionedToByUser, canBeUpdatedByUser, getAuthenticationUtils, getCartActionType, getPolicyUtils, getStatusToHandle, getTypeFactory, getValidOriginatingStatuses, isCartOwner, process, setPolicyUtils, validateOriginatingStatus, validateStatusIsReadableByUser, validateStatusIsUpdatableByUser, validateStatusTransition, validateTransitionRules
-
Constructor Details
-
AbstractAccountCartStatusHandler
protected AbstractAccountCartStatusHandler(com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory, CartUtils cartUtils)
-
-
Method Details
-
canHandle
public boolean canHandle(ChangeCartStatusRequest changeStatusRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CartStatusHandler
Determines if this handler can handle the status change.- Specified by:
canHandle
in interfaceCartStatusHandler
- Overrides:
canHandle
in classAbstractCartStatusChangeHandler
- Parameters:
changeStatusRequest
- theChangeCartStatusRequest
to facilitate the cart status changecontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- true if this handler can handle the status change, otherwise false
-
isCartOwner
protected boolean isCartOwner(@NonNull @NonNull ChangeCartStatusRequest changeStatusRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from class:AbstractCartStatusChangeHandler
Determines if the givenCustomerRef
is the owner of the givenCart
.- Overrides:
isCartOwner
in classAbstractCartStatusChangeHandler
- Parameters:
changeStatusRequest
- theChangeCartStatusRequest
to facilitate the cart status changecontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- true if the currently authenticated user is the owner of the
Cart
, otherwise false
-
processStatusChange
protected ChangeCartStatusRequest processStatusChange(@NonNull @NonNull ChangeCartStatusRequest changeStatusRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from class:AbstractCartStatusChangeHandler
Perform the status change of theCart
.By default, this updates the status and creates a corresponding
CartActionAudit
. This serves as a hook point for additional steps for the status change.- Overrides:
processStatusChange
in classAbstractCartStatusChangeHandler
- Parameters:
changeStatusRequest
- theChangeCartStatusRequest
to facilitate the cart status changecontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- the
ChangeCartStatusRequest
with the updated cart
-
postProcessStatusChange
protected ChangeCartStatusRequest postProcessStatusChange(@NonNull @NonNull ChangeCartStatusRequest changeStatusRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from class:AbstractCartStatusChangeHandler
Perform any additional handling after theCart
has changed status.By default, this does nothing. This serves as a hook point for customization.
- Overrides:
postProcessStatusChange
in classAbstractCartStatusChangeHandler
- Parameters:
changeStatusRequest
- theChangeCartStatusRequest
to facilitate the cart status changecontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- the change status request after performing any additional handling.
-
buildCartActionAuditForAccountCartUpdate
-
isAccountCart
protected boolean isAccountCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart) -
getCartUtils
-