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

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

public class DefaultAssigneeService
extends Object
implements AssigneeService

The main implementation of AssigneeService.

Since:
v5.0

Constructor Summary
DefaultAssigneeService(PermissionContextFactory permissionContextFactory, PermissionSchemeManager permissionSchemeManager, UserHistoryManager userHistoryManager, FeatureManager featureManager, JiraAuthenticationContext authenticationContext, UserKeyService userKeyService)
           
 
Method Summary
 Collection<com.atlassian.crowd.embedded.api.User> findAssignableUsers(String query, Issue issue, com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor)
          Get assignable Users based on a query string and issue.
 Collection<com.atlassian.crowd.embedded.api.User> findAssignableUsers(String query, Project project)
          Get assignable Users based on a query string and project.
 List<com.atlassian.crowd.embedded.api.User> getAssignableUsers(Collection<Issue> issues, com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor)
          Get all Users that may have all of the given Issues assigned to them, for a given workflow state.
 List<com.atlassian.crowd.embedded.api.User> getAssignableUsers(Issue issue, com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor)
          Get all Users that may have an Issue assigned to them, for a given workflow state.
 Set<String> getRecentAssigneeKeysForIssue(Issue issue)
          Gets ids of this issue's recent assignees, including the current assignee.
 Set<String> getRecentAssigneeKeysForUser(com.atlassian.crowd.embedded.api.User remoteUser)
          Get users keys that the given user has recently assigned issues to.
 Set<String> getRecentAssigneeNamesForIssue(Issue issue)
          Gets the names of this issue's recent assignees, including the current assignee.
 Set<String> getRecentAssigneeNamesForUser(com.atlassian.crowd.embedded.api.User remoteUser)
          Get users names that the given user has recently assigned issues to.
 List<com.atlassian.crowd.embedded.api.User> getSuggestedAssignees(Issue issue, com.atlassian.crowd.embedded.api.User loggedInUser, com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor)
          Returns a list of suggested Assignee Users for a given Issue and logged-in User.
 List<com.atlassian.crowd.embedded.api.User> getSuggestedAssignees(Issue issue, com.atlassian.crowd.embedded.api.User loggedInUser, List<com.atlassian.crowd.embedded.api.User> assignableUsers)
          Returns a list of suggested Assignee Users for a given Issue and logged-in User.
 List<com.atlassian.crowd.embedded.api.User> getSuggestedAssignees(Set<String> suggestedAssigneeNames, List<com.atlassian.crowd.embedded.api.User> assignableUsers)
          Given a set of suggested names and an ordered list of assignable users, returns an order list of suggested users.
 Map<String,Boolean> makeUniqueFullNamesMap(Collection<com.atlassian.crowd.embedded.api.User> users)
          Converts a collection of Users to a Map where the key is the User full name and the value is true or false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAssigneeService

public DefaultAssigneeService(PermissionContextFactory permissionContextFactory,
                              PermissionSchemeManager permissionSchemeManager,
                              UserHistoryManager userHistoryManager,
                              FeatureManager featureManager,
                              JiraAuthenticationContext authenticationContext,
                              UserKeyService userKeyService)
Method Detail

getSuggestedAssignees

public List<com.atlassian.crowd.embedded.api.User> getSuggestedAssignees(Issue issue,
                                                                         @Nullable
                                                                         com.atlassian.crowd.embedded.api.User loggedInUser,
                                                                         @Nullable
                                                                         com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor)
Description copied from interface: AssigneeService
Returns a list of suggested Assignee Users for a given Issue and logged-in User.

This version accepts a pre-populated list of assignable Users to filter.

Specified by:
getSuggestedAssignees in interface AssigneeService
Parameters:
issue - Issue to get suggested Assignees for
loggedInUser - the user getting the suggestions, whose Assignee history may be queried
actionDescriptor - workflow action descriptor to filter users on
Returns:
List of User objects deemed relevant to the given Issue and User, sorted by UserBestNameComparator

getSuggestedAssignees

public List<com.atlassian.crowd.embedded.api.User> getSuggestedAssignees(Issue issue,
                                                                         com.atlassian.crowd.embedded.api.User loggedInUser,
                                                                         List<com.atlassian.crowd.embedded.api.User> assignableUsers)
Description copied from interface: AssigneeService
Returns a list of suggested Assignee Users for a given Issue and logged-in User.

This version accepts a pre-populated list of assignable Users to filter.

Specified by:
getSuggestedAssignees in interface AssigneeService
Parameters:
issue - Issue to get suggested Assignees for
loggedInUser - the user getting the suggestions, whose Assignee history may be queried
assignableUsers - a list of Users to filter
Returns:
List of User objects deemed relevant to the given Issue and User.

findAssignableUsers

public Collection<com.atlassian.crowd.embedded.api.User> findAssignableUsers(String query,
                                                                             Issue issue,
                                                                             @Nullable
                                                                             com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor)
Description copied from interface: AssigneeService
Get assignable Users based on a query string and issue.

Matches on the start of username, Each word in Full Name & email.

Results are sorted according to the UserCachingComparator.

