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 -
Constructor Summary
ConstructorsConstructorDescriptionCustomerRefHandlerMethodArgumentResolver(com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.order.common.domain.CustomerRefBuilds theCustomerRefobject.protected com.broadleafcommerce.order.common.domain.CustomerRefBuilds aCustomerRefspecifically for a CSR operating as themselves rather than impersonating a customer or anonymous guest.lprotected Optional<ResolveCustomerRef>findAnnotation(org.springframework.core.MethodParameter param) protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtilsprotected com.broadleafcommerce.common.extension.TypeFactoryprotected voidhandleRegisteredOnly(ResolveCustomerRef annotation) protected voidpopulateAccountFields(@NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef) Populates the account-related fields for the givenCustomerReffrom 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) booleansupportsParameter(org.springframework.core.MethodParameter parameter)
-
Field Details
-
clazz
-
-
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:
supportsParameterin interfaceorg.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:
resolveArgumentin interfaceorg.springframework.web.method.support.HandlerMethodArgumentResolver
-
buildCustomerRef
protected com.broadleafcommerce.order.common.domain.CustomerRef buildCustomerRef()Builds theCustomerRefobject. Takes into account whether the user is a CSR.- Returns:
- The
CustomerRefobject.
-
buildCustomerRefForSalesRep
protected com.broadleafcommerce.order.common.domain.CustomerRef buildCustomerRefForSalesRep()Builds aCustomerRefspecifically for a CSR operating as themselves rather than impersonating a customer or anonymous guest.l- Returns:
- The
CustomerRefobject.
-
findAnnotation
protected Optional<ResolveCustomerRef> findAnnotation(org.springframework.core.MethodParameter param) -
handleRegisteredOnly
-
populateAccountFields
protected void populateAccountFields(@NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef) Populates the account-related fields for the givenCustomerReffrom current authentication context.- Parameters:
customerRef- theCustomerRefto populate the account-related fields for
-
getAuthenticationUtils
protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-