Class SearchResultsBatchWorkSource<T>

  extended by com.atlassian.confluence.content.render.xhtml.migration.macro.SearchResultsBatchWorkSource<T>
All Implemented Interfaces:

public class SearchResultsBatchWorkSource<T>
extends java.lang.Object
implements BatchableWorkSource<T>

Provides a worksource from a searchQuery, the query should return searchResults that can be converted ContentEntityObjects

Constructor Summary
SearchResultsBatchWorkSource(SearchManager searchManager, java.util.List<SearchResult> searchResults, int batchSize,<com.atlassian.bonnie.Searchable,T> transformer)
Method Summary
 java.util.List<T> getBatch()
          gets the list of entities that form the batch.
 int getTotalSize()
 boolean hasMoreBatches()
 int numberOfBatches()
 void reset(int total)
          Reset the work source ready to begin getting batches again.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public SearchResultsBatchWorkSource(SearchManager searchManager,
                                    java.util.List<SearchResult> searchResults,
                                    int batchSize,
                          <com.atlassian.bonnie.Searchable,T> transformer)
searchManager -
searchResults -
batchSize -
transformer - - the function used to transform the list of Searchables returned from the query to the type required by the batch, may also perform filtering, so it is safe for the apply method to return null, the apply method should also accept null values.
Method Detail


public java.util.List<T> getBatch()
gets the list of entities that form the batch. The list is retrieved by executing the query and converting the search result to a list of entities, it is only then that the transformer is returned, so the number of entities per batch as returned from this method may differ from the batch size, and may in fact be empty. An empty list returned from this method does not connote that there are no more batches, rather @see hasMoreBatches

Specified by:
getBatch in interface BatchableWorkSource<T>
the entities in this batch, the list does not contain any null values.


public boolean hasMoreBatches()
Specified by:
hasMoreBatches in interface BatchableWorkSource<T>
true if more work batches exist


public int numberOfBatches()
Specified by:
numberOfBatches in interface BatchableWorkSource<T>
total number of work batches available.


public void reset(int total)
Description copied from interface: BatchableWorkSource
Reset the work source ready to begin getting batches again.

Specified by:
reset in interface BatchableWorkSource<T>


public int getTotalSize()
Specified by:
getTotalSize in interface BatchableWorkSource<T>

Copyright © 2003-2014 Atlassian. All Rights Reserved.