Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Loop Through Issue Watchers

jhreeves2001 May 10, 2012

Summary: Need to loop through an issue's watchers; performing action on each watcher.

Algorithm:

  • def wlist = getwatchernames(isssuekey)
  • if wlist isn't null then
    • wlist.each()
      • watchermanager.stopwatching(it,issue.genericvalue)

I've attempted to use...

def wlist = getWatcherNames(issue.key);
wlist.each() {
     watcherManager.stopWatching(it, issue.genericValue);
}

... but receive the following error message:

"javax.script.ScriptException: groovy.lang.MissingMethodException. No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getWatcherNames() is applicble for argument types: (java.lang.String.values [MAIN-1234])"

Thanks so much for your help.

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
JamieA
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.
May 10, 2012

What's getWatcherNames() - is that code defined elsewhere in your script?

I think you want something like:

def watcherManager = ComponentAccessor.getWatcherManager()
def userUtil = ComponentAccessor.getUserUtil()
watcherManager.getCurrentWatcherUsernames(issue).each {
    watcherManager.stopWatching(userUtil.getUser(it), issue.genericValue)
}

(untested).

jhreeves2001 May 10, 2012

Hey Jamie, I'm trying to accept your answer as GOOD / ACCEPTED ANSWER, but am having trouble accessing the page if I'm signed in. If I sign in and click on the link (for this question), I get a server 500 error. If I access the page and then sign in, I can post a comment, but am unable to accept your answer as good. I created a ticket at https://jira.atlassian.com/browse/ANSWERS-610

Once I get this straightened out, I promise to accept your answer.

Thanks Jamie

jhreeves2001 May 10, 2012

Hi Jamie --- thanks so much, yet again for your help (I'm incorporating your answer into other work you helped me through).

I'm jealous that you were able to watch so many games at Highbury. The "Invincibles" season must have been amazing. Henry ruled the world.

Sincerely, Tyler

JamieA
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.
May 10, 2012

No worries Tyler ;-)

JamieA
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.
May 10, 2012

Heh, don't worry, I think it's a known bug. But thanks for trying...

jhreeves2001 May 10, 2012

Yo Jamie ------ I just incorporated your code into my project and, as always, you're code worked perfectly.

Thanks again! Good luck against West Brom on Sunday. And it's going to be fun watching Shaun Wright-Phillips get event with his former club.

Jeremy Largman
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 15, 2012

This was indeed a known bug. Should be fixed now.

0 votes
parthiban subramaniam
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.
May 10, 2012

As if he needs more karma points..

Jamie, you should donate some to others ;)

Didnt know you were a Arsenal fan :)

I'm crossing everything that we finish 3rd in the league.

TAGS
AUG Leaders

Atlassian Community Events