Class CustomerRefHandlerMethodArgumentResolver

java.lang.Object
com.broadleafcommerce.cartoperation.web.resolver.CustomerRefHandlerMethodArgumentResolver
All Implemented Interfaces:
org.springframework.web.method.support.HandlerMethodArgumentResolver

public class CustomerRefHandlerMethodArgumentResolver extends Object implements org.springframework.web.method.support.HandlerMethodArgumentResolver
Resolves the CustomerRef parameter for controller methods that require it.
Author:
Chris Kittrell
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final Class<ResolveCustomerRef>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    CustomerRefHandlerMethodArgumentResolver(com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.broadleafcommerce.order.common.domain.CustomerRef
    Builds the CustomerRef object.
    protected com.broadleafcommerce.order.common.domain.CustomerRef
    Builds a CustomerRef specifically for a CSR operating as themselves rather than impersonating a customer or anonymous guest.l
    findAnnotation(org.springframework.core.MethodParameter param)
     
    protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils
     
    protected com.broadleafcommerce.common.extension.TypeFactory
     
    protected void
     
    protected void
    populateAccountFields(@NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef)
    Populates the account-related fields for the given CustomerRef from current authentication context.
    resolveArgument(org.springframework.core.MethodParameter parameter, org.springframework.web.method.support.ModelAndViewContainer mavContainer, org.springframework.web.context.request.NativeWebRequest webRequest, org.springframework.web.bind.support.WebDataBinderFactory binderFactory)
     
    boolean
    supportsParameter(org.springframework.core.MethodParameter parameter)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • CustomerRefHandlerMethodArgumentResolver

      public CustomerRefHandlerMethodArgumentResolver(com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • Method Details

    • supportsParameter

      public boolean supportsParameter(org.springframework.core.MethodParameter parameter)
      Specified by:
      supportsParameter in interface org.springframework.web.method.support.HandlerMethodArgumentResolver
    • resolveArgument

      public Object resolveArgument(@Nullable org.springframework.core.MethodParameter parameter, org.springframework.web.method.support.ModelAndViewContainer mavContainer, @Nullable org.springframework.web.context.request.NativeWebRequest webRequest, org.springframework.web.bind.support.WebDataBinderFactory binderFactory)
      Specified by:
      resolveArgument in interface org.springframework.web.method.support.HandlerMethodArgumentResolver
    • buildCustomerRef

      protected com.broadleafcommerce.order.common.domain.CustomerRef buildCustomerRef()
      Builds the CustomerRef object. Takes into account whether the user is a CSR.
      Returns:
      The CustomerRef object.
    • buildCustomerRefForSalesRep

      protected com.broadleafcommerce.order.common.domain.CustomerRef buildCustomerRefForSalesRep()
      Builds a CustomerRef specifically for a CSR operating as themselves rather than impersonating a customer or anonymous guest.l
      Returns:
      The CustomerRef object.
    • findAnnotation

      protected Optional<ResolveCustomerRef> findAnnotation(org.springframework.core.MethodParameter param)
    • handleRegisteredOnly

      protected void handleRegisteredOnly(ResolveCustomerRef annotation)
    • populateAccountFields

      protected void populateAccountFields(@NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef)
      Populates the account-related fields for the given CustomerRef from current authentication context.
      Parameters:
      customerRef - the CustomerRef to populate the account-related fields for
    • getAuthenticationUtils

      protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils()
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()