Class ScimSort

java.lang.Object
org.mockserver.scim.ScimSort

public class ScimSort extends Object
Minimal SCIM 2.0 sort evaluator implementing the sortBy + sortOrder query parameters (RFC 7644 §3.4.2.3).
  • sortBy is a (possibly nested, dot-separated) attribute path, e.g. userName or name.familyName. Comparison is case-insensitive (SCIM string attributes default to caseExact:false).
  • sortOrder is ascending (default) or descending.
  • Resources whose sort attribute has no value are always ordered last, regardless of sortOrder.
  • The sort is stable, so resources comparing equal keep their prior (filtered, insertion) order.

A syntactically invalid sortBy path, or a sortOrder other than ascending/descending, is a loud IllegalArgumentException (surfaced by the callback as a 400 invalidValue SCIM error) — mirroring how ScimFilter rejects a malformed filter.

  • Method Details

    • parse

      public static ScimSort parse(String sortBy, String sortOrder)
      Parses the sortBy/sortOrder query parameters.
      Returns:
      the parsed sort, or null if sortBy is blank (no sorting requested)
      Throws:
      IllegalArgumentException - if sortBy is a malformed attribute path, or sortOrder is present but not ascending/descending
    • apply

      public List<com.fasterxml.jackson.databind.node.ObjectNode> apply(List<com.fasterxml.jackson.databind.node.ObjectNode> resources)
      Returns a new list of the supplied resources ordered by this sort. The input list is not mutated.
    • getSortBy

      public String getSortBy()
    • isDescending

      public boolean isDescending()