public class

SearchResultsBatchWorkSource

extends Object
implements BatchableWorkSource<T>
java.lang.Object
   ↳ com.atlassian.confluence.content.render.xhtml.migration.macro.SearchResultsBatchWorkSource<T>

Class Overview

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

Summary

Public Constructors
SearchResultsBatchWorkSource(SearchManager searchManager, List<SearchResult> searchResults, int batchSize, Function<Searchable, T> transformer)
Public Methods
List<T> getBatch()
gets the list of entities that form the batch.
boolean hasMoreBatches()
int numberOfBatches()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.confluence.content.render.xhtml.migration.BatchableWorkSource

Public Constructors

public SearchResultsBatchWorkSource (SearchManager searchManager, List<SearchResult> searchResults, int batchSize, Function<Searchable, T> transformer)

Parameters
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.

Public Methods

public 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

Returns
  • the entities in this batch, the list does not contain any null values.

public boolean hasMoreBatches ()

public int numberOfBatches ()