Class GQLToQueryBuilderConverter


  • public final class GQLToQueryBuilderConverter
    extends Object
    • Method Detail

      • convertToQueryBuilder

        public static boolean convertToQueryBuilder​(org.apache.sling.api.SlingHttpServletRequest request)
        Checks if request forces QueryBuilder mode
        Parameters:
        request -
        Returns:
      • addLimitAndOffset

        public static Map<String,​String> addLimitAndOffset​(org.apache.sling.api.SlingHttpServletRequest request,
                                                                 Map<String,​String> map)
      • addProperty

        public static Map<String,​String> addProperty​(org.apache.sling.api.SlingHttpServletRequest request,
                                                           Map<String,​String> map,
                                                           String requestKey,
                                                           int count)
      • isValidProperty

        public static boolean isValidProperty​(String key)
      • hasMany

        public static boolean hasMany​(org.apache.sling.api.SlingHttpServletRequest request,
                                      String key)
        Checks if the provided key has more than 1 values (comma delimited)
        Parameters:
        request -
        key -
        Returns:
      • has

        public static boolean has​(org.apache.sling.api.SlingHttpServletRequest request,
                                  String key)
        Checks if the provided key has ANY values (1 or more)
        Parameters:
        request -
        key -
        Returns:
      • get

        public static String get​(org.apache.sling.api.SlingHttpServletRequest request,
                                 String key)
        Returns a single value for a query parameter key
        Parameters:
        request -
        key -
        Returns:
      • getAll

        public static String[] getAll​(org.apache.sling.api.SlingHttpServletRequest request,
                                      String key)
        Returns a String array from a comma delimited list of values
        Parameters:
        request -
        key -
        Returns:
      • put

        public static Map<String,​String> put​(org.apache.sling.api.SlingHttpServletRequest request,
                                                   Map<String,​String> map,
                                                   String predicate,
                                                   int group,
                                                   boolean or)
        Convenience wrapper
        Parameters:
        request -
        map -
        predicate -
        group -
        or -
        Returns:
      • putProperty

        public static Map<String,​String> putProperty​(org.apache.sling.api.SlingHttpServletRequest request,
                                                           Map<String,​String> map,
                                                           String requestKey,
                                                           String predicate,
                                                           int group,
                                                           boolean or)
        Used when the request key is different from the Predicate
        Parameters:
        request -
        map -
        requestKey -
        predicate -
        group -
        or -
        Returns:
      • putAll

        public static Map<String,​String> putAll​(Map<String,​String> map,
                                                      String predicate,
                                                      String[] values,
                                                      int group,
                                                      boolean or)
        Helper method for adding comma delimited values into a Query Builder predicate
        Parameters:
        map -
        predicate -
        values -
        group -
        or -
        Returns:
      • putAll

        public static Map<String,​String> putAll​(Map<String,​String> map,
                                                      String predicate,
                                                      String predicateValue,
                                                      String predicateSuffix,
                                                      String[] values,
                                                      int group,
                                                      boolean or)
        Parameters:
        map -
        predicateValue - => jcr:title
        predicate - => property
        predicateSuffix - => value
        values - => [Square, Triangle]
        group - => ID
        or - => true/false
        Returns:
      • isPage

        public static boolean isPage​(org.apache.sling.api.SlingHttpServletRequest request)
        Checks of the query param node type is that of a CQ Page
        Parameters:
        request -
        Returns:
      • isAsset

        public static boolean isAsset​(org.apache.sling.api.SlingHttpServletRequest request)
        Checks of the query param node type is that of a DAM Asset
        Parameters:
        request -
        Returns:
      • getPropertyPrefix

        public static String getPropertyPrefix​(org.apache.sling.api.SlingHttpServletRequest request)
      • getLimit

        public static int getLimit​(org.apache.sling.api.SlingHttpServletRequest request)
        Extract the query limit from the ContentFinder Query Parameter notation
        Parameters:
        request -
        Returns:
      • getOffset

        public static int getOffset​(org.apache.sling.api.SlingHttpServletRequest request)
        Extract the query offset from the ContentFinder Query Parameter notation
        Parameters:
        request -
        Returns: