Create a Event Listener for ReviewCompletionEvent

Hi,

I am very new to Java but have developed in other languages. I am trying to create a simple event listener that triggers a script upon a ReviewCompletionEvent. Went through as much of the docs as I can but I just need some help to get started. These are some of the KB I referenced:

Questions

  1. Where do I create the class file and the atlassian-plugin.xml?
  2. Does this code look remotely close to what I need?
private static final Class[] HANDLED_EVENTS = new Class[] {
    ReviewCompletionEvent.class
};

public Class[] getHandledEventClasses()
{
    return HANDLED_EVENTS;
}

public void handleEvent(Event event)
{
    if (event instanceof ReviewCompletionEvent)
     {
        /* INSERT Instructions to perform once the ReviewCompletionEvent is found */
    }
}

3 answers

0 votes
Timothy Chin Community Champion Feb 18, 2014

Which app are you talking about?

Oops! Crucible/FE. I assumed ReviewCompletionEvent would only be a FE/Crucible method.

After a code review is completed I would like to have a listener trigger a script. With this ability the script can give me great power and flexibility with my SDLC workflow. I would like to pass to this script a param or two as well.

0 votes
David Simpson Community Champion Feb 19, 2014
  1. Make sure you've got the Atlassian SDK installed
  2. Create a new plugin using the command atlas-create-fecru-plugin - this will build a skeleton plugin template
  3. Having created the plugin, you should now have an atlassian-plugin.xml file in the directory src/main/resources
  4. Create a new Java class at say src/main/java/com/yourcompany/fecru/plugin/listener/ReviewCompletionEvent.java
  5. Add the listener module in src/main/resources/atlassian-plugin.xml:
    <listener key="example-listener" class="com.yourcompany.fecru.listener.ReviewCompletionEvent"/>
  6. Type atlas-run in the root of your project and see whether it worked

Hopefully that will get you on your way.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published 9 hours ago in Jira Ops

Jira Ops Early Access Program Update #1: Announcing our next feature and a new integration

Thanks for signing up for Jira Ops! I’m Matt Ryall, leader for the Jira Ops product team at Atlassian. Since this is a brand new product, we’ll be delivering improvements quickly and sharing updates...

149 views 0 5
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