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.
}
}
Well first thing I did was this way with println. But didn’t get any output, could be my plugin not working correct. Thank you for suggestion.
So if I run plugin via powershell with atlas-run and I have System.out.println(“bla”); it should give me output in console, if I understand you right ?
Yes if you create a Issue and put this SOP inside the if clause of EventType.ISSUE_CREATED_ID event, after creating the issue, you will have the value printed in console.
Else, if you put the SOP in the onIssueEvent Method then for all the 13 events call present in JIRA will print the value in console.