@ExperimentalApi
@ParametersAreNonnullByDefault
@ReturnValuesAreNonnullByDefault
public interface WatchService
A user can watch (subscribe) or unwatch (unsusbscribe) to events happening in a
Space
, a particular piece of
Content
or a
Label
.
It also provides a means for retrieving the effective watchers of a given piece of content. For e.g., if a user is watching a Space, and a Page in that Space is modified, for that page change it needs to produce a list of all watchers (i.e. watchers of that particular page plus watchers of the whole space).
Modifier and Type | Interface and Description |
---|---|
static interface |
WatchService.Validator
Provides methods for validating the permissions to watch / unwatch space / content / labels.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isWatchingContent(com.atlassian.sal.api.user.UserKey userKey,
ContentId contentId) |
boolean |
isWatchingSpace(com.atlassian.sal.api.user.UserKey userKey,
String spaceKey) |
boolean |
isWatchingSpace(com.atlassian.sal.api.user.UserKey userKey,
String spaceKey,
ContentType contentType) |
void |
unwatchContent(com.atlassian.sal.api.user.UserKey userKey,
ContentId contentId)
Remove a watch to the given
content |
void |
unwatchSpace(com.atlassian.sal.api.user.UserKey userKey,
String spaceKey)
Remove a watch to the given
space |
void |
unwatchSpace(com.atlassian.sal.api.user.UserKey userKey,
String spaceKey,
List<ContentType> contentTypes)
Remove a watch to the given
space |
WatchService.Validator |
validator()
Get the validator of the
WatchService . |
ContentWatch |
watchContent(com.atlassian.sal.api.user.UserKey userKey,
ContentId contentId)
Create a watch to the given
content |
@NonNull SpaceWatch |
watchSpace(com.atlassian.sal.api.user.UserKey userKey,
String spaceKey)
Create a watch to the given
space |
@NonNull SpaceWatch |
watchSpace(com.atlassian.sal.api.user.UserKey userKey,
String spaceKey,
List<ContentType> contentTypes)
Create a watch to the given
space |
boolean isWatchingSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey, ContentType contentType)
userKey
- the watcherspaceKey
- the key of the space to checkcontentType
- the content typespace
or not@NonNull SpaceWatch watchSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey, List<ContentType> contentTypes)
space
userKey
- the key of the user to add as a watcherspaceKey
- the key of the space to add the watch forcontentTypes
- the content types to remove the watch for, currently only ContentType.BLOG_POST
is supported if supplied@NonNull SpaceWatch watchSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey)
space
userKey
- the key of the user to add as a watcherspaceKey
- the key of the space to add the watch forvoid unwatchSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey, List<ContentType> contentTypes)
space
userKey
- the key of the user to add as a watcherspaceKey
- the key of the space to remove the watch forcontentTypes
- the content type to remove the watch for, currently only ContentType.BLOG_POST
is supported if suppliedvoid unwatchSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey)
space
userKey
- the key of the user to add as a watcherspaceKey
- the key of the space to remove the watch forboolean isWatchingSpace(com.atlassian.sal.api.user.UserKey userKey, String spaceKey)
userKey
- the watcherspaceKey
- the key of the space to checkspace
or notContentWatch watchContent(com.atlassian.sal.api.user.UserKey userKey, ContentId contentId)
content
userKey
- the key of the user to add as a watchercontentId
- the id of the content to add the watch forvoid unwatchContent(com.atlassian.sal.api.user.UserKey userKey, ContentId contentId)
content
userKey
- the key of the user to add as a watchercontentId
- the id of the content to remove the watch forboolean isWatchingContent(com.atlassian.sal.api.user.UserKey userKey, ContentId contentId)
userKey
- the watchercontentId
- the id of the content to checkcontent
or notWatchService.Validator validator()
WatchService
.Copyright © 2003–2020 Atlassian. All rights reserved.