Listening to changes
In this section, you will learn how to listen for Elements Checklist panel update events.
- Check the Java setup if not already done.
- You may also want to browse the API Javadoc.
Available event
There is only one event available in the API for now.
This is the event definition :
public class PanelUpdatedEvent {
/** The issue on which the panel was updated. */
public Issue getIssue() {...}
/** The panel content after update. */
public Panel getNewPanel() {...}
/** The panel content before update. */
public Panel getOldPanel() {...}
/** The update time. */
public long getTimestamp() {...}
/** The updater. */
public ApplicationUser getUser() {...}
}
Listening to events
Listening to panel events works exactly the same as listener for standard Jira events :
@Named
public class MyListener implements InitializingBean, DisposableBean {
private final EventPublisher eventPublisher;
@Inject
public MyListener (@ComponentImport EventPublisher eventPublisher) {
this.eventPublisher = eventPublisher;
}
@EventListener
public void onPanelUpdatedEvent(PanelUpdatedEvent event) {
// do stuff here
}
@Override
public void afterPropertiesSet() throws Exception {
eventPublisher.register(this);
}
/**
* Called when the plugin is being disabled or removed.
*/
@Override
public void destroy() throws Exception {
eventPublisher.unregister(this);
}
}
When this service is instanciated, every update to a panel will call the onPanelUpdatedEvent method.
Performances
As there can be a lot of updates on a platform, make sure to only pick the events that you need (especially for synchronous processing)