What's up with VersionUnArchiveEvent and VersionUnReleaseEvent?

Hi,

I'm building a listener that reacts on version-events. For example when a version is releassed I'll go do something and if it is unreleased I'll go "undo" something.

But it seems I can't get hold of the UnReleasedEvent and the UnarchivedEvent?

At least scriptrunner is complaining about lines 3-4 and 7-8 in this:

1 if (event instanceof VersionArchiveEvent) {
2    def event = event as VersionArchiveEvent
3 } else if (event instanceof VersionUnArchiveEvent) { 
4    def event = event as VersionUnArchiveEvent
5 } else if (event instanceof VersionReleaseEvent) {
6    def event = event as VersionReleaseEvent
7 } else if (event instanceof VersionUnReleaseEvent) {
8    def event = event as VersionUnReleaseEvent
9 }

I do import:

import com.atlassian.jira.event.project.VersionReleaseEvent
import com.atlassian.jira.event.project.VersionUnreleaseEvent
import com.atlassian.jira.event.project.VersionArchiveEvent
import com.atlassian.jira.event.project.VersionUnarchiveEvent

What do I miss? Anyone?

1 answer

1 accepted

0 votes
Answer accepted

The casing in for example VersionUnArchiveEvent is wrong it should be VersionUnarchiveEvent. I've fixed your example below:

import com.atlassian.jira.event.project.VersionReleaseEvent
import com.atlassian.jira.event.project.VersionUnreleaseEvent
import com.atlassian.jira.event.project.VersionArchiveEvent
import com.atlassian.jira.event.project.VersionUnarchiveEvent

if (event instanceof VersionArchiveEvent) {
  def event = event as VersionArchiveEvent
} else if (event instanceof VersionUnarchiveEvent) { 
   def event = event as VersionUnarchiveEvent
} else if (event instanceof VersionReleaseEvent) {
    def event = event as VersionReleaseEvent
} else if (event instanceof VersionUnreleaseEvent) {
    def event = event as VersionUnreleaseEvent
}

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Jira

Updates to jira.atlassian.com give you visibility into what's coming in Jira Server and Data Center

Hello, Community! My name is Gosia and I'm a Product Manager on Jira Server and Data Center here at Atlassian. Since 2002 when we launched our public issue tracker, jira.atlass...

632 views 1 15
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you