Class QuoteFunctionalitiesAspect

java.lang.Object
com.broadleafcommerce.cartoperation.aspect.QuoteFunctionalitiesAspect

public class QuoteFunctionalitiesAspect extends Object
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 Details

    • UNRESTRICTED_METHODS

      protected static final Set<String> 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 checking QuoteProperties.isEnabled(ContextInfo) with the ContextInfo found in JoinPoint.getArgs().
      Parameters:
      joinPoint - the JoinPoint for finding the ContextInfo 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 on getUnrestrictedMethods().
      Parameters:
      joinPoint - the JoinPoint to evaluate
      Returns:
      true if the method being called is an unrestricted method based on getUnrestrictedMethods(), otherwise false
    • getUnrestrictedMethods

      protected Set<String> getUnrestrictedMethods()
      Gets a set of method names that are unrestricted from the QuoteProperties.isEnabled(ContextInfo) validation.