Fluent query builder for finding profiles by name, contact details, group and organisation membership, and other criteria. Built with UserManager's newProfileMatchRequest and run with findMatching, it is used from both platform Java code and app JavaScript. Each setter method returns this instance so calls can be chained; criteria are combined with AND by default, or with OR after calling or(), and newSubCriteria() adds a nested group of criteria for building more complex boolean expressions.


Methods

sort(String field, boolean ascending) · findMatching() · userIds(List<Long> ids) · userName(String s) · and() · or() · phone(String phone) · email(String email) · firstName(String firstName) · surName(String surName) · searchProperties(SearchProperties searchProperties) · newSubCriteria() · enabled(Boolean b) · orgs(List<Organisation> teams) · addOrgs(Organisation teams) · groups(List<Group> teamGroups) · addGroups(Group groups) · hasCriteria() · addGroupsList(List<Group> groups)

sort(String field, boolean ascending)

Returns: ProfileMatchRequest

Adds a field to sort the results by, applied in the order this method is called. Calling it more than once adds secondary sort fields rather than replacing the earlier ones.

ParameterDescription
fieldthe entity property name to sort by, for example "surName" or "email"
ascendingtrue to sort ascending, false to sort descending

findMatching()

Returns: List<Profile>

Runs this request's criteria as a database query against the current root organisation's profiles and returns the matching profiles. This performs a database lookup, so avoid calling it in a tight loop.

userIds(List<Long> ids)

Returns: ProfileMatchRequest

Restricts matches to profiles with one of the given IDs.

ParameterDescription
idsthe profile IDs to match; values are coerced to Long

userName(String s)

Returns: ProfileMatchRequest

Restricts matches to the profile with the given username (login name).

ParameterDescription
sthe username to match

and()

Returns: ProfileMatchRequest

Sets this request to combine its criteria with AND, so a profile must satisfy all of them to match. This is the default combination mode.

or()

Returns: ProfileMatchRequest

Sets this request to combine its criteria with OR, so a profile matches if it satisfies any one of them.

phone(String phone)

Returns: ProfileMatchRequest

Restricts matches to the profile with the given phone number. Ignored if the given value is null, empty, or blank.

ParameterDescription
phonethe phone number to match

email(String email)

Returns: ProfileMatchRequest

Restricts matches to the profile with the given email address, compared case-insensitively. Ignored if the given value is null, empty, or blank.

ParameterDescription
emailthe email address to match

firstName(String firstName)

Returns: ProfileMatchRequest

Restricts matches to profiles with the given first name. Ignored if the given value is null, empty, or blank.

ParameterDescription
firstNamethe first name to match

surName(String surName)

Returns: ProfileMatchRequest

Restricts matches to profiles with the given surname. Ignored if the given value is null, empty, or blank.

ParameterDescription
surNamethe surname to match

searchProperties(SearchProperties searchProperties)

Returns: ProfileMatchRequest

Sets the paging and sorting properties applied when this request's criteria are run against the database.

ParameterDescription
searchPropertiesthe paging and sorting properties to apply

newSubCriteria()

Returns: ProfileMatchRequest

Creates a new nested sub-request, adds it as one of this request's criteria, and returns the sub-request so its own criteria can be set. Use this to build compound expressions, for example combining this request's criteria with a nested OR group of alternatives.

enabled(Boolean b)

Returns: ProfileMatchRequest

Restricts matches by enabled status. Defaults to true, so only enabled profiles match; pass null to match both enabled and disabled profiles.

ParameterDescription
btrue to match only enabled profiles, false to match only disabled profiles, or null to match both

orgs(List<Organisation> teams)

Returns: ProfileMatchRequest

Sets the list of organisations to restrict matches to, on the first call only; has no effect if this request already has an organisation filter set, or if the given list is null or empty.

ParameterDescription
teamsthe organisations to restrict matches to

addOrgs(Organisation teams)

Returns: ProfileMatchRequest

Adds one or more organisations to restrict matches to; a profile matches if it belongs to any of the organisations added across all calls to this method. Has no effect if no organisations are given.

ParameterDescription
teamsthe organisations to add to the filter

groups(List<Group> teamGroups)

Returns: ProfileMatchRequest

Adds one or more groups to restrict matches to; a profile matches if it has a membership in any of the groups added across all calls to this method. Has no effect if the given list is null or empty.

ParameterDescription
teamGroupsthe groups to add to the filter

addGroups(Group groups)

Returns: ProfileMatchRequest

Adds one or more groups to restrict matches to; a profile matches if it has a membership in any of the groups added across all calls to this method. Has no effect if no groups are given.

ParameterDescription
groupsthe groups to add to the filter

hasCriteria()

Returns: boolean

Reports whether this request has any matching criteria set, checking phone, email, first name, surname, organisations, groups, and nested sub-requests. Note that user IDs and username are not included in this check.

addGroupsList(List<Group> groups)

Returns: void

Adds one or more groups to restrict matches to, without returning this request for chaining. A profile matches if it has a membership in any of the groups added across all calls to this or addGroups. Has no effect if the given list is null.

ParameterDescription
groupsthe groups to add to the filter
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.