com.atlassian.jira.issue.watchers
Class DefaultWatcherManager

java.lang.Object
  extended by com.atlassian.jira.issue.watchers.DefaultWatcherManager
All Implemented Interfaces:
WatcherManager

public class DefaultWatcherManager
extends Object
implements WatcherManager


Field Summary
static String ASSOCIATION_TYPE
           
 
Constructor Summary
DefaultWatcherManager(UserAssociationStore userAssociationStore, ApplicationProperties applicationProperties, IssueIndexManager indexManager, UserManager userManager, IssueFactory issueFactory, com.atlassian.event.api.EventPublisher eventPublisher, IssueManager issueManager)
           
 
Method Summary
 List<String> getCurrentWatcherUsernames(org.ofbiz.core.entity.GenericValue issue)
          Retrieve the list of usernames of users watching the given issue
 List<String> getCurrentWatcherUsernames(Issue issue)
          Retrieve the list of usernames of users watching the given issue
 Collection<com.atlassian.crowd.embedded.api.User> getCurrentWatchList(Issue issue, Locale userLocale)
          Retrieve collection of users that are currently watching this issue (including the current user)
 int getWatcherCount(Issue issue)
          Returns the number of users watching this issue.
 List<ApplicationUser> getWatchers(Issue issue, Locale userLocale)
          Retrieve list of users that are currently watching this issue (including the current user).
 Collection<String> getWatcherUserKeys(Issue issue)
          Retrieve list of users that are currently watching this issue (including the current user).
 boolean isWatching(ApplicationUser user, Issue issue)
          Determine whether the current user is already watching the issue or not
 boolean isWatching(com.atlassian.crowd.embedded.api.User user, org.ofbiz.core.entity.GenericValue issue)
          Determine whether the current user is already watching the issue or not
 boolean isWatching(com.atlassian.crowd.embedded.api.User user, Issue issue)
          Determine whether the current user is already watching the issue or not
 boolean isWatchingEnabled()
           
 void removeAllWatchesForUser(ApplicationUser user)
          Remove all watches for a given user
 void removeAllWatchesForUser(com.atlassian.crowd.embedded.api.User user)
          Remove all watches for a given user
 void startWatching(ApplicationUser user, Collection<Issue> issues)
          Enable watching of a list of issues for the user supplied.
 void startWatching(ApplicationUser user, Issue issue)
          Enable watching of a particular issue for the user supplied.
 void startWatching(com.atlassian.crowd.embedded.api.User user, org.ofbiz.core.entity.GenericValue issueGV)
          Enable watching of a particular issue for the user supplied.
 void startWatching(com.atlassian.crowd.embedded.api.User user, Issue issue)
          Enable watching of a particular issue for the user supplied.
 void stopWatching(ApplicationUser user, Collection<Issue> issues)
          Disable watching of a list of issues for the user supplied.
 void stopWatching(ApplicationUser user, Issue issue)
          Disable watching of a particular issue for the user supplied.
 void stopWatching(String username, org.ofbiz.core.entity.GenericValue issueGV)
          Disable watching of a particular issue for the user supplied.
 void stopWatching(com.atlassian.crowd.embedded.api.User user, org.ofbiz.core.entity.GenericValue issueGV)
          Disable watching of a particular issue for the user supplied.
 void stopWatching(com.atlassian.crowd.embedded.api.User user, Issue issue)
          Disable watching of a particular issue for the user supplied.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASSOCIATION_TYPE

public static final String ASSOCIATION_TYPE
See Also:
Constant Field Values
Constructor Detail

DefaultWatcherManager

public DefaultWatcherManager(UserAssociationStore userAssociationStore,
                             ApplicationProperties applicationProperties,
                             IssueIndexManager indexManager,
                             UserManager userManager,
                             IssueFactory issueFactory,
                             com.atlassian.event.api.EventPublisher eventPublisher,
                             IssueManager issueManager)
Method Detail

startWatching

public void startWatching(com.atlassian.crowd.embedded.api.User user,
                          Issue issue)
Description copied from interface: WatcherManager
Enable watching of a particular issue for the user supplied.

