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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

685 views 6 13
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