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
ConstructorsModifierConstructorDescriptionprotectedAbstractAccountCartStatusHandler(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.CartActionAuditbuildCartActionAuditForAccountCartUpdate(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String actionType, String userType) booleancanHandle(ChangeCartStatusRequest changeStatusRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines if this handler can handle the status change.protected CartUtilsprotected booleanisAccountCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart) protected booleanisCartOwner(@NonNull ChangeCartStatusRequest changeStatusRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines if the givenCustomerRefis the owner of the givenCart.protected ChangeCartStatusRequestpostProcessStatusChange(@NonNull ChangeCartStatusRequest changeStatusRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Perform any additional handling after theCarthas changed status.protected ChangeCartStatusRequestprocessStatusChange(@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:CartStatusHandlerDetermines if this handler can handle the status change.- Specified by:
canHandlein interfaceCartStatusHandler- Overrides:
canHandlein classAbstractCartStatusChangeHandler- Parameters:
changeStatusRequest- theChangeCartStatusRequestto 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:AbstractCartStatusChangeHandlerDetermines if the givenCustomerRefis the owner of the givenCart.- Overrides:
isCartOwnerin classAbstractCartStatusChangeHandler- Parameters:
changeStatusRequest- theChangeCartStatusRequestto 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:AbstractCartStatusChangeHandlerPerform 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:
processStatusChangein classAbstractCartStatusChangeHandler- Parameters:
changeStatusRequest- theChangeCartStatusRequestto facilitate the cart status changecontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- the
ChangeCartStatusRequestwith the updated cart
-
postProcessStatusChange
protected ChangeCartStatusRequest postProcessStatusChange(@NonNull @NonNull ChangeCartStatusRequest changeStatusRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from class:AbstractCartStatusChangeHandlerPerform any additional handling after theCarthas changed status.By default, this does nothing. This serves as a hook point for customization.
- Overrides:
postProcessStatusChangein classAbstractCartStatusChangeHandler- Parameters:
changeStatusRequest- theChangeCartStatusRequestto 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
-