Class SortPositionRequestHandlerMethodArgumentResolver

java.lang.Object
com.broadleafcommerce.data.tracking.core.sort.SortPositionRequestHandlerMethodArgumentResolver
All Implemented Interfaces:
org.springframework.web.method.support.HandlerMethodArgumentResolver

public class SortPositionRequestHandlerMethodArgumentResolver extends Object implements org.springframework.web.method.support.HandlerMethodArgumentResolver
Allows the use of SortPositionRequest within @RequestMapping method parameters. Construction of this parameter object requires the requesting URL specify an {id} path variable, and an optional "after" request parameter. This can be used in conjunction with the annotation UpdateSortOperation to control the names of the id path variable and the "after" request parameter.

By default, this will only populate a SortPositionRequest if the method parameter does not have the RequestBody annotation. If it does, then a properly JSON serialized version of SortPositionRequest should be provided in the request body. The id path variable and "after" request parameter will both be ignored, then.

Author:
Jeff Fischer, Nathan Moore (nathandmoore)
  • Field Details

  • Constructor Details

    • SortPositionRequestHandlerMethodArgumentResolver

      public SortPositionRequestHandlerMethodArgumentResolver()
  • Method Details

    • supportsParameter

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

      public Object 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)
      Specified by:
      resolveArgument in interface org.springframework.web.method.support.HandlerMethodArgumentResolver
    • getDefaultUpdateIdName

      @NonNull protected String getDefaultUpdateIdName()
      If UpdateSortOperation is missing on the method parameter, this is used to supply a default value for SortPositionRequest.updateContextId.
      Returns:
      default value for the name of the path variable from which to populated SortPositionRequest.updateContextId.
    • getDefaultAfterIdName

      @NonNull protected String getDefaultAfterIdName()
      If UpdateSortOperation is missing on the method parameter, this is used to supply a default value for SortPositionRequest.positionAfterContextId.
      Returns:
      default value for the name of the URL parameter from which to populated SortPositionRequest.positionAfterContextId.
    • getDefaultBeforeIdName

      @NonNull protected String getDefaultBeforeIdName()
      If UpdateSortOperation is missing on the method parameter, this is used to supply a default value for SortPositionRequest.positionBeforeContextId.
      Returns:
      default value for the name of the URL parameter from which to populated SortPositionRequest.positionBeforeContextId.
    • buildSortPositionRequest

      @NonNull protected SortPositionRequest buildSortPositionRequest(org.springframework.web.context.request.NativeWebRequest req, String updateIdName, String afterIdName, String beforeIdName)
    • getPathVariables

      protected Map<String,String> getPathVariables(org.springframework.web.context.request.NativeWebRequest webRequest)