com.atlassian.jira.bc.user.search
Class DefaultUserPickerSearchService

java.lang.Object
  extended by com.atlassian.jira.bc.user.search.DefaultUserPickerSearchService
All Implemented Interfaces:
UserPickerSearchService

public class DefaultUserPickerSearchService
extends Object
implements UserPickerSearchService


Constructor Summary
DefaultUserPickerSearchService(UserManager userManager, ApplicationProperties applicationProperties, JiraAuthenticationContext authenticationContext, PermissionManager permissionManager, GroupManager groupManager, ProjectManager projectManager, ProjectRoleManager projectRoleManager)
          Constructs a DefaultUserPickerSearchService
 
Method Summary
 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 User Browse permission.
 boolean canPerformAjaxSearch(com.atlassian.crowd.embedded.api.User user)
           
 boolean canShowEmailAddresses(JiraServiceContext jiraServiceContext)
          Whether or not the UserPicker Ajax should search or show email addresses
 List<com.atlassian.crowd.embedded.api.User> findUsers(JiraServiceContext jiraServiceContext, String query)
          Get Users based on a query string.
 List<com.atlassian.crowd.embedded.api.User> findUsers(JiraServiceContext jiraServiceContext, String query, UserSearchParams userSearchParams)
          Get Users based on a query string.
 List<com.atlassian.crowd.embedded.api.User> findUsers(String nameQuery, String emailQuery, UserSearchParams userSearchParams)
          Get Users based on query strings.
 List<com.atlassian.crowd.embedded.api.User> findUsers(String query, UserSearchParams userSearchParams)
          Get Users based on a query string.
 List<com.atlassian.crowd.embedded.api.User> findUsersAllowEmptyQuery(JiraServiceContext jiraServiceContext, String query)
          Get Users based on a query string.
 com.atlassian.crowd.embedded.api.User 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultUserPickerSearchService

public DefaultUserPickerSearchService(UserManager userManager,
                                      ApplicationProperties applicationProperties,
                                      JiraAuthenticationContext authenticationContext,
                                      PermissionManager permissionManager,
                                      GroupManager groupManager,
                                      ProjectManager projectManager,
                                      ProjectRoleManager projectRoleManager)
Constructs a DefaultUserPickerSearchService

Parameters:
userManager - the UserUtil needed
applicationProperties - the ApplicationProperties
authenticationContext -
permissionManager - needed to resolve permissions
projectManager -
projectRoleManager -
Method Detail

findUsers

public List<com.atlassian.crowd.embedded.api.User> findUsers(JiraServiceContext jiraServiceContext,
                                                             String query)
Description copied from interface: UserPickerSearchService
Get Users based on a query string.

Matches on the start of username and each word in Full Name & email. Only returns active users.

Results are sorted according to the UserCachingComparator.

Specified by:
findUsers in interface UserPickerSearchService
Parameters:
jiraServiceContext - Jira Service Context
query - String to search for.
Returns:
List of User objects that match criteria.
See Also:
UserPickerSearchService.findUsers(com.atlassian.jira.bc.JiraServiceContext, String, UserSearchParams)

getUserByName

public com.atlassian.crowd.embedded.api.User getUserByName(JiraServiceContext jiraServiceContext,
                                                           String query)
Description copied from interface: UserPickerSearchService
Returns a user by exact username

Specified by:
getUserByName in interface UserPickerSearchService
Parameters:
jiraServiceContext - Jira Service Context
query - String to search for.
Returns:
The User object with supplied username.

findUsersAllowEmptyQuery

public List<com.atlassian.crowd.embedded.api.User> findUsersAllowEmptyQuery(JiraServiceContext jiraServiceContext,
                                                                            String query)
Description copied from interface: UserPickerSearchService
Get Users based on a query string.

Matches on the start of username and each word in Full Name & email. 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 interface UserPickerSearchService
Parameters:
jiraServiceContext - Jira Service Context
query - String to search for.
Returns:
List of User objects that match criteria.
See Also:
UserPickerSearchService.findUsers(com.atlassian.jira.bc.JiraServiceContext, String, UserSearchParams)

findUsers

public List<com.atlassian.crowd.embedded.api.User> findUsers(JiraServiceContext jiraServiceContext,
                                                             String query,
                                                             UserSearchParams userSearchParams)
Description copied from interface: UserPickerSearchService
Get Users based on a query string.

Matches on the start of username and each word in Full Name & email.

Results are sorted according to the UserCachingComparator.

Specified by:
findUsers in interface UserPickerSearchService
Parameters:
jiraServiceContext - Jira Service Context
query - String to search for.
userSearchParams - Additional search parameters
Returns:
List of User objects that match criteria.

findUsers

public List<com.atlassian.crowd.embedded.api.User> findUsers(String query,
                                                             UserSearchParams userSearchParams)
Description copied from interface: UserPickerSearchService
Get Users based on a query string.

Matches on the start of username and each word in Full Name & email.

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.

Specified by:
findUsers in interface UserPickerSearchService
Parameters:
query - the query to search username, display name and email address
userSearchParams - the search criteria
Returns:
the list of matched users

findUsers

public List<com.atlassian.crowd.embedded.api.User> findUsers(String nameQuery,
                                                             String emailQuery,
                                                             UserSearchParams userSearchParams)
Description copied from interface: UserPickerSearchService
Get Users based on query strings.

Matches nameQuery on the start of username and each word in Full Name & email.

Matches emailQuery on start of email. 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.

Specified by:
findUsers in interface UserPickerSearchService
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

userMatches

public boolean userMatches(ApplicationUser user,
                           UserSearchParams userSearchParams)
Description copied from interface: UserPickerSearchService
Determine whether a user matches the search criteria specified in the userSearchParams parameter.

allowEmptyQuery in userSearchParams is ignored.

Specified by:
userMatches in interface UserPickerSearchService
Parameters:
user - the user to be matched
userSearchParams - the search criteria
Returns:
true if the user matches the search criteria

canShowEmailAddresses

public boolean canShowEmailAddresses(JiraServiceContext jiraServiceContext)
Description copied from interface: UserPickerSearchService
Whether or not the UserPicker Ajax should search or show email addresses

Specified by:
canShowEmailAddresses in interface UserPickerSearchService
Parameters:
jiraServiceContext - Jira Service Context
Returns:
True if email addresses can be shown, otherwise false
See Also:
UserPickerSearchService.canShowEmailAddresses(com.atlassian.jira.bc.JiraServiceContext)

canPerformAjaxSearch

public boolean canPerformAjaxSearch(JiraServiceContext jiraServiceContext)
Description copied from interface: UserPickerSearchService
Returns true only if UserPicker Ajax search is enabled AND the user in the context has User Browse permission.

Specified by:
canPerformAjaxSearch in interface UserPickerSearchService
Parameters:
jiraServiceContext - Jira Service Context
Returns:
True if enabled, otherwise false

canPerformAjaxSearch

public boolean canPerformAjaxSearch(com.atlassian.crowd.embedded.api.User user)
Specified by:
canPerformAjaxSearch in interface UserPickerSearchService
See Also:
UserPickerSearchService.canPerformAjaxSearch(com.atlassian.jira.bc.JiraServiceContext)

canPerformAjaxSearch

public boolean canPerformAjaxSearch(ApplicationUser user)
Description copied from interface: UserPickerSearchService
Determines whether the given user could perform AJAX search.

Specified by:
canPerformAjaxSearch in interface UserPickerSearchService


Copyright © 2002-2014 Atlassian. All Rights Reserved.