Specified by:
findAssignableUsers in interface AssigneeService
Parameters:
query - String to search for.
issue - Issue to check Assignee permissions against
actionDescriptor - an ActionDescriptor describing the context in which the Assignee is being searched
Returns:
List of User objects that match criteria.

findAssignableUsers

public Collection<com.atlassian.crowd.embedded.api.User> findAssignableUsers(String query,
                                                                             Project project)
Description copied from interface: AssigneeService
Get assignable Users based on a query string and project.

Matches on the start of username, Each word in Full Name & email.

Results are sorted according to the UserCachingComparator.

Specified by:
findAssignableUsers in interface AssigneeService
Parameters:
query - String to search for.
project - Project check Assignee permissions against
Returns:
List of User objects that match criteria.

getSuggestedAssignees

public List<com.atlassian.crowd.embedded.api.User> getSuggestedAssignees(Set<String> suggestedAssigneeNames,
                                                                         List<com.atlassian.crowd.embedded.api.User> assignableUsers)
Given a set of suggested names and an ordered list of assignable users, returns an order list of suggested users.

Specified by:
getSuggestedAssignees in interface AssigneeService
Parameters:
suggestedAssigneeNames - the names of the users to return
assignableUsers - a list of Users to filter by the suggested assignee names
Returns:
a filtered List of assignable Users that are suggested as Assignees

getAssignableUsers

public List<com.atlassian.crowd.embedded.api.User> getAssignableUsers(Issue issue,
                                                                      com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor)
Description copied from interface: AssigneeService
Get all Users that may have an Issue assigned to them, for a given workflow state.

The ActionDescriptor may be used to check for workflow states that only allow a subset of normally-assignable users.

Specified by:
getAssignableUsers in interface AssigneeService
Parameters:
issue - the Issue to find assignable users for
actionDescriptor - workflow action descriptor to filter users on
Returns:
a list of Users sorted by name

getAssignableUsers

public List<com.atlassian.crowd.embedded.api.User> getAssignableUsers(Collection<Issue> issues,
                                                                      com.opensymphony.workflow.loader.ActionDescriptor actionDescriptor)
Description copied from interface: AssigneeService
Get all Users that may have all of the given Issues assigned to them, for a given workflow state.

The ActionDescriptor may be used to check for workflow states that only allow a subset of normally-assignable users.

Note: This method is exactly equivalent to AssigneeService.getAssignableUsers(Issue, ActionDescriptor), but returns only those users that are assignable for all of the issues. This is significantly more efficient than calling AssigneeService.getAssignableUsers(Issue, ActionDescriptor) multiple times and filtering the lists yourself.

Specified by:
getAssignableUsers in interface AssigneeService
Parameters:
issues - the Issues to find assignable users for
actionDescriptor - workflow action descriptor to filter users on
Returns:
a list of Users sorted by name

getRecentAssigneeKeysForIssue

public Set<String> getRecentAssigneeKeysForIssue(Issue issue)
Gets ids of this issue's recent assignees, including the current assignee.

Specified by:
getRecentAssigneeKeysForIssue in interface AssigneeService
Parameters:
issue - an issue to get the change history of
Returns:
a set of ids
See Also:
AssigneeService.getRecentAssigneeNamesForIssue(com.atlassian.jira.issue.Issue)

getRecentAssigneeNamesForIssue

public Set<String> getRecentAssigneeNamesForIssue(Issue issue)
Gets the names of this issue's recent assignees, including the current assignee.

Specified by:
getRecentAssigneeNamesForIssue in interface AssigneeService
Parameters:
issue - an issue to get the change history of
Returns:
a set of usernames
See Also:
AssigneeService.getRecentAssigneeKeysForIssue(com.atlassian.jira.issue.Issue)

makeUniqueFullNamesMap

public Map<String,Boolean> makeUniqueFullNamesMap(Collection<com.atlassian.crowd.embedded.api.User> users)
Description copied from interface: AssigneeService
Converts a collection of Users to a Map where the key is the User full name and the value is true or false.

The value will be true if no other user with that exact full name exists. The value will be false if at least one other user with that exact full name exists.

Specified by:
makeUniqueFullNamesMap in interface AssigneeService
Parameters:
users - a collection of Users that may contain multiple users with the same full name
Returns:
a map of user full name Strings to a uniqueness boolean flag

getRecentAssigneeNamesForUser

public Set<String> getRecentAssigneeNamesForUser(com.atlassian.crowd.embedded.api.User remoteUser)
Get users names that the given user has recently assigned issues to.

Specified by:
getRecentAssigneeNamesForUser in interface AssigneeService
Parameters:
remoteUser - a User
Returns:
a list of user names

getRecentAssigneeKeysForUser

public Set<String> getRecentAssigneeKeysForUser(com.atlassian.crowd.embedded.api.User remoteUser)
Get users keys that the given user has recently assigned issues to.

Specified by:
getRecentAssigneeKeysForUser in interface AssigneeService
Parameters:
remoteUser - a User
Returns:
a list of user keys


Copyright © 2002-2014 Atlassian. All Rights Reserved.