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
Accepted answer

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
Posted Oct 16, 2018 in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

1,416 views 17 10
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