Class AuthorizableQueryManager


  • public class AuthorizableQueryManager
    extends Object
    This class handles the translation of queries for users and groups from a JSON format to the query model of Jackrabbit's user groups search (see UserManager#findAuthorizables(Query)). The JSON query format is defined as follows:
    {
      ( selector: "authorizable" | "user" | "group" )?        // Defaults to "authorizable", see QueryBuilder#setSelector()
    
      (
        scope:                                                // See QueryBuilder#setScope()
        {
          groupName: /* group name (String) * /
          ( declaredOnly: true | false )                      // Defaults to true
        }
      ) ?                                                     // Defaults to all
    
      ( condition: [ CONJUNCTION+ ] ) ?                       // Defaults to a 'true' condition, see QueryBuilder#setCondition()
    
      (
        order | sort:                                         // See QueryBuilder#setOrder()
        {
          property: /* relative path (String) * /
          ( direction: "asc" | "desc" )                       // Defaults to "asc"
          ( ignoreCase: true | false )                        // Defaults to "true", see QueryBuilder#setSortOrder()
        }
      ) ?                                                     // Defaults to document order
    
      (
        limit:                                                // See QueryBuilder#setLimit()
        {
          offset: /* Positive Integer * /                     // Takes precedence over bound if both are given
          bound:  /* String, Number, Boolean * /
          max:    /* Positive Integer or -1 * /               // Defaults to no limit (-1)
        }
      ) ?                                                     // Defaults to all
    }
    
    CONJUNCTION ::= COMPOUND | PRIMITIVE
    COMPOUND    ::= [ PRIMITIVE+ ]
    PRIMITIVE   ::= { ATOM | NEGATION }
    NEGATION    ::= not: { ATOM }                             // See QueryBuilder#not()
    ATOM        ::= named: /* pattern * /                     // Users, groups of that name. See QueryBuilder#nameMatches()
                |   exists: /* relative path * /              // See QueryBuilder#exists()
                |   impersonates: /* authorizable name * /    // See QueryBuilder#impersonates()
                |   RELOP:
                    {
                      property: /* relative path * /
                      value: /* String, Number, Boolean * /   // According to the type of the property
                    }
                |   like:                                     // See QueryBuilder#like()
                    {
                      property: /* relative path * /
                      pattern: /* pattern * /
                    }
                |   contains:                                 // See QueryBuilder#contains()
                    {
                      property: /* relative path * /
                      expression: /* search expression * /
                    }
    RELOP       ::= neq | eq | lt | le | gt | ge              // See QueryBuilder#neq(), QueryBuilder#eq(), ...
    
    • A relative path refers to a property or a child node of an user or a group. Property names need to be prefixed with the at (@) character. Invalid JCR characters need proper escaping. The current path is denoted by a dot (.).
    • In a 'pattern' the percent character (%) represents any string of zero or more characters and the underscore character (_) represents any single character. Any literal use of these characters and the backslash character (\) must be escaped with a backslash character. The pattern is matched against Authorizable#getID() and Authorizable#getPrincipal().
    • The syntax of 'expression' is [-]value { [OR] [-]value }.