Interface QueryTransformer


  • @ConsumerType
    public interface QueryTransformer
    Defines a service interface which might be asked to transform an arbitrary string into a valid JCR-SQL2 query.

    A custom query language string might be translated from:

    SELECT page WHERE dc:description LIKE 'foo%' ORDER BY dc:title

    into the corresponding valid JCR-SQL2 query:

    SELECT page.* FROM [cq:Page] AS page INNER JOIN [cq:PageContent] AS child ON ISCHILDNODE(child, page) WHERE child.[jcr:description] LIKE 'foo' AND ISDESCENDANTNODE(page, [/content]) ORDER BY child.[jcr:title]
    • Method Detail

      • transform

        java.lang.String transform​(Resource resource,
                                   java.lang.String customquery)
                            throws RestException
        Transforms the specified customquery to a valid JCR-SQL2 query. The customquery is meant to be applied as the specified resource as the search path.
        Parameters:
        resource - Resource to search in
        customquery - Custom query string
        Returns:
        A valid JCR-SQL2 query string
        Throws:
        RestException - If an error occurs during transformation