Interface PaginationService

    • Method Detail

      • doPaginationRequest

        @Deprecated
        default <H,​M> PageResponse<M> doPaginationRequest​(LimitedRequest pageRequest,
                                                                PaginationBatch<H> fetchBatch,
                                                                com.google.common.base.Function<? super H,​M> modelConverter)
        Perform a pagination request, this will execute the fetchBatch function as many times as necessary to retrieve the page of results. Each execution of the fetch page function will pull at most LimitedRequest.getMaxLimit() results from the datasource. FetchBatch will be executed in a new transaction for each batch to prevent excessive memory usage. It is expected that any permission checking is performed in the PaginationBatch.

        The PaginationService is responsible for ensuring that enough results are returned from the PaginationBatch to fulfill the request. The PaginationBatch should not treat the pageRequest getStart and getLimit values as user specific indexes, only results the user can see should be returned. If a user does not have permission to see any results in the requested range an empty list should be returned in the response and the hasMore flag set if there are more results still to check. The pagination service will call again if more results are required.

        Parameters:
        pageRequest - - a request for a range of data
        fetchBatch - - the function to supply the results
        modelConverter - - a function to convert from the supplied object to a model object, this will be executed within a transaction.
        Returns:
        a PageResponse of model objects, with results that the user is allowed to see.
      • performPaginationRequest

        <H,​M> PageResponse<M> performPaginationRequest​(LimitedRequest pageRequest,
                                                             PaginationBatch<H> fetchBatch,
                                                             Function<? super H,​M> modelConverter)
        Perform a pagination request, this will execute the fetchBatch function as many times as necessary to retrieve the page of results. Each execution of the fetch page function will pull at most LimitedRequest.getMaxLimit() results from the datasource. FetchBatch will be executed in a new transaction for each batch to prevent excessive memory usage. It is expected that any permission checking is performed in the PaginationBatch.

        The PaginationService is responsible for ensuring that enough results are returned from the PaginationBatch to fulfill the request. The PaginationBatch should not treat the pageRequest getStart and getLimit values as user specific indexes, only results the user can see should be returned. If a user does not have permission to see any results in the requested range an empty list should be returned in the response and the hasMore flag set if there are more results still to check. The pagination service will call again if more results are required.

        Parameters:
        pageRequest - - a request for a range of data
        fetchBatch - - the function to supply the results
        modelConverter - - a function to convert from the supplied object to a model object, this will be executed within a transaction.
        Returns:
        a PageResponse of model objects, with results that the user is allowed to see.
        Since:
        7.0.1
      • doPaginationListRequest

        @Deprecated
        default <H,​M> PageResponse<M> doPaginationListRequest​(LimitedRequest pageRequest,
                                                                    PaginationBatch<H> fetchBatch,
                                                                    com.google.common.base.Function<Iterable<H>,​Iterable<M>> modelConverter)
        Perform a pagination request, this will execute the fetchBatch function as many times as necessary to retrieve the page of results. Each execution of the fetch page function will pull at most LimitedRequest.getMaxLimit() results from the datasource. FetchBatch will be executed in a new transaction for each batch to prevent excessive memory usage. It is expected that any permission checking is performed in the PaginationBatch.

        The PaginationService is responsible for ensuring that enough results are returned from the PaginationBatch to fulfill the request. The PaginationBatch should not treat the pageRequest getStart and getLimit values as user specific indexes, only results the user can see should be returned. If a user does not have permission to see any results in the requested range an empty list should be returned in the response and the hasMore flag set if there are more results still to check. The pagination service will call again if more results are required.

        Parameters:
        pageRequest - - a request for a range of data
        fetchBatch - - the function to supply the results
        modelConverter - - a function to convert from the supplied object to a model object, this will be executed within a transaction.
        Returns:
        a PageResponse of model objects, with results that the user is allowed to see.
      • performPaginationListRequest

        <H,​M> PageResponse<M> performPaginationListRequest​(LimitedRequest pageRequest,
                                                                 PaginationBatch<H> fetchBatch,
                                                                 Function<Iterable<H>,​Iterable<M>> modelConverter)
        Perform a pagination request, this will execute the fetchBatch function as many times as necessary to retrieve the page of results. Each execution of the fetch page function will pull at most LimitedRequest.getMaxLimit() results from the datasource. FetchBatch will be executed in a new transaction for each batch to prevent excessive memory usage. It is expected that any permission checking is performed in the PaginationBatch.

        The PaginationService is responsible for ensuring that enough results are returned from the PaginationBatch to fulfill the request. The PaginationBatch should not treat the pageRequest getStart and getLimit values as user specific indexes, only results the user can see should be returned. If a user does not have permission to see any results in the requested range an empty list should be returned in the response and the hasMore flag set if there are more results still to check. The pagination service will call again if more results are required.

        Parameters:
        pageRequest - - a request for a range of data
        fetchBatch - - the function to supply the results
        modelConverter - - a function to convert from the supplied object to a model object, this will be executed within a transaction.
        Returns:
        a PageResponse of model objects, with results that the user is allowed to see.
        Since:
        7.0.1
      • performPaginationListRequestWithCursor

        default <H,​M> PageResponse<M> performPaginationListRequestWithCursor​(LimitedRequest pageRequest,
                                                                                   Function<LimitedRequest,​PageResponse<H>> fetchBatch,
                                                                                   Function<Iterable<H>,​Iterable<M>> modelConverter,
                                                                                   BiFunction<H,​Boolean,​Cursor> cursorCalculator)
        Perform a pagination request, this will execute the fetchBatch function as many times as to retrieve the page of results. Each execution of the fetch page function will pull at most LimitedRequest.getMaxLimit() results from the datasource. FetchBatch will be executed in a new transaction for each batch to prevent excessive memory usage. It is expected that any permission checking is performed in the PaginationBatch.

        The PaginationService is responsible for ensuring that enough results are returned from the fetchBatch to fulfill the request. Only results the user can see should be returned.

        Parameters:
        pageRequest - - a request for a range of data
        fetchBatch - - the function to supply the results. Results should be sorted in order which match cursor fields ordering.
        modelConverter - - a function to convert from the supplied object to a model object, this will be executed within a transaction.
        cursorCalculator - - a function to calculate next cursor.
        Returns:
        a PageResponseWithCursor of model objects, with results that the user is allowed to see.
        Since:
        7.18