public class

DefaultUserPickerSearchService

extends Object
implements UserPickerSearchService UserSearchService
java.lang.Object
   ↳ com.atlassian.jira.bc.user.search.DefaultUserPickerSearchService

Summary

Public Constructors
DefaultUserPickerSearchService(UserManager userManager, ApplicationProperties applicationProperties, JiraAuthenticationContext authenticationContext, PermissionManager permissionManager, GroupManager groupManager, ProjectManager projectManager, ProjectRoleManager projectRoleManager, CrowdService crowdService, DirectoryManager directoryManager, ApplicationFactory applicationFactory, UserKeyStore userKeyStore, FeatureManager featureManager, GlobalPermissionManager globalPermissionManager)
Public Methods
boolean canPerformAjaxSearch(JiraServiceContext jiraServiceContext)
Returns true only if UserPicker Ajax search is enabled AND the user in the context has com.atlassian.jira.user.ApplicationUser Browse permission.
boolean canPerformAjaxSearch(ApplicationUser user)
Determines whether the given user could perform AJAX search.
boolean canShowEmailAddresses(JiraServiceContext jiraServiceContext)
Whether or not the UserPicker Ajax should search or show email addresses
@Nonnull Iterable<String> findUserKeysByEmail(String email)
Searches for a user with the specified e-mail address.
@Nonnull Iterable<String> findUserKeysByFullName(String fullName)
Searches for a user with the specified full name.
List<String> findUserNames(String nameQuery, String emailQuery, UserSearchParams userSearchParams)
Get user names based on query strings.
List<String> findUserNames(String query, UserSearchParams userSearchParams)
Get user names based on a query string.
List<ApplicationUser> findUsers(JiraServiceContext jiraServiceContext, String query, UserSearchParams userSearchParams)
Get Users based on a query string.
List<ApplicationUser> findUsers(JiraServiceContext jiraServiceContext, String query)
Get Users based on a query string.
List<ApplicationUser> findUsers(String query, UserSearchParams userSearchParams)
Get Users based on a query string.
List<ApplicationUser> findUsers(String nameQuery, String emailQuery, UserSearchParams userSearchParams)
Get Users based on query strings.
List<ApplicationUser> findUsersAllowEmptyQuery(JiraServiceContext jiraServiceContext, String query)
Get Users based on a query string.
@Nonnull Iterable<ApplicationUser> findUsersByEmail(String email)
Searches for a user with the specified e-mail address.
@Nonnull Iterable<ApplicationUser> findUsersByFullName(String fullName)
Searches for a user with the specified full name.
ApplicationUser getUserByName(JiraServiceContext jiraServiceContext, String query)
Returns a user by exact username
boolean userMatches(ApplicationUser user, UserSearchParams userSearchParams)
Determine whether a user matches the search criteria specified in the userSearchParams parameter.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.bc.user.search.UserPickerSearchService
From interface com.atlassian.jira.bc.user.search.UserSearchService

Public Constructors

public DefaultUserPickerSearchService (UserManager userManager, ApplicationProperties applicationProperties, JiraAuthenticationContext authenticationContext, PermissionManager permissionManager, GroupManager groupManager, ProjectManager projectManager, ProjectRoleManager projectRoleManager, CrowdService crowdService, DirectoryManager directoryManager, ApplicationFactory applicationFactory, UserKeyStore userKeyStore, FeatureManager featureManager, GlobalPermissionManager globalPermissionManager)

Public Methods

public boolean canPerformAjaxSearch (JiraServiceContext jiraServiceContext)

Returns true only if UserPicker Ajax search is enabled AND the user in the context has com.atlassian.jira.user.ApplicationUser Browse permission.

Parameters
jiraServiceContext Jira Service Context
Returns
  • True if enabled, otherwise false

public boolean canPerformAjaxSearch (ApplicationUser user)

Determines whether the given user could perform AJAX search.

public boolean canShowEmailAddresses (JiraServiceContext jiraServiceContext)

Whether or not the UserPicker Ajax should search or show email addresses

Parameters
jiraServiceContext Jira Service Context
Returns
  • True if email addresses can be shown, otherwise false

@Nonnull public Iterable<String> findUserKeysByEmail (String email)

Searches for a user with the specified e-mail address.

Parameters
email the e-mail address to search.
Returns
  • collection of found user keys, empty if none were found.

@Nonnull public Iterable<String> findUserKeysByFullName (String fullName)

Searches for a user with the specified full name.

Parameters
fullName the full name to search for.
Returns
  • a collection of user keys with the specified full name, empty if none were found.

public List<String> findUserNames (String nameQuery, String emailQuery, UserSearchParams userSearchParams)

Get user names based on query strings.

Matches nameQuery on start of username, full name and email as well as all the tokenised (on spaces, '.', '@' etc) words

Matches emailQuery on start of email, as well as the tokenised words. Email matching is performed only when userSearchParams.canMatchEmail() is true. If email matching is enabled, nameQuery AND emailQuery criteria must match returned users.

If the users in the database change during this call results might not be consistent if a post processing filter and a result limit is used.

Parameters
nameQuery the query to search username and display name.
emailQuery the query to search email address, subject to userSearchParams.canMatchEmail.
userSearchParams the search criteria
Returns
  • the list of matched users

public List<String> findUserNames (String query, UserSearchParams userSearchParams)

Get user names based on a query string.

Matches on start of username, full name and email as well as all the tokenised (on spaces, '.', '@' etc) words

Matches email only when userSearchParams.canMatchEmail() is true.

If the users in the database change during this call results might not be consistent if a post processing filter and a result limit is used.

Parameters
query the query to search username, display name and email address
userSearchParams the search criteria
Returns
  • the list of matched user names

public List<ApplicationUser> findUsers (JiraServiceContext jiraServiceContext, String query, UserSearchParams userSearchParams)

Get Users based on a query string.

Matches on start of username, full name and email as well as all the tokenised (on spaces, '.', '@' etc) words

Results are sorted according to the UserCachingComparator.

If the users in the database change during this call results might not be consistent if a post processing filter and a result limit is used.

Parameters
jiraServiceContext Jira Service Context
query String to search for.
userSearchParams Additional search parameters
Returns

public List<ApplicationUser> findUsers (JiraServiceContext jiraServiceContext, String query)

Get Users based on a query string.

Matches on start of username, full name and email as well as all the tokenised (on spaces, '.', '@' etc) words Only returns active users.

Results are sorted according to the UserCachingComparator.

Parameters
jiraServiceContext Jira Service Context
query String to search for.
Returns

public List<ApplicationUser> findUsers (String query, UserSearchParams userSearchParams)

Get Users based on a query string.

Matches on start of username, full name and email as well as all the tokenised (on spaces, '.', '@' etc) words

Matches email only when userSearchParams.canMatchEmail() is true.

Results are sorted according to the userSearchParams.comparator. If userSearchParams.comparator is null, no sorting will be performed.

If the users in the database change during this call results might not be consistent if a post processing filter and a result limit is used.

Parameters
query the query to search username, display name and email address
userSearchParams the search criteria
Returns
  • the list of matched users

public List<ApplicationUser> findUsers (String nameQuery, String emailQuery, UserSearchParams userSearchParams)

Get Users based on query strings.

Matches nameQuery on start of username, full name and email as well as all the tokenised (on spaces, '.', '@' etc) words

Matches emailQuery on start of email, as well as the tokenised words. Email matching is performed only when userSearchParams.canMatchEmail() is true.

Results are sorted according to the userSearchParams.comparator. If userSearchParams.comparator is null, no sorting will be performed.

If the users in the database change during this call results might not be consistent if a post processing filter and a result limit is used.

Parameters
nameQuery the query to search username and display name.
emailQuery the query to search email address, subject to userSearchParams.canMatchEmail.
userSearchParams the search criteria
Returns
  • the list of matched users

public List<ApplicationUser> findUsersAllowEmptyQuery (JiraServiceContext jiraServiceContext, String query)

Get Users based on a query string.

Matches on start of username, full name and email as well as all the tokenised (on spaces, '.', '@' etc) words This will search even if the query passed is null or empty. Only returns active users.

Results are sorted according to the UserCachingComparator.

Parameters
jiraServiceContext Jira Service Context
query String to search for.
Returns

@Nonnull public Iterable<ApplicationUser> findUsersByEmail (String email)

Searches for a user with the specified e-mail address.

Parameters
email the e-mail address to search.
Returns
  • collection of found users, empty if none were found.

@Nonnull public Iterable<ApplicationUser> findUsersByFullName (String fullName)

Searches for a user with the specified full name.

Parameters
fullName the full name to search for.
Returns
  • a collection of users with the specified full name, empty if none were found.

public ApplicationUser getUserByName (JiraServiceContext jiraServiceContext, String query)

Returns a user by exact username

Parameters
jiraServiceContext Jira Service Context
query String to search for.
Returns

public boolean userMatches (ApplicationUser user, UserSearchParams userSearchParams)

Determine whether a user matches the search criteria specified in the userSearchParams parameter.

allowEmptyQuery in userSearchParams is ignored.

Parameters
user the user to be matched
userSearchParams the search criteria
Returns
  • true if the user matches the search criteria