This means the user will receive updates for any modifications to the issue. Note, that this will not check if a user has the BROWSE_ISSUE permission. Notifications will however only be sent to users who have the appropriate permissions. Adding a permission check here would complicate updating permission schemes a lot, as it would have to update issue's watchers lists.

Specified by:
startWatching in interface WatcherManager
Parameters:
user - user that starts watching the given issue
issue - issue being watched

startWatching

public void startWatching(ApplicationUser user,
                          Issue issue)
Description copied from interface: WatcherManager
Enable watching of a particular issue for the user supplied.

This means the user will receive updates for any modifications to the issue. Note, that this will not check if a user has the BROWSE_ISSUE permission. Notifications will however only be sent to users who have the appropriate permissions. Adding a permission check here would complicate updating permission schemes a lot, as it would have to update issue's watchers lists.

Specified by:
startWatching in interface WatcherManager
Parameters:
user - user that starts watching the given issue
issue - issue being watched

startWatching

public void startWatching(ApplicationUser user,
                          Collection<Issue> issues)
Description copied from interface: WatcherManager
Enable watching of a list of issues for the user supplied.

This means the user will receive updates for any modifications to the issues. Note, that this will not check if a user has the BROWSE_ISSUE permission. Notifications will however only be sent to users who have the appropriate permissions. Adding a permission check here would complicate updating permission schemes a lot, as it would have to update issues' watchers lists.

This bulk method is more performant than calling the single version multiple times, as it indexes the issues in bulk rather than one at a time.

Specified by:
startWatching in interface WatcherManager
Parameters:
user - user that starts watching the given issues
issues - the list of issues to watch

startWatching

public void startWatching(com.atlassian.crowd.embedded.api.User user,
                          org.ofbiz.core.entity.GenericValue issueGV)
Description copied from interface: WatcherManager
Enable watching of a particular issue for the user supplied.

This means the user will receive updates for any modifications to the issue. Note, that this will not check if a user has the BROWSE_ISSUE permission. Notifications will however only be sent to users who have the appropriate permissions. Adding a permission check here would complicate updating permission schemes a lot, as it would have to update issue's watchers lists.

Specified by:
startWatching in interface WatcherManager
Parameters:
user - user that starts watching the given issue
issueGV - issue being watched

stopWatching

public void stopWatching(String username,
                         org.ofbiz.core.entity.GenericValue issueGV)
Description copied from interface: WatcherManager
Disable watching of a particular issue for the user supplied.

Note: Use this method in case when user no longer exists in JIRA, e.g. JIRA uses external user management and user was removed externally.

Specified by:
stopWatching in interface WatcherManager
Parameters:
username - username of the user that stops watching the given issue
issueGV - issue being watched

stopWatching

public void stopWatching(com.atlassian.crowd.embedded.api.User user,
                         Issue issue)
Description copied from interface: WatcherManager
Disable watching of a particular issue for the user supplied.

Specified by:
stopWatching in interface WatcherManager
Parameters:
user - user that stops watching the given issue
issue - issue being watched

stopWatching

public void stopWatching(ApplicationUser user,
                         Issue issue)
Description copied from interface: WatcherManager
Disable watching of a particular issue for the user supplied.

Specified by:
stopWatching in interface WatcherManager
Parameters:
user - user that stops watching the given issue
issue - issue being watched

stopWatching

public void stopWatching(ApplicationUser user,
                         Collection<Issue> issues)
Description copied from interface: WatcherManager
Disable watching of a list of issues for the user supplied.

This bulk method is more performant than calling the single version multiple times, as it indexes the issues in bulk rather than one at a time.

Specified by:
stopWatching in interface WatcherManager
Parameters:
user - user that stops watching the given issues
issues - list of issues being watched

stopWatching

public void stopWatching(com.atlassian.crowd.embedded.api.User user,
                         org.ofbiz.core.entity.GenericValue issueGV)
Description copied from interface: WatcherManager
Disable watching of a particular issue for the user supplied.

Specified by:
stopWatching in interface WatcherManager
Parameters:
user - user that stops watching the given issue
issueGV - issue being watched

getCurrentWatcherUsernames

public List<String> getCurrentWatcherUsernames(Issue issue)
                                        throws DataAccessException
