Need help with Issue Event Listener

I am kinda new with Jira and plugin development. Right now I am trying to do Issue EventListener. Well with atlas-run gives me no-error and I can see my plugin is enabled. However no idea if its working or not ? How could I test this ? Also need help with writing some functionly on event ( Look at TODO ). Would appriciate some help. 

 

 

public class IssueEventListener extends AbstractIssueEventListener implements InitializingBean, DisposableBean {

    EventPublisher eventPublisher;

    @Inject
    public IssueEventListener (EventPublisher eventPublisher) {
        this.eventPublisher = eventPublisher;
    }


    @Override
    public void destroy() throws Exception {
        eventPublisher.unregister(this);
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        eventPublisher.register(this);
    }

    @EventListener
    public void onIssueEvent(IssueEvent issueEvent) {
        Long eventTypeId = issueEvent.getEventTypeId();
        Issue issue = issueEvent.getIssue();

        if(eventTypeId.equals(EventType.ISSUE_CREATED_ID)) {
            // TODO: 7. 04. 2017 IF Original Estimate (time tracking) is null set to 1d;
        }

        if (eventTypeId.equals(EventType.ISSUE_WORKLOG_UPDATED_ID)) {
            // TODO: 7. 04. 2017 get Time Spent number user entered and time when he did and save it.
        }
    }

}

 

2 answers

0 vote
Thomas Schlegel Community Champion Apr 07, 2017

Hi Marko,

there's another community for developer's issues:

https://community.developer.atlassian.com/

Maybe you get an answer there sooner

0 vote

The given code snipptet doesn't do anything. You can add some log messages in the if loop and then see if the messages are logged when an issue is created or not.

This is just a sample snippet to show how you catch the events in a listener.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

795 views 2 19
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