Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

  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.

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.

Which app are you talking about?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Admins, notify your Jira instance of system-wide changes with the new admin announcement banner

Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across their  Jira Cloud instance.  ...

449 views 14 15
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you