Class QuoteDraftingStatusHandler
java.lang.Object
com.broadleafcommerce.cartoperation.service.status.AbstractCartStatusChangeHandler
com.broadleafcommerce.cartoperation.service.status.quote.AbstractQuoteCartStatusHandler
com.broadleafcommerce.cartoperation.service.status.quote.QuoteDraftingStatusHandler
- All Implemented Interfaces:
CartStatusHandler
Handles a
Cart
in or changing to the DefaultQuoteStatuses.DRAFTING
status.-
Field Summary
Fields inherited from class com.broadleafcommerce.cartoperation.service.status.AbstractCartStatusChangeHandler
INACCESSIBLE_CART_STATUS, USER_AUTHENTICATION_FAILED
-
Constructor Summary
ConstructorDescriptionQuoteDraftingStatusHandler
(com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory, QuoteAuthUtils quoteAuthUtils, com.broadleafcommerce.cart.client.properties.QuoteProperties properties, CartProvider cartProvider, CartOperationService cartOperationService, CartActionAuditOperationService<com.broadleafcommerce.cart.client.domain.CartActionAudit> cartActionAuditOperationService) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
cloneCartActionAudits
(@NonNull ChangeCartStatusRequest changeCartStatusRequest, @NonNull com.broadleafcommerce.cart.client.domain.Cart expiredQuote, @NonNull com.broadleafcommerce.cart.client.domain.Cart clonedQuote, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.cart.client.domain.Cart
cloneQuote
(@NonNull ChangeCartStatusRequest changeStatusRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected CartActionAuditOperationService<com.broadleafcommerce.cart.client.domain.CartActionAudit>
protected String
getCartActionType
(ChangeCartStatusRequest cartStatusRequest) Hook point to determine the cart action type.protected CartOperationService
protected CartProvider
protected String
getCustomerName
(@NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef) Returns a customer name or username (if name is not available).getFirstItemName
(@NonNull ChangeCartStatusRequest changeStatusRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns the name of the first cart item.protected String
Gets the status to handle by this handlerprotected com.broadleafcommerce.common.extension.TypeFactory
getValidOriginatingStatuses
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Only anDefaultCartStatuses.IN_PROCESS
DefaultCartTypes.STANDARD
cart can be converted into aDefaultCartTypes.QUOTE
cart withDefaultQuoteStatuses.DRAFTING
status.protected void
populateQuoteName
(@NonNull ChangeCartStatusRequest changeStatusRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Populates the name of the quote if not already set.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.quote.AbstractQuoteCartStatusHandler
addCartActionAuditUserInfo, canHandle, getProperties, getQuoteAuthUtils, isAssignedToThisQuote, isAssignedToThisQuote, isConvertingToQuote
Methods inherited from class com.broadleafcommerce.cartoperation.service.status.AbstractCartStatusChangeHandler
buildCartActionAuditToCreate, canBeReadByUser, canBeTransitionedToByUser, canBeUpdatedByUser, getAuthenticationUtils, getPolicyUtils, isCartOwner, isCartOwner, postProcessStatusChange, process, setPolicyUtils, validateOriginatingStatus, validateStatusIsReadableByUser, validateStatusIsUpdatableByUser, validateStatusTransition, validateTransitionRules
-
Field Details
-
SECURE_RANDOM
-
-
Constructor Details
-
QuoteDraftingStatusHandler
public QuoteDraftingStatusHandler(com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory, QuoteAuthUtils quoteAuthUtils, com.broadleafcommerce.cart.client.properties.QuoteProperties properties, CartProvider cartProvider, CartOperationService cartOperationService, CartActionAuditOperationService<com.broadleafcommerce.cart.client.domain.CartActionAudit> cartActionAuditOperationService)
-
-
Method Details
-
getStatusToHandle
Description copied from class:AbstractCartStatusChangeHandler
Gets the status to handle by this handler- Specified by:
getStatusToHandle
in classAbstractCartStatusChangeHandler
- Returns:
- the status to handle by this handler
-
getValidOriginatingStatuses
protected Set<String> getValidOriginatingStatuses(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Only anDefaultCartStatuses.IN_PROCESS
DefaultCartTypes.STANDARD
cart can be converted into aDefaultCartTypes.QUOTE
cart withDefaultQuoteStatuses.DRAFTING
status.Moving an
DefaultQuoteStatuses.EXPIRED
quote to this status would effectively clone the quote and shift the cloned quote intoDefaultQuoteStatuses.DRAFTING
status while leaving the originalDefaultQuoteStatuses.EXPIRED
quote untouched.- Specified by:
getValidOriginatingStatuses
in classAbstractCartStatusChangeHandler
- Parameters:
contextInfo
- the contextInfo for the request- Returns:
- a set of valid originating statuses that can transition to the
AbstractCartStatusChangeHandler.getStatusToHandle()
-
getCartActionType
Description copied from class:AbstractCartStatusChangeHandler
Hook point to determine the cart action type.Returns
DefaultQuoteActionTypes.UNKNOWN
by default unless overridden.- Overrides:
getCartActionType
in classAbstractCartStatusChangeHandler
- Parameters:
cartStatusRequest
- the change cart status request- Returns:
DefaultQuoteActionTypes.UNKNOWN
by default unless overridden.
-
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
-
populateQuoteName
protected void populateQuoteName(@NonNull @NonNull ChangeCartStatusRequest changeStatusRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Populates the name of the quote if not already set.By default, the quote name would be
"MM/dd/yyyy HH:mm - CUSTOMER_NAME"
in an account context, and"MM/dd/yyyy HH:mm - {Fist Item's Name}"
in a non-account context.- Parameters:
changeStatusRequest
- theChangeCartStatusRequest
containing the quotecontextInfo
- the contextInfo for the request
-
getFirstItemName
protected Optional<String> getFirstItemName(@NonNull @NonNull ChangeCartStatusRequest changeStatusRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns the name of the first cart item.- Parameters:
changeStatusRequest
- theChangeCartStatusRequest
containing the quotecontextInfo
- the contextInfo for the request- Returns:
- am optional of first item name if exists, otherwise
Optional.empty()
-
getCustomerName
protected String getCustomerName(@NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef) Returns a customer name or username (if name is not available). -
cloneQuote
protected com.broadleafcommerce.cart.client.domain.Cart cloneQuote(@NonNull @NonNull ChangeCartStatusRequest changeStatusRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
cloneCartActionAudits
protected void cloneCartActionAudits(@NonNull @NonNull ChangeCartStatusRequest changeCartStatusRequest, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart expiredQuote, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart clonedQuote, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getCartProvider
-
getCartOperationService
-
getCartActionAuditOperationService
protected CartActionAuditOperationService<com.broadleafcommerce.cart.client.domain.CartActionAudit> getCartActionAuditOperationService() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()- Overrides:
getTypeFactory
in classAbstractCartStatusChangeHandler
-