Builder for a search that finds the profiles or organisations eligible to participate in a promotion (a Reward), used to page and filter that participant set before counting, fetching or streaming it. Configure it with the with* methods, then pass it to PromotionsManager.countParticipants, findParticipants or useParticipants, or call count(), search() or useParticipants() directly once a promotion is set.

Group: Builders


Properties

PropertyReturnsDescription
maxRowsIntegerOverall cap on the number of results returned across all pages.
orgsBooleanWhether the search matches organisations rather than profiles.
pageSizeIntegerMaximum number of results to return per page.
parentOrgsList<Organisation>Organisations that matching profiles or organisations must sit beneath.
promoRewardThe promotion whose eligibility rules (groups, organisation type filters) the search is run against.
searchFieldsList<String>Names of the fields searched against when a search query is set.
searchQueryStringFree-text term used to filter participants, matched against the fields named by getSearchFields.
startPosIntegerZero-based offset of the first result to return, for paging.

Methods

getSearchQuery() · withSearchQuery(String searchQuery) · getSearchFields() · withSearchFields(List<String> searchFields) · getParentOrgs() · withParentOrgs(List<Organisation> parentOrgs) · getPromo() · withPromo(Reward promo) · getOrgs() · withOrgs(Boolean orgs) · getStartPos() · withStartPos(Integer startPos) · getPageSize() · withPageSize(Integer pageSize) · getMaxRows() · withMaxRows(Integer maxRows) · count() · search() · useParticipants(Consumer<BaseEntity> callback)

getSearchQuery()

Returns: String

Free-text term used to filter participants, matched against the fields named by getSearchFields.

withSearchQuery(String searchQuery)

Returns: ParticipantSearchBuilder

Sets the free-text term to filter participants by, matched against the fields set with withSearchFields.

ParameterDescription
searchQuerythe search term, or null to remove any text search

getSearchFields()

Returns: List<String>

Names of the fields searched against when a search query is set.

withSearchFields(List<String> searchFields)

Returns: ParticipantSearchBuilder

Sets the field names to match the search query against.

ParameterDescription
searchFieldsthe searchable field names

getParentOrgs()

Returns: List<Organisation>

Organisations that matching profiles or organisations must sit beneath.

withParentOrgs(List<Organisation> parentOrgs)

Returns: ParticipantSearchBuilder

Restricts the search to profiles or organisations that sit beneath one of the given parent organisations.

ParameterDescription
parentOrgsthe required parent organisations, or null to remove the restriction

getPromo()

Returns: Reward

The promotion whose eligibility rules (groups, organisation type filters) the search is run against.

withPromo(Reward promo)

Returns: ParticipantSearchBuilder

Sets the promotion whose eligibility rules the search is run against.

ParameterDescription
promothe promotion to find participants for

getOrgs()

Returns: Boolean

Whether the search matches organisations rather than profiles.

withOrgs(Boolean orgs)

Returns: ParticipantSearchBuilder

Sets whether the search should match organisations rather than profiles.

ParameterDescription
orgstrue to search organisations, false or null to search profiles

getStartPos()

Returns: Integer

Zero-based offset of the first result to return, for paging.

withStartPos(Integer startPos)

Returns: ParticipantSearchBuilder

Sets the zero-based offset of the first result to return, for paging.

ParameterDescription
startPosthe paging offset, or null to start from the first result

getPageSize()

Returns: Integer

Maximum number of results to return per page.

withPageSize(Integer pageSize)

Returns: ParticipantSearchBuilder

Sets the maximum number of results to return per page.

ParameterDescription
pageSizethe page size, or null for no page size limit

getMaxRows()

Returns: Integer

Overall cap on the number of results returned across all pages.

withMaxRows(Integer maxRows)

Returns: ParticipantSearchBuilder

Sets the overall cap on the number of results returned across all pages.

ParameterDescription
maxRowsthe maximum number of rows, or null for no cap

count()

Returns: int

Counts the profiles or organisations matching this search, without loading the full result set.

Returns: Collection<BaseEntity>

Runs this search and returns the matching profiles or organisations, including any paging limits set on this builder.

useParticipants(Consumer<BaseEntity> callback)

Returns: void

Streams the profiles or organisations matching this search to a callback, one at a time, rather than loading them all into memory at once. Does nothing if the search has no criteria.

ParameterDescription
callbackinvoked once for each matching profile or organisation
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.