Class SortPositionRequest

java.lang.Object
com.broadleafcommerce.data.tracking.core.sort.SortPositionRequest

public class SortPositionRequest extends Object
Represents a request to update an entity identified by updateContextId with a new sort value that is calculated by identifying the entity it should be positioned after (specified via positionAfterContextId). If the positionAfterContextId value is not specified, it is assumed the request is to set the new sort value to the first position in the sorted group.

This request generally works in conjunction with Sorted business domain, Sortable repository domain, and a SortPositionStrategy instance.

SortPositionRequestHandlerMethodArgumentResolver allows for dynamic creation of SortPositionRequest when the class is used as a method parameter in a Controller. By default, it will populate the request using the request's path for updateContextId and a parameter for positionAfterContextId. To specify non-default values for the names of path variable and URL parameter, see UpdateSortOperation.

Author:
Jeff Fischer
See Also:
  • Constructor Details

    • SortPositionRequest

      public SortPositionRequest(String updateContextId)
    • SortPositionRequest

      public SortPositionRequest(String positionAfterContextId, String positionBeforeContextId, String updateContextId)
  • Method Details

    • withAfterContextId

      public SortPositionRequest withAfterContextId(String afterContextId)
    • withBeforeContextId

      public SortPositionRequest withBeforeContextId(String beforeContextId)
    • getPositionAfterContextId

      public String getPositionAfterContextId()
      Context ID of the item after which to place the item specified by updateContextId. Optional. If neither this nor positionBeforeContextId are provided, this means that the item should move to the 1st position relative to other items.
    • getPositionBeforeContextId

      public String getPositionBeforeContextId()
      Context ID of the item before which to place the item specified by updateContextId. Optional. If neither this nor positionAfterContextId are provided, this means that the item should move to the 1st position relative to other items.

      Note that positionAfterContextId takes precedence if both are present.

    • getUpdateContextId

      public String getUpdateContextId()
      Context ID of the item for which Sortable.getSorting() should be updated.
    • setPositionAfterContextId

      public void setPositionAfterContextId(String positionAfterContextId)
      Context ID of the item after which to place the item specified by updateContextId. Optional. If neither this nor positionBeforeContextId are provided, this means that the item should move to the 1st position relative to other items.
    • setPositionBeforeContextId

      public void setPositionBeforeContextId(String positionBeforeContextId)
      Context ID of the item before which to place the item specified by updateContextId. Optional. If neither this nor positionAfterContextId are provided, this means that the item should move to the 1st position relative to other items.

      Note that positionAfterContextId takes precedence if both are present.

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object