Interface WatcherService
- All Known Implementing Classes:
DefaultWatcherService
@PublicApi
public interface WatcherService
Watcher-related business logic interface.
- Since:
- v4.2
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classUsed to return the result of a Bulk Watch or Bulk Unwatch operation. -
Method Summary
Modifier and TypeMethodDescriptionaddWatcher(Issue issue, ApplicationUser remoteUser, ApplicationUser watcher) Adds a watcher to an issue's list of watchers, returning the updated list of watchers.addWatcherToAll(Collection<Issue> issues, ApplicationUser remoteUser, ApplicationUser watcher) Adds a watcher to all of the supplied issues.addWatcherToAll(Collection<Issue> issues, ApplicationUser remoteUser, ApplicationUser watcher, Context taskContext) Adds a watcher to all of the supplied issues.booleancanUnwatchAll(Iterable<Issue> issues, ApplicationUser applicationUser) Whether the specified user can unwatch all the specified issues.booleancanWatchAll(Iterable<Issue> issues, ApplicationUser applicationUser) Whether the specified user can watch all the specified issues.getWatchers(Issue issue, ApplicationUser 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.booleanhasViewWatcherListPermission(Issue issue, ApplicationUser remoteUser) Returns a boolean indicating whether the given user is authorised to view an issue's watcher list.booleanReturns a boolean indicating whether watching is enabled in JIRA.removeWatcher(Issue issue, ApplicationUser remoteUser, ApplicationUser watcher) Removes a watcher from an issue's list of watchers, returning the updated list of watchers.removeWatcherFromAll(Collection<Issue> issues, ApplicationUser remoteUser, ApplicationUser watcher) Removes a watcher from all of the supplied issues.removeWatcherFromAll(Collection<Issue> issues, ApplicationUser remoteUser, ApplicationUser watcher, Context taskContext) Removes a watcher from all of the supplied issues.
-
Method Details
-
isWatchingEnabled
boolean isWatchingEnabled()Returns a boolean indicating whether watching is enabled in JIRA.- Returns:
- a boolean indicating whether watching is enabled
-
hasViewWatcherListPermission
Returns a boolean indicating whether the given user is authorised to view an issue's watcher list.- Parameters:
issue- an IssueremoteUser- a User- Returns:
- a boolean indicating whether the user is authorised to view the watcher list
-
getWatchers
ServiceOutcome<Pair<Integer,List<ApplicationUser>>> getWatchers(Issue issue, ApplicationUser remoteUser) throws WatchingDisabledException 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. Note that if the remote user does not have permission to view the list of watchers, it is possible for the number of elements in the returned user list to be less than the returned number of watchers.- Parameters:
issue- the Issue to find watchers forremoteUser- the calling User- Returns:
- a ServiceOutcome containing the total number of watchers, and a list of visible watchers
- Throws:
WatchingDisabledException- if watching is currently disabled
-
addWatcher
ServiceOutcome<List<ApplicationUser>> addWatcher(Issue issue, ApplicationUser remoteUser, ApplicationUser watcher) throws WatchingDisabledException Adds a watcher to an issue's list of watchers, returning the updated list of watchers.- Parameters:
issue- the issue to updateremoteUser- the remote user on behalf of which the operation is performedwatcher- the watcher to add- Returns:
- a ServiceOutcome containing a list of User
- Throws:
WatchingDisabledException- if watching is currently disabled
-
addWatcherToAll
WatcherService.BulkWatchResult addWatcherToAll(Collection<Issue> issues, ApplicationUser remoteUser, ApplicationUser watcher) throws WatchingDisabledException Adds a watcher to all of the supplied issues.If there is partial success, the issues which we can modify will be modified and the ones we cannot will be returned in a BulkWatchResult.
- Parameters:
issues- the list of issues to updateremoteUser- the remote user on behalf of which the operation is performedwatcher- the watcher to add- Returns:
- a BulkWatchResult containing the issues that could not be modified
- Throws:
WatchingDisabledException- if watching is currently disabled
-
addWatcherToAll
WatcherService.BulkWatchResult addWatcherToAll(Collection<Issue> issues, ApplicationUser remoteUser, ApplicationUser watcher, Context taskContext) throws WatchingDisabledException Adds a watcher to all of the supplied issues.If there is partial success, the issues which we can modify will be modified and the ones we cannot will be returned in a BulkWatchResult.
- Parameters:
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- Returns:
- a BulkWatchResult containing the issues that could not be modified
- Throws:
WatchingDisabledException- if watching is currently disabled
-
removeWatcher
ServiceOutcome<List<ApplicationUser>> removeWatcher(Issue issue, ApplicationUser remoteUser, ApplicationUser watcher) throws WatchingDisabledException Removes a watcher from an issue's list of watchers, returning the updated list of watchers.- Parameters:
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- Returns:
- a ServiceOutcome containing a list of User
- Throws:
WatchingDisabledException- if watching is currently disabled
-
removeWatcherFromAll
WatcherService.BulkWatchResult removeWatcherFromAll(Collection<Issue> issues, ApplicationUser remoteUser, ApplicationUser watcher) throws WatchingDisabledException Removes a watcher from all of the supplied issues.If there is partial success, the issues which we can modify will be modified and the ones we cannot will be returned in a BulkWatchResult.
- Parameters:
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- Returns:
- a BulkWatchResult containing the issues that could not be modified
- Throws:
WatchingDisabledException- if watching is currently disabled
-
removeWatcherFromAll
WatcherService.BulkWatchResult removeWatcherFromAll(Collection<Issue> issues, ApplicationUser remoteUser, ApplicationUser watcher, Context taskContext) throws WatchingDisabledException Removes a watcher from all of the supplied issues.If there is partial success, the issues which we can modify will be modified and the ones we cannot will be returned in a BulkWatchResult.
- Parameters:
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- Returns:
- a BulkWatchResult containing the issues that could not be modified
- Throws:
WatchingDisabledException- if watching is currently disabled
-
canWatchAll
Whether the specified user can watch all the specified issues.- Parameters:
issues- The list of issues to checkapplicationUser- The user to execute this check for- Returns:
- true; if the specified user can watch all the specified issues; otherwise, false is returned.
-
canUnwatchAll
Whether the specified user can unwatch all the specified issues.- Parameters:
issues- The list of issues to checkapplicationUser- The user to execute this check for- Returns:
- true; if the specified user can unwatch all the specified issues; otherwise, false is returned.
-