Class DefaultUserPickerSearchService
- All Implemented Interfaces:
UserPickerSearchService
,UserSearchService
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultUserPickerSearchService
(UserManager userManager, ApplicationProperties applicationProperties, JiraAuthenticationContext authenticationContext, PermissionManager permissionManager, GroupManager groupManager, ProjectManager projectManager, ProjectRoleManager projectRoleManager, com.atlassian.crowd.embedded.api.CrowdService crowdService, com.atlassian.crowd.manager.directory.DirectoryManager directoryManager, com.atlassian.crowd.embedded.api.ApplicationFactory applicationFactory, UserKeyStore userKeyStore, IssueUserSearchManager issueUserSearchManager, UserSearchServiceStats userSearchServiceStats) -
Method Summary
Modifier and TypeMethodDescriptionboolean
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
Determines whether the given user could perform AJAX search.boolean
canShowEmailAddresses
(JiraServiceContext jiraServiceContext) Whether or not the UserPicker Ajax should search or show email addressesfilterUsers
(List<ApplicationUser> applicationUsers, String nameQuery, UserSearchParams userSearchParams) Filter a list ofApplicationUser
based on provided criteria and return only those users that match.filterUsers
(List<ApplicationUser> applicationUsers, String nameQuery, String emailQuery, UserSearchParams userSearchParams) Filter a list ofApplicationUser
based on provided criteria and return only those users that match.findTopAssignableUsers
(String searchName, UserSearchIssueContext userSearchIssueContext, int topN) FindstopN
users that can be assigned in a given issue.findTopMentionableUsers
(String searchName, UserSearchIssueContext userSearchIssueContext, int topN) FindstopN
mentionable users in a given issue.findTopUsers
(String searchName, UserSearchIssueContext userSearchIssueContext, int topN, ProjectPermissionKey projectPermission) findTopUsers
(String searchName, UserSearchIssueContext userSearchIssueContext, int topN, ProjectPermissionKey projectPermission, boolean forceReporterAndAssignee) findTopWatcherUsers
(String searchName, UserSearchIssueContext userSearchIssueContext, int topN) FindstopN
users that can watch a given issue.findUserKeysByEmail
(String email) Searches for a user with the specified e-mail address.findUserKeysByFullName
(String fullName) Searches for a user with the specified full name.findUserNames
(String query, UserSearchParams userSearchParams) Get user names based on a query string.findUserNames
(String nameQuery, String emailQuery, UserSearchParams userSearchParams) Get user names based on query strings.findUsers
(JiraServiceContext jiraServiceContext, String query) Get Users based on a query string.findUsers
(JiraServiceContext jiraServiceContext, String query, UserSearchParams userSearchParams) Get Users based on a query string.findUsers
(String query, UserSearchParams userSearchParams) Get Users based on a query string.findUsers
(String nameQuery, String emailQuery, UserSearchParams userSearchParams) Get Users based on query strings.findUsersAllowEmptyQuery
(JiraServiceContext jiraServiceContext, String query) Get Users based on a query string.findUsersByEmail
(String email) Searches for a user with the specified e-mail address.findUsersByFullName
(String fullName) Searches for a user with the specified full name.getUserByName
(JiraServiceContext jiraServiceContext, String query) Returns a user by exact usernameboolean
userMatches
(ApplicationUser user, UserSearchParams userSearchParams) Determine whether a user matches the search criteria specified in theuserSearchParams
parameter.
-
Constructor Details
-
DefaultUserPickerSearchService
public DefaultUserPickerSearchService(UserManager userManager, ApplicationProperties applicationProperties, JiraAuthenticationContext authenticationContext, PermissionManager permissionManager, GroupManager groupManager, ProjectManager projectManager, ProjectRoleManager projectRoleManager, com.atlassian.crowd.embedded.api.CrowdService crowdService, com.atlassian.crowd.manager.directory.DirectoryManager directoryManager, com.atlassian.crowd.embedded.api.ApplicationFactory applicationFactory, UserKeyStore userKeyStore, IssueUserSearchManager issueUserSearchManager, UserSearchServiceStats userSearchServiceStats)
-
-
Method Details
-
findUsers
Description copied from interface:UserPickerSearchService
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
.- Specified by:
findUsers
in interfaceUserPickerSearchService
- Specified by:
findUsers
in interfaceUserSearchService
- Parameters:
jiraServiceContext
- Jira Service Contextquery
- String to search for.- Returns:
- List of
ApplicationUser
objects that match criteria. - See Also:
-
getUserByName
Description copied from interface:UserPickerSearchService
Returns a user by exact username- Specified by:
getUserByName
in interfaceUserPickerSearchService
- Specified by:
getUserByName
in interfaceUserSearchService
- Parameters:
jiraServiceContext
- Jira Service Contextquery
- String to search for.- Returns:
- The
ApplicationUser
object with supplied username.
-
findUsersAllowEmptyQuery
public List<ApplicationUser> findUsersAllowEmptyQuery(JiraServiceContext jiraServiceContext, String query) Description copied from interface:UserPickerSearchService
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
.- Specified by:
findUsersAllowEmptyQuery
in interfaceUserPickerSearchService
- Specified by:
findUsersAllowEmptyQuery
in interfaceUserSearchService
- Parameters:
jiraServiceContext
- Jira Service Contextquery
- String to search for.- Returns:
- List of
ApplicationUser
objects that match criteria. - See Also:
-
findUsers
public List<ApplicationUser> findUsers(JiraServiceContext jiraServiceContext, String query, UserSearchParams userSearchParams) Description copied from interface:UserPickerSearchService
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.
- Specified by:
findUsers
in interfaceUserPickerSearchService
- Specified by:
findUsers
in interfaceUserSearchService
- Parameters:
jiraServiceContext
- Jira Service Contextquery
- String to search for.userSearchParams
- Additional search parameters- Returns:
- List of
ApplicationUser
objects that match criteria.
-
findUsers
Description copied from interface:UserPickerSearchService
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.
- Specified by:
findUsers
in interfaceUserPickerSearchService
- Specified by:
findUsers
in interfaceUserSearchService
- Parameters:
query
- the query to search username, display name and email addressuserSearchParams
- the search criteria- Returns:
- the list of matched users
-
findUsers
public List<ApplicationUser> findUsers(String nameQuery, String emailQuery, UserSearchParams userSearchParams) Description copied from interface:UserPickerSearchService
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.
- Specified by:
findUsers
in interfaceUserPickerSearchService
- Specified by:
findUsers
in interfaceUserSearchService
- 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
-
findUserNames
Description copied from interface:UserSearchService
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.
- Specified by:
findUserNames
in interfaceUserSearchService
- Parameters:
query
- the query to search username, display name and email addressuserSearchParams
- the search criteria- Returns:
- the list of matched user names
-
findUserNames
public List<String> findUserNames(String nameQuery, String emailQuery, UserSearchParams userSearchParams) Description copied from interface:UserSearchService
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.
- Specified by:
findUserNames
in interfaceUserSearchService
- 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
-
findTopMentionableUsers
public List<ApplicationUser> findTopMentionableUsers(String searchName, UserSearchIssueContext userSearchIssueContext, int topN) Description copied from interface:UserSearchService
FindstopN
mentionable users in a given issue.- Specified by:
findTopMentionableUsers
in interfaceUserSearchService
- Returns:
- list of
ApplicationUser
matching requirements ordered ascending by user display name
-
findTopAssignableUsers
public List<ApplicationUser> findTopAssignableUsers(String searchName, UserSearchIssueContext userSearchIssueContext, int topN) Description copied from interface:UserSearchService
FindstopN
users that can be assigned in a given issue.- Specified by:
findTopAssignableUsers
in interfaceUserSearchService
- Returns:
- list of
ApplicationUser
matching requirements ordered ascending by user display name
-
findTopUsers
public List<ApplicationUser> findTopUsers(String searchName, UserSearchIssueContext userSearchIssueContext, int topN, ProjectPermissionKey projectPermission) - Specified by:
findTopUsers
in interfaceUserSearchService
-
findTopUsers
public List<ApplicationUser> findTopUsers(@Nonnull String searchName, @Nonnull UserSearchIssueContext userSearchIssueContext, int topN, @Nonnull ProjectPermissionKey projectPermission, boolean forceReporterAndAssignee) - Specified by:
findTopUsers
in interfaceUserSearchService
-
findTopWatcherUsers
public List<ApplicationUser> findTopWatcherUsers(String searchName, UserSearchIssueContext userSearchIssueContext, int topN) Description copied from interface:UserSearchService
FindstopN
users that can watch a given issue.- Specified by:
findTopWatcherUsers
in interfaceUserSearchService
- Returns:
- list of
ApplicationUser
matching requirements ordered ascending by user display name
-
userMatches
Description copied from interface:UserPickerSearchService
Determine whether a user matches the search criteria specified in theuserSearchParams
parameter.allowEmptyQuery in
userSearchParams
is ignored.- Specified by:
userMatches
in interfaceUserPickerSearchService
- Specified by:
userMatches
in interfaceUserSearchService
- Parameters:
user
- the user to be matcheduserSearchParams
- the search criteria- Returns:
- true if the user matches the search criteria
-
canShowEmailAddresses
Description copied from interface:UserPickerSearchService
Whether or not the UserPicker Ajax should search or show email addresses- Specified by:
canShowEmailAddresses
in interfaceUserPickerSearchService
- Specified by:
canShowEmailAddresses
in interfaceUserSearchService
- Parameters:
jiraServiceContext
- Jira Service Context- Returns:
- True if email addresses can be shown, otherwise false
- See Also:
-
canPerformAjaxSearch
Description copied from interface:UserPickerSearchService
Returns true only if UserPicker Ajax search is enabled AND the user in the context has com.atlassian.jira.user.ApplicationUser Browse permission.- Specified by:
canPerformAjaxSearch
in interfaceUserPickerSearchService
- Specified by:
canPerformAjaxSearch
in interfaceUserSearchService
- Parameters:
jiraServiceContext
- Jira Service Context- Returns:
- True if enabled, otherwise false
-
canPerformAjaxSearch
Description copied from interface:UserPickerSearchService
Determines whether the given user could perform AJAX search.- Specified by:
canPerformAjaxSearch
in interfaceUserPickerSearchService
- Specified by:
canPerformAjaxSearch
in interfaceUserSearchService
-
findUserKeysByFullName
Description copied from interface:UserSearchService
Searches for a user with the specified full name.- Specified by:
findUserKeysByFullName
in interfaceUserSearchService
- Parameters:
fullName
- the full name to search for.- Returns:
- a collection of user keys with the specified full name, empty if none were found.
-
findUserKeysByEmail
Description copied from interface:UserSearchService
Searches for a user with the specified e-mail address.- Specified by:
findUserKeysByEmail
in interfaceUserSearchService
- Parameters:
email
- the e-mail address to search.- Returns:
- collection of found user keys, empty if none were found.
-
findUsersByFullName
Description copied from interface:UserSearchService
Searches for a user with the specified full name.- Specified by:
findUsersByFullName
in interfaceUserSearchService
- Parameters:
fullName
- the full name to search for.- Returns:
- a collection of users with the specified full name, empty if none were found.
-
findUsersByEmail
Description copied from interface:UserSearchService
Searches for a user with the specified e-mail address.- Specified by:
findUsersByEmail
in interfaceUserSearchService
- Parameters:
email
- the e-mail address to search.- Returns:
- collection of found users, empty if none were found.
-
filterUsers
@Nonnull public List<ApplicationUser> filterUsers(List<ApplicationUser> applicationUsers, String nameQuery, UserSearchParams userSearchParams) Description copied from interface:UserSearchService
Filter a list ofApplicationUser
based on provided criteria and return only those users that match.NB: The resultant list will be sorted and duplicates removed, if the
UserSearchParams.isSorted()
value is true. If this is set to false, then the resultant list will not be sorted and no duplicate checks performed, which may provide some better performance in specific scenarios, as the source list will be filtered as-is and all valid results returned in the order they were initially. If a max results value is provided (>= 0) in theUserSearchParams
then it will be limited in size to that value.- Specified by:
filterUsers
in interfaceUserSearchService
- Parameters:
applicationUsers
- the user to be filterednameQuery
- the query to search username and display name.userSearchParams
- the search criteria- Returns:
- a new list of users from provided list that match the filter criteria
-
filterUsers
@Nonnull public List<ApplicationUser> filterUsers(List<ApplicationUser> applicationUsers, String nameQuery, String emailQuery, UserSearchParams userSearchParams) Description copied from interface:UserSearchService
Filter a list ofApplicationUser
based on provided criteria and return only those users that match.NB: The resultant list will be sorted and duplicates removed, if the
UserSearchParams.isSorted()
value is true. If this is set to false, then the resultant list will not be sorted and no duplicate checks performed, which may provide some better performance in specific scenarios, as the source list will be filtered as-is and all valid results returned in the order they were initially. If a max results value is provided (>= 0) in theUserSearchParams
then it will be limited in size to that value.- Specified by:
filterUsers
in interfaceUserSearchService
- Parameters:
applicationUsers
- the user to be filterednameQuery
- the query to search username and display name.emailQuery
- the query to search email address, subject to userSearchParams.canMatchEmail.userSearchParams
- the search criteria- Returns:
- a new list of users from provided list that match the filter criteria
-