|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.bc.issue.watcher.DefaultWatcherService
public class DefaultWatcherService
Implementation of WatcherService.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.atlassian.jira.bc.issue.watcher.WatcherService |
---|
WatcherService.BulkWatchResult |
Constructor Summary | |
---|---|
DefaultWatcherService(ApplicationProperties applicationProperties,
I18nHelper.BeanFactory i18n,
PermissionManager permissionManager,
WatcherManager watcherManager,
UserManager userManager)
Creates a new DefaultWatcherService with the given dependencies. |
Method Summary | ||
---|---|---|
ServiceOutcome<List<com.atlassian.crowd.embedded.api.User>> |
addWatcher(Issue issue,
com.atlassian.crowd.embedded.api.User remoteUser,
com.atlassian.crowd.embedded.api.User watcher)
Adds a watcher to an issue's list of watchers, returning the updated list of watchers. |
|
WatcherService.BulkWatchResult |
addWatcherToAll(Collection<Issue> issues,
ApplicationUser remoteUser,
ApplicationUser watcher)
Adds a watcher to all of the supplied issues. |
|
WatcherService.BulkWatchResult |
addWatcherToAll(Collection<Issue> issues,
ApplicationUser remoteUser,
ApplicationUser watcher,
Context taskContext)
Adds a watcher to all of the supplied issues. |
|
protected boolean |
canEditWatcherList(Issue issue,
com.atlassian.crowd.embedded.api.User remoteUser)
Returns true iff the given User has permission to edit the watcher list of the issue. |
|
boolean |
canUnwatchAll(Iterable<Issue> issues,
ApplicationUser remoteUser)
Whether the specified user can unwatch all the specified issues. |
|
boolean |
canUnwatchAll(Iterable<Issue> issues,
com.atlassian.crowd.embedded.api.User remoteUser)
Deprecated. |
|
boolean |
canWatchAll(Iterable<Issue> issues,
ApplicationUser applicationUser)
Whether the specified user can watch all the specified issues. |
|
boolean |
canWatchAll(Iterable<Issue> issues,
com.atlassian.crowd.embedded.api.User remoteUser)
Deprecated. |
|
protected void |
checkModifyWatchersPermission(Issue issue,
ApplicationUser remoteUser,
ApplicationUser watcher)
Ensures that the given remoteUser has permission to add or remove the given watcher to/from the issue. |
|
protected
|
convertUsers(Pair<Integer,List<String>> watchers,
com.google.common.base.Function<String,T> function)
Converts the usernames into User objects using the given function. |
|
protected List<com.atlassian.crowd.embedded.api.User> |
getCurrentWatchersFor(Issue issue)
Returns a List containing the users that are currently watching an issue. |
|
ServiceOutcome<Pair<Integer,List<com.atlassian.crowd.embedded.api.User>>> |
getWatchers(Issue issue,
com.atlassian.crowd.embedded.api.User remoteUser)
Returns a the total number of watchers for a given issue in the first element of the returned Pair, and the list of visible watchers in the second element of the Pair. |
|
protected Pair<Integer,List<String>> |
getWatcherUsernames(Issue issue,
com.atlassian.crowd.embedded.api.User remoteUser)
Returns a pair containing the watcher count and the watcher usernames for a given issue. |
|
boolean |
hasViewWatcherListPermission(Issue issue,
com.atlassian.crowd.embedded.api.User remoteUser)
Returns true iff the given User has permission to view the watcher list of the issue. |
|
boolean |
isWatchingEnabled()
Returns true iff watching is enabled. |
|
ServiceOutcome<List<com.atlassian.crowd.embedded.api.User>> |
removeWatcher(Issue issue,
com.atlassian.crowd.embedded.api.User remoteUser,
com.atlassian.crowd.embedded.api.User watcher)
Removes a watcher from an issue's list of watchers, returning the updated list of watchers. |
|
WatcherService.BulkWatchResult |
removeWatcherFromAll(Collection<Issue> issues,
ApplicationUser remoteUser,
ApplicationUser watcher)
Removes a watcher from all of the supplied issues. |
|
WatcherService.BulkWatchResult |
removeWatcherFromAll(Collection<Issue> issues,
ApplicationUser remoteUser,
ApplicationUser watcher,
Context taskContext)
Removes a watcher from all of the supplied issues. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultWatcherService(ApplicationProperties applicationProperties, I18nHelper.BeanFactory i18n, PermissionManager permissionManager, WatcherManager watcherManager, UserManager userManager)
applicationProperties
- an ApplicationPropertiesi18n
- a I18nBeanpermissionManager
- a PermissionManagerwatcherManager
- a WatcherManageruserManager
- a UserManagerMethod Detail |
---|
public ServiceOutcome<Pair<Integer,List<com.atlassian.crowd.embedded.api.User>>> getWatchers(Issue issue, @Nullable com.atlassian.crowd.embedded.api.User remoteUser) throws WatchingDisabledException
WatcherService
getWatchers
in interface WatcherService
issue
- the Issue to find watchers forremoteUser
- the calling User
WatchingDisabledException
- if watching is currently disabledpublic ServiceOutcome<List<com.atlassian.crowd.embedded.api.User>> addWatcher(Issue issue, com.atlassian.crowd.embedded.api.User remoteUser, com.atlassian.crowd.embedded.api.User watcher) throws WatchingDisabledException
WatcherService
addWatcher
in interface WatcherService
issue
- the issue to updateremoteUser
- the remote user on behalf of which the operation is performedwatcher
- the watcher to add
WatchingDisabledException
- if watching is currently disabledpublic WatcherService.BulkWatchResult addWatcherToAll(Collection<Issue> issues, ApplicationUser remoteUser, ApplicationUser watcher) throws WatchingDisabledException
WatcherService
addWatcherToAll
in interface WatcherService
issues
- the list of issues to updateremoteUser
- the remote user on behalf of which the operation is performedwatcher
- the watcher to add
WatchingDisabledException
- if watching is currently disabledpublic WatcherService.BulkWatchResult addWatcherToAll(Collection<Issue> issues, ApplicationUser remoteUser, ApplicationUser watcher, Context taskContext) throws WatchingDisabledException
WatcherService
addWatcherToAll
in interface WatcherService
issues
- the list of issues to updateremoteUser
- the remote user on behalf of which the operation is performedwatcher
- the watcher to addtaskContext
- a context through which progress can be reported back
WatchingDisabledException
- if watching is currently disabledpublic ServiceOutcome<List<com.atlassian.crowd.embedded.api.User>> removeWatcher(Issue issue, com.atlassian.crowd.embedded.api.User remoteUser, com.atlassian.crowd.embedded.api.User watcher) throws WatchingDisabledException
WatcherService
removeWatcher
in interface WatcherService
issue
- the Issue to updateremoteUser
- a User indicating the user on behalf of whom this operation is being performedwatcher
- a User representing the User to remove from the watcher list
WatchingDisabledException
- if watching is currently disabledpublic WatcherService.BulkWatchResult removeWatcherFromAll(Collection<Issue> issues, ApplicationUser remoteUser, ApplicationUser watcher) throws WatchingDisabledException
WatcherService
removeWatcherFromAll
in interface WatcherService
issues
- the list of Issues to updateremoteUser
- an ApplicationUser indicating the user on behalf of whom this operation is being performedwatcher
- an ApplicationUser representing the user to remove from the watcher list for each issue
WatchingDisabledException
- if watching is currently disabledpublic WatcherService.BulkWatchResult removeWatcherFromAll(Collection<Issue> issues, ApplicationUser remoteUser, ApplicationUser watcher, Context taskContext) throws WatchingDisabledException
WatcherService
removeWatcherFromAll
in interface WatcherService
issues
- the list of Issues to updateremoteUser
- an ApplicationUser indicating the user on behalf of whom this operation is being performedwatcher
- an ApplicationUser representing the user to remove from the watcher list for each issuetaskContext
- a context through which progress can be reported back
WatchingDisabledException
- if watching is currently disabled@Deprecated public boolean canWatchAll(Iterable<Issue> issues, com.atlassian.crowd.embedded.api.User remoteUser)
WatcherService
canWatchAll
in interface WatcherService
issues
- The list of issues to checkremoteUser
- The user to execute this check for
public boolean canWatchAll(Iterable<Issue> issues, ApplicationUser applicationUser)
WatcherService
canWatchAll
in interface WatcherService
issues
- The list of issues to checkapplicationUser
- The user to execute this check for
@Deprecated public boolean canUnwatchAll(Iterable<Issue> issues, com.atlassian.crowd.embedded.api.User remoteUser)
WatcherService
canUnwatchAll
in interface WatcherService
issues
- The list of issues to checkremoteUser
- The user to execute this check for
public boolean canUnwatchAll(Iterable<Issue> issues, ApplicationUser remoteUser)
WatcherService
canUnwatchAll
in interface WatcherService
issues
- The list of issues to checkremoteUser
- The user to execute this check for
public boolean isWatchingEnabled()
isWatchingEnabled
in interface WatcherService
public boolean hasViewWatcherListPermission(Issue issue, @Nullable com.atlassian.crowd.embedded.api.User remoteUser)
hasViewWatcherListPermission
in interface WatcherService
issue
- an IssueremoteUser
- a User
protected Pair<Integer,List<String>> getWatcherUsernames(Issue issue, com.atlassian.crowd.embedded.api.User remoteUser) throws WatchingDisabledException
issue
- the IssueremoteUser
- the calling User
WatchingDisabledException
- if watching is disabledprotected List<com.atlassian.crowd.embedded.api.User> getCurrentWatchersFor(Issue issue)
issue
- the Issue to get the watcher list for
protected boolean canEditWatcherList(Issue issue, @Nullable com.atlassian.crowd.embedded.api.User remoteUser)
issue
- an IssueremoteUser
- a User
protected <T extends com.atlassian.crowd.embedded.api.User> Pair<Integer,List<T>> convertUsers(Pair<Integer,List<String>> watchers, com.google.common.base.Function<String,T> function)
watchers
- a Pair of watcher count and watcher usernamesfunction
- a Function used for conversion
protected void checkModifyWatchersPermission(Issue issue, ApplicationUser remoteUser, ApplicationUser watcher) throws com.atlassian.jira.bc.issue.watcher.DefaultWatcherService.PermissionException, WatchingDisabledException
issue
- an IssueremoteUser
- a User representing the callerwatcher
- a User representing the watcher to add or remove
PermissionException
- if the caller does not have permission to manage watchers, or cannot see the issue
WatchingDisabledException
- if watching is disabled
com.atlassian.jira.bc.issue.watcher.DefaultWatcherService.PermissionException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |