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 vote
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 vote
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
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 yesterday in Off-topic

Get to know our Atlassian User Group Leaders from Bengaluru, India

Meet @Dinesh Dhinakaran, @Vishnu Vasudeva, @Rajeev Verma, and Jamshid Nalakath: Our extraordinary AUG leaders from Bengaluru, India. These four work together to strengthen the bonds of their local co...

136 views 0 4
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