Description copied from interface: WatcherManager
Retrieve the list of usernames of users watching the given issue

Specified by:
getCurrentWatcherUsernames in interface WatcherManager
Parameters:
issue - issue being watched
Returns:
the list of usernames of users watching the given issue
Throws:
DataAccessException - if cannot retrieve watchers

isWatchingEnabled

public boolean isWatchingEnabled()
Specified by:
isWatchingEnabled in interface WatcherManager

isWatching

public boolean isWatching(com.atlassian.crowd.embedded.api.User user,
                          Issue issue)
Description copied from interface: WatcherManager
Determine whether the current user is already watching the issue or not

Specified by:
isWatching in interface WatcherManager
Parameters:
user - user
issue - issue being watched
Returns:
True if a user is watching the issue specified.

isWatching

public boolean isWatching(ApplicationUser user,
                          Issue issue)
Description copied from interface: WatcherManager
Determine whether the current user is already watching the issue or not

Specified by:
isWatching in interface WatcherManager
Parameters:
user - user
issue - issue being watched
Returns:
True if a user is watching the issue specified.

isWatching

public boolean isWatching(com.atlassian.crowd.embedded.api.User user,
                          org.ofbiz.core.entity.GenericValue issue)
Description copied from interface: WatcherManager
Determine whether the current user is already watching the issue or not

Specified by:
isWatching in interface WatcherManager
Parameters:
user - user
issue - issue being watched
Returns:
True if a user is watching the issue specified.

getCurrentWatchList

public Collection<com.atlassian.crowd.embedded.api.User> getCurrentWatchList(Issue issue,
                                                                             Locale userLocale)
Description copied from interface: WatcherManager
Retrieve collection of users that are currently watching this issue (including the current user)

Specified by:
getCurrentWatchList in interface WatcherManager
Parameters:
issue - issue being watched
userLocale - the locale of the user making this call, this is used for sorting the list values.
Returns:
A collection of Users

getWatchers

public List<ApplicationUser> getWatchers(Issue issue,
                                         Locale userLocale)
Description copied from interface: WatcherManager
Retrieve list of users that are currently watching this issue (including the current user).

Specified by:
getWatchers in interface WatcherManager
Parameters:
issue - issue being watched
userLocale - the locale of the user making this call, this is used for sorting the list values.
Returns:
list of users that are currently watching this issue (including the current user)

getWatcherCount

public int getWatcherCount(Issue issue)
Description copied from interface: WatcherManager
Returns the number of users watching this issue.

Specified by:
getWatcherCount in interface WatcherManager
Parameters:
issue - issue being watched
Returns:
the number of users watching this issue.

getWatcherUserKeys

public Collection<String> getWatcherUserKeys(Issue issue)
Description copied from interface: WatcherManager
Retrieve list of users that are currently watching this issue (including the current user).

Specified by:
getWatcherUserKeys in interface WatcherManager
Parameters:
issue - issue being watched
Returns:
list of users that are currently watching this issue (including the current user)

getCurrentWatcherUsernames

public List<String> getCurrentWatcherUsernames(org.ofbiz.core.entity.GenericValue issue)
                                        throws DataAccessException
Description copied from interface: WatcherManager
Retrieve the list of usernames of users watching the given issue

Specified by:
getCurrentWatcherUsernames in interface WatcherManager
Parameters:
issue - issue being watched
Returns:
the list of usernames of users watching the given issue
Throws:
DataAccessException - if cannot retrieve watchers

removeAllWatchesForUser

public void removeAllWatchesForUser(com.atlassian.crowd.embedded.api.User user)
Description copied from interface: WatcherManager
Remove all watches for a given user

Specified by:
removeAllWatchesForUser in interface WatcherManager
Parameters:
user - The user that has most probably been deleted

removeAllWatchesForUser

public void removeAllWatchesForUser(ApplicationUser user)
Description copied from interface: WatcherManager
Remove all watches for a given user

Specified by:
removeAllWatchesForUser in interface WatcherManager
Parameters:
user - The user that has most probably been deleted


Copyright © 2002-2013 Atlassian. All Rights Reserved.