Class CartUtils
java.lang.Object
com.broadleafcommerce.cartoperation.service.util.cart.CartUtils
- Author:
- Dima Myroniuk (dmyroniuk)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanUpdateInternalAttributes(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines if the user has permissions to mutate cart internal attributes.protected com.broadleafcommerce.data.tracking.core.policy.trackable.TrackablePolicyUtilsbooleanhasPermissions(@NonNull Set<String> requiredPermissions, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates that the currently authenticated user has the given permissions.com.broadleafcommerce.cart.client.domain.CartremoveFulfillmentItemsWithoutCartItems(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart) Removes the fulfillment items from theCartif there are noCartItemsfound for them.voidresetFulfillmentGroupReferenceNumbers(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart) Resets the fulfillment group reference number.voidsetPolicyUtils(com.broadleafcommerce.data.tracking.core.policy.trackable.TrackablePolicyUtils policyUtils)
-
Field Details
-
ALL_CART_INTERNAL_ATTRIBUTE_PERMISSION
- See Also:
-
UPDATE_CART_INTERNAL_ATTRIBUTE_PERMISSION
- See Also:
-
-
Constructor Details
-
CartUtils
public CartUtils()
-
-
Method Details
-
removeFulfillmentItemsWithoutCartItems
public com.broadleafcommerce.cart.client.domain.Cart removeFulfillmentItemsWithoutCartItems(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart) Removes the fulfillment items from theCartif there are noCartItemsfound for them.- Parameters:
cart- cart to remove the fulfillment items- Returns:
- the updated cart
-
resetFulfillmentGroupReferenceNumbers
public void resetFulfillmentGroupReferenceNumbers(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart) Resets the fulfillment group reference number.- Parameters:
cart- cart to reset the fulfillment group reference number
-
canUpdateInternalAttributes
public boolean canUpdateInternalAttributes(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines if the user has permissions to mutate cart internal attributes.- Parameters:
contextInfo- context information surrounding sandboxing and multitenant state
-
hasPermissions
public boolean hasPermissions(@NonNull @NonNull Set<String> requiredPermissions, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates that the currently authenticated user has the given permissions.- Parameters:
requiredPermissions- a set of required permissions to validatecontextInfo- context information surrounding sandboxing and multitenant state
-
setPolicyUtils
@Autowired(required=false) public void setPolicyUtils(com.broadleafcommerce.data.tracking.core.policy.trackable.TrackablePolicyUtils policyUtils) -
getPolicyUtils
protected com.broadleafcommerce.data.tracking.core.policy.trackable.TrackablePolicyUtils getPolicyUtils()
-