com.atlassian.confluence.api.impl.pagination
Class PaginationServiceImpl

java.lang.Object
  extended by com.atlassian.confluence.api.impl.pagination.PaginationServiceImpl
All Implemented Interfaces:
PaginationService

public class PaginationServiceImpl
extends java.lang.Object
implements PaginationService


Constructor Summary
PaginationServiceImpl(org.springframework.transaction.PlatformTransactionManager transactionManager)
           
 
Method Summary
<H,M> PageResponse<M>
doPaginationRequest(LimitedRequest initialRequest, PaginationBatch<H> fetchPage, 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PaginationServiceImpl

public PaginationServiceImpl(org.springframework.transaction.PlatformTransactionManager transactionManager)
Method Detail

doPaginationRequest

public <H,M> PageResponse<M> doPaginationRequest(LimitedRequest initialRequest,
                                                 PaginationBatch<H> fetchPage,
                                                 com.google.common.base.Function<? super H,M> modelConverter)
Description copied from interface: PaginationService
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 com.atlassian.confluence.api.model.pagination.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 PaginationTemplate.

The PaginationService is responsible for ensuring that enough results are returned from the PaginationTemplate to fulfill the request. The PaginationTemplate 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.

Specified by:
doPaginationRequest in interface PaginationService
Parameters:
initialRequest - - a request for a range of data
fetchPage - - 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.


Copyright © 2003-2014 Atlassian. All Rights Reserved.