public class DefaultUserPickerSearchService extends Object implements UserPickerSearchService, UserSearchService
Constructor and Description |
---|
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) |
Modifier and Type | Method and Description |
---|---|
boolean |
canPerformAjaxSearch(ApplicationUser user)
Determines whether the given user could perform AJAX search.
|
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 |
canShowEmailAddresses(JiraServiceContext jiraServiceContext)
Whether or not the UserPicker Ajax should search or show email addresses
|
List<ApplicationUser> |
filterUsers(List<ApplicationUser> applicationUsers,
String nameQuery,
String emailQuery,
UserSearchParams userSearchParams)
Filter a list of
ApplicationUser based on provided criteria and return only those users that match. |
List<ApplicationUser> |
filterUsers(List<ApplicationUser> applicationUsers,
String nameQuery,
UserSearchParams userSearchParams)
Filter a list of
ApplicationUser based on provided criteria and return only those users that match. |
List<ApplicationUser> |
findTopAssignableUsers(String searchName,
UserSearchIssueContext userSearchIssueContext,
int topN)
Finds
topN users that can be assigned in a given issue. |
List<ApplicationUser> |
findTopMentionableUsers(String searchName,
UserSearchIssueContext userSearchIssueContext,
int topN)
Finds
topN mentionable users in a given issue. |
Iterable<String> |
findUserKeysByEmail(String email)
Searches for a user with the specified e-mail address.
|
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)
Get Users based on a query string.
|
List<ApplicationUser> |
findUsers(JiraServiceContext jiraServiceContext,
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> |
findUsers(String query,
UserSearchParams userSearchParams)
Get Users based on a query string.
|
List<ApplicationUser> |
findUsersAllowEmptyQuery(JiraServiceContext jiraServiceContext,
String query)
Get Users based on a query string.
|
Iterable<ApplicationUser> |
findUsersByEmail(String email)
Searches for a user with the specified e-mail address.
|
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. |
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)
public List<ApplicationUser> findUsers(JiraServiceContext jiraServiceContext, String query)
UserPickerSearchService
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
.
findUsers
in interface UserPickerSearchService
findUsers
in interface UserSearchService
jiraServiceContext
- Jira Service Contextquery
- String to search for.ApplicationUser
objects that match criteria.UserPickerSearchService.findUsers(JiraServiceContext, String, UserSearchParams)
public ApplicationUser getUserByName(JiraServiceContext jiraServiceContext, String query)
UserPickerSearchService
getUserByName
in interface UserPickerSearchService
getUserByName
in interface UserSearchService
jiraServiceContext
- Jira Service Contextquery
- String to search for.ApplicationUser
object with supplied username.public List<ApplicationUser> findUsersAllowEmptyQuery(JiraServiceContext jiraServiceContext, String query)
UserPickerSearchService
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
.
findUsersAllowEmptyQuery
in interface UserPickerSearchService
findUsersAllowEmptyQuery
in interface UserSearchService
jiraServiceContext
- Jira Service Contextquery
- String to search for.ApplicationUser
objects that match criteria.UserPickerSearchService.findUsers(JiraServiceContext, String, UserSearchParams)
public List<ApplicationUser> findUsers(JiraServiceContext jiraServiceContext, String query, UserSearchParams userSearchParams)
UserPickerSearchService
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.
findUsers
in interface UserPickerSearchService
findUsers
in interface UserSearchService
jiraServiceContext
- Jira Service Contextquery
- String to search for.userSearchParams
- Additional search parametersApplicationUser
objects that match criteria.public List<ApplicationUser> findUsers(String query, UserSearchParams userSearchParams)
UserPickerSearchService
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.
findUsers
in interface UserPickerSearchService
findUsers
in interface UserSearchService
query
- the query to search username, display name and email addressuserSearchParams
- the search criteriapublic List<ApplicationUser> findUsers(String nameQuery, String emailQuery, UserSearchParams userSearchParams)
UserPickerSearchService
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.
findUsers
in interface UserPickerSearchService
findUsers
in interface UserSearchService
nameQuery
- the query to search username and display name.emailQuery
- the query to search email address, subject to userSearchParams.canMatchEmail.userSearchParams
- the search criteriapublic List<String> findUserNames(String query, UserSearchParams userSearchParams)
UserSearchService
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.
findUserNames
in interface UserSearchService
query
- the query to search username, display name and email addressuserSearchParams
- the search criteriapublic List<String> findUserNames(String nameQuery, String emailQuery, UserSearchParams userSearchParams)
UserSearchService
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.
findUserNames
in interface UserSearchService
nameQuery
- the query to search username and display name.emailQuery
- the query to search email address, subject to userSearchParams.canMatchEmail.userSearchParams
- the search criteriapublic List<ApplicationUser> findTopMentionableUsers(String searchName, UserSearchIssueContext userSearchIssueContext, int topN)
UserSearchService
topN
mentionable users in a given issue.findTopMentionableUsers
in interface UserSearchService
ApplicationUser
matching requirements ordered ascending by user display namepublic List<ApplicationUser> findTopAssignableUsers(String searchName, UserSearchIssueContext userSearchIssueContext, int topN)
UserSearchService
topN
users that can be assigned in a given issue.findTopAssignableUsers
in interface UserSearchService
ApplicationUser
matching requirements ordered ascending by user display namepublic boolean userMatches(ApplicationUser user, UserSearchParams userSearchParams)
UserPickerSearchService
userSearchParams
parameter.
allowEmptyQuery in userSearchParams
is ignored.
userMatches
in interface UserPickerSearchService
userMatches
in interface UserSearchService
user
- the user to be matcheduserSearchParams
- the search criteriapublic boolean canShowEmailAddresses(JiraServiceContext jiraServiceContext)
UserPickerSearchService
canShowEmailAddresses
in interface UserPickerSearchService
canShowEmailAddresses
in interface UserSearchService
jiraServiceContext
- Jira Service ContextUserSearchService.canShowEmailAddresses(com.atlassian.jira.bc.JiraServiceContext)
public boolean canPerformAjaxSearch(JiraServiceContext jiraServiceContext)
UserPickerSearchService
canPerformAjaxSearch
in interface UserPickerSearchService
canPerformAjaxSearch
in interface UserSearchService
jiraServiceContext
- Jira Service Contextpublic boolean canPerformAjaxSearch(ApplicationUser user)
UserPickerSearchService
canPerformAjaxSearch
in interface UserPickerSearchService
canPerformAjaxSearch
in interface UserSearchService
@Nonnull public Iterable<String> findUserKeysByFullName(@Nullable String fullName)
UserSearchService
findUserKeysByFullName
in interface UserSearchService
fullName
- the full name to search for.@Nonnull public Iterable<String> findUserKeysByEmail(@Nullable String email)
UserSearchService
findUserKeysByEmail
in interface UserSearchService
email
- the e-mail address to search.@Nonnull public Iterable<ApplicationUser> findUsersByFullName(@Nullable String fullName)
UserSearchService
findUsersByFullName
in interface UserSearchService
fullName
- the full name to search for.@Nonnull public Iterable<ApplicationUser> findUsersByEmail(@Nullable String email)
UserSearchService
findUsersByEmail
in interface UserSearchService
email
- the e-mail address to search.@Nonnull public List<ApplicationUser> filterUsers(List<ApplicationUser> applicationUsers, String nameQuery, UserSearchParams userSearchParams)
UserSearchService
ApplicationUser
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
the UserSearchParams
then it will be limited in size to that value.
filterUsers
in interface UserSearchService
applicationUsers
- the user to be filterednameQuery
- the query to search username and display name.userSearchParams
- the search criteria@Nonnull public List<ApplicationUser> filterUsers(List<ApplicationUser> applicationUsers, String nameQuery, String emailQuery, UserSearchParams userSearchParams)
UserSearchService
ApplicationUser
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
the UserSearchParams
then it will be limited in size to that value.
filterUsers
in interface UserSearchService
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 criteriaCopyright © 2002-2022 Atlassian. All Rights Reserved.