Class QuoteFunctionalitiesAspect
java.lang.Object
com.broadleafcommerce.cartoperation.aspect.QuoteFunctionalitiesAspect
A Spring AOP Aspect that guards the quote functionalities based on the context from the executed
method's
ContextInfo
argument. If Quote
isn't enabled
for the given context, an UnsupportedOperationException
is thrown.
This validation can be skipped for certain methods in the defined Pointcuts
by
overriding getUnrestrictedMethods()
.
- Author:
- Sunny Yu
-
Field Summary
-
Constructor Summary
ConstructorDescriptionQuoteFunctionalitiesAspect
(com.broadleafcommerce.cart.client.properties.QuoteProperties quoteProperties) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
protected boolean
calledMethodIsUnrestricted
(org.aspectj.lang.JoinPoint joinPoint) Determines if the method being called is an unrestricted method based ongetUnrestrictedMethods()
.protected void
Gets a set of method names that are unrestricted from theQuoteProperties.isEnabled(ContextInfo)
validation.void
guardAddItemToCart
(org.aspectj.lang.JoinPoint joinPoint) void
guardAddManyItemsToCart
(org.aspectj.lang.JoinPoint joinPoint) void
guardCartCreation
(org.aspectj.lang.JoinPoint joinPoint) void
guardQuoteEndpointsAndService
(org.aspectj.lang.JoinPoint joinPoint) protected void
protected void
protected void
validateQuoteIsEnabled
(org.aspectj.lang.JoinPoint joinPoint) Validates if Quote is enabled by checkingQuoteProperties.isEnabled(ContextInfo)
with theContextInfo
found inJoinPoint.getArgs()
.
-
Field Details
-
UNRESTRICTED_METHODS
-
-
Constructor Details
-
QuoteFunctionalitiesAspect
public QuoteFunctionalitiesAspect(com.broadleafcommerce.cart.client.properties.QuoteProperties quoteProperties)
-
-
Method Details
-
quoteEndpoint
protected void quoteEndpoint() -
quoteService
protected void quoteService() -
createCartEndpoint
protected void createCartEndpoint() -
addItemToCartEndpoint
protected void addItemToCartEndpoint() -
addManyItemsToCartEndpoint
protected void addManyItemsToCartEndpoint() -
guardQuoteEndpointsAndService
public void guardQuoteEndpointsAndService(org.aspectj.lang.JoinPoint joinPoint) -
guardCartCreation
public void guardCartCreation(org.aspectj.lang.JoinPoint joinPoint) -
guardAddItemToCart
public void guardAddItemToCart(org.aspectj.lang.JoinPoint joinPoint) -
guardAddManyItemsToCart
public void guardAddManyItemsToCart(org.aspectj.lang.JoinPoint joinPoint) -
validateQuoteIsEnabled
protected void validateQuoteIsEnabled(org.aspectj.lang.JoinPoint joinPoint) Validates if Quote is enabled by checkingQuoteProperties.isEnabled(ContextInfo)
with theContextInfo
found inJoinPoint.getArgs()
.- Parameters:
joinPoint
- theJoinPoint
for finding theContextInfo
from its arguments- Throws:
UnsupportedOperationException
- if Quote functionalities are not enabled for the given context
-
calledMethodIsUnrestricted
protected boolean calledMethodIsUnrestricted(org.aspectj.lang.JoinPoint joinPoint) Determines if the method being called is an unrestricted method based ongetUnrestrictedMethods()
.- Parameters:
joinPoint
- theJoinPoint
to evaluate- Returns:
- true if the method being called is an unrestricted method based on
getUnrestrictedMethods()
, otherwise false
-
getUnrestrictedMethods
Gets a set of method names that are unrestricted from theQuoteProperties.isEnabled(ContextInfo)
validation.
-