Create a Event Listener for ReviewCompletionEvent

Brian Richardson February 18, 2014
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
David at David Simpson Apps
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
February 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.

0 votes
Brian Richardson February 19, 2014

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
Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 18, 2014

Which app are you talking about?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events