Class DefaultCartApprovalValidationService
- java.lang.Object
-
- com.broadleafcommerce.cartoperation.service.approval.DefaultCartApprovalValidationService
-
- All Implemented Interfaces:
CartApprovalValidationService
public class DefaultCartApprovalValidationService extends Object implements CartApprovalValidationService
The default implementation ofCartApprovalValidationService.
-
-
Constructor Summary
Constructors Constructor Description DefaultCartApprovalValidationService(org.springframework.context.MessageSource messageSource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String[]getCartApproverPermissions()Retrieves the permissions that a user should have to perform cart approver-specific actions, such as submitting cart or rejecting cart.protected StringgetMessage(@NonNull String errorMessage, Object... args)protected org.springframework.context.MessageSourcegetMessageSource()protected com.broadleafcommerce.data.tracking.core.policy.trackable.TrackablePolicyUtilsgetPolicyUtils()protected List<String>getValidRequestApprovalStatuses()Retrieve the list of statuses which are considered valid to request cart approval.protected List<String>getValidRequestRejectionStatuses()Retrieve the list of statuses which are considered valid to reject a cart.voidsetPolicyUtils(com.broadleafcommerce.data.tracking.core.policy.trackable.TrackablePolicyUtils policyUtils)protected voidvalidateCartStatusForRejection(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)Validates that the cart is in a validCart.getStatus()for rejectionprotected voidvalidateCartStatusForRequestApproval(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)Validates that the cart is in a validCart.getStatus()for requesting approval.voidvalidateRequestForRejection(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer, @NonNull CartApprovalProcessRequest cartApprovalProcessRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Method that calls all validators performing checks on conditions necessary for a cart to be rejected.voidvalidateSubmitForApproval(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer, @NonNull CartApprovalProcessRequest cartApprovalProcessRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Method that calls all validators performing checks on conditions necessary for a cart to be submitted for approval.voidvalidateUserIsCartReviewer(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Validates that the user has the correct access to reject or submit the givenCart.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.broadleafcommerce.cartoperation.service.approval.CartApprovalValidationService
validateCartSubmission
-
-
-
-
Method Detail
-
validateSubmitForApproval
public void validateSubmitForApproval(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer, @NonNull @NonNull CartApprovalProcessRequest cartApprovalProcessRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Description copied from interface:CartApprovalValidationServiceMethod that calls all validators performing checks on conditions necessary for a cart to be submitted for approval.- Specified by:
validateSubmitForApprovalin interfaceCartApprovalValidationService- Parameters:
cart- TheCartthat is being submitted for approval.customer- TheCustomerRefof the user who is submitting the cart for approval.cartApprovalProcessRequest- theCartApprovalProcessRequestpassed in byCartApprovalServicecontextInfo- context information around sandbox and multitenant state.
-
validateRequestForRejection
public void validateRequestForRejection(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer, @NonNull @NonNull CartApprovalProcessRequest cartApprovalProcessRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Description copied from interface:CartApprovalValidationServiceMethod that calls all validators performing checks on conditions necessary for a cart to be rejected.- Specified by:
validateRequestForRejectionin interfaceCartApprovalValidationService- Parameters:
cart- TheCartthat is rejected.customer- TheCustomerRefof the user who is rejecting the cart.cartApprovalProcessRequest- theCartApprovalProcessRequestpassed in byCartApprovalServicecontextInfo- context information around sandbox and multitenant state
-
validateUserIsCartReviewer
public void validateUserIsCartReviewer(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Description copied from interface:CartApprovalValidationServiceValidates that the user has the correct access to reject or submit the givenCart.- Specified by:
validateUserIsCartReviewerin interfaceCartApprovalValidationService- Parameters:
cart- theCartthat the user is attempting to accesscustomerRef- theCustomerRefrepresenting the user to validate againstcontextInfo- context information around sandbox and multitenant state
-
validateCartStatusForRequestApproval
protected void validateCartStatusForRequestApproval(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)Validates that the cart is in a validCart.getStatus()for requesting approval.- Parameters:
cart- TheCartthat's being submitted for approval.- Throws:
CartApprovalValidationException- if the cart status is not valid to request approval.
-
validateCartStatusForRejection
protected void validateCartStatusForRejection(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)Validates that the cart is in a validCart.getStatus()for rejection- Parameters:
cart- TheCartthat's being rejected- Throws:
CartApprovalValidationException- if the cart status is not valid to request approval.
-
getValidRequestApprovalStatuses
protected List<String> getValidRequestApprovalStatuses()
Retrieve the list of statuses which are considered valid to request cart approval.Custom valid statuses to request cart for approval should be added here.
- Returns:
- the list of statuses which are considered valid to request cart approval
-
getValidRequestRejectionStatuses
protected List<String> getValidRequestRejectionStatuses()
Retrieve the list of statuses which are considered valid to reject a cart.Custom valid statuses to reject a cart should be added here.
- Returns:
- the list of statuses which are considered valid to reject a cart
-
getCartApproverPermissions
protected String[] getCartApproverPermissions()
Retrieves the permissions that a user should have to perform cart approver-specific actions, such as submitting cart or rejecting cart.Custom cart approver permissions should be added here.
- Returns:
- the permissions that a user should have to perform cart approver-specific actions
-
getMessage
protected String getMessage(@NonNull @NonNull String errorMessage, @Nullable Object... args)
-
getMessageSource
protected org.springframework.context.MessageSource getMessageSource()
-
getPolicyUtils
@Nullable protected com.broadleafcommerce.data.tracking.core.policy.trackable.TrackablePolicyUtils getPolicyUtils()
-
setPolicyUtils
@Autowired(required=false) public void setPolicyUtils(@Nullable com.broadleafcommerce.data.tracking.core.policy.trackable.TrackablePolicyUtils policyUtils)
-
-