How to get the array of issue watcher?

mostafa jamareh October 9, 2013

in my plugin i want to write a methode that enables me to return the array of issue watcher

i want to know if it is possible to get the array of watcher

if yes, i hope if somebody could help me with this

thanks in advance,

3 answers

1 accepted

2 votes
Answer accepted
RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 9, 2013
import com.atlassian.jira.issue.watchers.WatcherManager;

WatcherManager wm = ComponentAccessor.getWatcherManager();
List<String> watchers=wm.getCurrentWatcherUsernames(issue);

check this doc

https://docs.atlassian.com/jira/latest/com/atlassian/jira/issue/watchers/WatcherManager.html

mostafa jamareh October 11, 2013

excuse me rambanam but i want to have a coolection of users as this :

List<User> watchers;

2 votes
John Bishop
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 11, 2013

How about this:

import com.atlassian.jira.issue.watchers.WatcherManager;
import java.util.Locale;

WatcherManager wm = ComponentAccessor.getWatcherManager();
Collection&lt;User&gt; watchers = wm.getCurrentWatchList(issue, Locale.ENGLISH);

0 votes
mostafa jamareh October 11, 2013

excuse me rambanam but i want to have a coolection of users as this :

List<User> watchers;

Suggest an answer

Log in or Sign up to answer