Interface ContentQueryRunner


  • public interface ContentQueryRunner
    A one-time runner, used to execute a ContentQuery.

    This object contains run-time configurations to the ContentQuery, and is the starting point for query execution.

    ContentQueryRunner objects are not thread safe, and should only be used once. If you need to re-run a query, get a new runner object from the query.

    • Method Detail

      • orderBy

        ContentQueryRunner orderBy​(String... externalKey)
        Add an order by clause to the query, using an external key.

        The order by clause added to the ContentQueryRunner is added after the clauses specified in the ContentQuery itself.

        Parameters:
        externalKey - the external key of the field to sort
        Returns:
        this ContentQueryBuilder
      • orderBy

        ContentQueryRunner orderBy​(ContentQueryOrderByClause... orderByClause)
        Add an order by clause to the query, using a ContentQueryOrderByClause object that supports various ordering operations. ContentQueryOrderByClause is obtainable from content query expressions.

        The order by clause added to the ContentQueryRunner is added after the clauses specified in the ContentQuery itself.

        Parameters:
        orderByClause - the configured order by clause object
        Returns:
        this ContentQueryBuilder
      • skip

        ContentQueryRunner skip​(long rows)
        Specifies that the result set returned by the query shall not include the first rows rows.

        This method is typically used to support pagination. For example, with a page size of 20, use runner.skip(20).limit(20) for page three, and runner.skip(20).limit(20) for page three.

        Parameters:
        rows - the number of rows to skip
        Returns:
        this ContentQueryRunner
      • limit

        ContentQueryRunner limit​(long rows)
        Specifies the number of rows to be returned by the query.
        Parameters:
        rows - the number of rows to return
        Returns:
        this ContentQueryRunner
      • configure

        ContentQueryRunner configure​(Consumer<ContentQueryRunner> configurator)
        Calls a configuration function with this runner, to allow reusable configuration logic.

        This function calls a separate configurator function with this runner as a parameter. The configurator can then configure this runner as it sees fit. The main use case of this is to include a shared configuration as part of a fluent builder-pattern.

        Parameters:
        configurator - the configurator function
        Returns:
        this ContentQueryRunner
      • configure

        <U> ContentQueryRunner configure​(BiConsumer<ContentQueryRunner,​U> configurator,
                                         U parameter)
        Calls a configuration function with this runner, to allow reusable configuration logic.

        This function calls a separate configurator function with this runner as the first parameter, and a user specified value as the second. The configurator can then configure this runner as it sees fit. The main use case of this is to include a shared configuration as part of a fluent builder-pattern.

        Parameters:
        configurator - the configurator function
        Returns:
        this ContentQueryRunner
      • run

        ContentQueryResult run​(ContentServicesClient client)
        Runs the configured query, returning the query result.
        Parameters:
        client - the content services client in which the query shall be run
        Returns:
        the query result