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

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

292 views 5 0
Join discussion

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