Hi,
when i implement my class from IssueEventListener and impement its methods not happening on issue events. how i can listen to issue events in my class ?
dose my class called even if issue events occures in another page?in the other hand how i can use issue listener to run my class on issue events?
thanks a lot
tis is my simple class code:
package com.atlassian.jira.event.listeners;
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.event.JiraEvent;
import com.atlassian.jira.event.issue.AbstractIssueEventListener;
import com.atlassian.jira.event.issue.IssueEvent;
import com.atlassian.jira.event.issue.IssueEventListener;
import com.atlassian.jira.event.user.UserEvent;
import com.atlassian.jira.event.user.UserEventListener;
import org.ofbiz.core.entity.GenericEntityException;
import org.ofbiz.core.entity.GenericValue;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class my class extends IssueActionSupport implements IssueEventListener
{
...
public void customEvent(IssueEvent arg0) {
// TODO Auto-generated method stub
}
public void issueAssigned(IssueEvent arg0) {
// TODO Auto-generated method stub
}
public void issueClosed(IssueEvent arg0) {
// TODO Auto-generated method stub
}
public void issueCommented(IssueEvent arg0) {
// TODO Auto-generated method stub
System.out.println(arg0.getIssue().getKey() +"comment");
}
public void issueCreated(IssueEvent arg0) {
// TODO Auto-generated method stub
}
public void issueDeleted(IssueEvent arg0) {
// TODO Auto-generated method stub
}
public void issueGenericEvent(IssueEvent arg0) {
// TODO Auto-generated method stub
}
public void issueMoved(IssueEvent arg0) {
// TODO Auto-generated method stub
}
public void issueReopened(IssueEvent arg0) {
// TODO Auto-generated method stub
System.out.println(arg0.getIssue().getKey() +"reopen");
}
public void issueResolved(IssueEvent arg0) {
// TODO Auto-generated method stub
}
public void issueStarted(IssueEvent arg0) {
// TODO Auto-generated method stub
}
public void issueStopped(IssueEvent arg0) {
// TODO Auto-generated method stub
}
public void issueUpdated(IssueEvent arg0) {
// TODO Auto-generated method stub
System.out.println(arg0.getChangeLog().modified +"updated");
}
public void issueWorkLogged(IssueEvent arg0) {
// TODO Auto-generated method stub
}
public void workflowEvent(IssueEvent arg0) {
// TODO Auto-generated method stub
}
...
}
Hi Mehran,
Go to JIRA Administration >> Listeners >> Add fully qualified name of your listener class
OR
in below code you did not required to add listener class explicitly.
public class MyEventListenerClass implements InitializingBean,DisposableBean { public MyEventListenerClass() { } public void afterPropertiesSet() throws Exception { eventPublisher.register(this); } public void destroy() throws Exception { eventPublisher.unregister(this); } @EventListener public void onIssueEvent(IssueEvent issueEvent) throws Exception { Long eventTypeId = issueEvent.getEventTypeId(); log.debug("On Issue Event against issue "+issueEvent.getIssue().getKey()); if(eventTypeId.equals(EventType.ISSUE_CREATED_ID)) { // do stuff on issue created event } } }
atlassian-plugin.xml
<component-import key="eventPublisher" interface="com.atlassian.event.api.EventPublisher"/> <component key="eventListener" class="com.ora.sm.MyEventListener"> <description>Class that processes the incoming JIRA issue events.</description> </component>
Regards
Onkar Ahire
thanks onkar , it works when i added my listener :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The basics of writing a listener, explaining how you get the information about the change that fired the event (including issue) is all at https://developer.atlassian.com/display/JIRADEV/Writing+JIRA+Event+Listeners+with+the+atlassian-event+Library
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This was the JIRA4.x way of doing things, see the tutorial Nic linked (and /or clarify your JIRA version)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.