Document toolboxDocument toolbox

(8.16.X) Value updated event

This event will be launched when any Projectrak field value has been updated in any project.
The information provided by the events is:

  • User
  • Project
  • Field
  • Old value
  • New value  

In this particular event, you can listen to a general method for all kind of fields or to a particular method for every different field type (that way you will get the values with its particular type).

Default implementation for value update event
package com.deiser.jira.profields.event.listener;
import com.atlassian.crowd.embedded.api.Group;
import com.atlassian.event.api.EventPublisher;
import com.atlassian.jira.project.Project;
import com.atlassian.jira.user.ApplicationUser;
import com.deiser.jira.profields.api.event.model.ProfieldsEvent;
import com.deiser.jira.profields.api.event.listener.ProfieldsListener;
import com.deiser.jira.profields.api.field.Field;
import com.deiser.jira.profields.api.field.date.DateField;
import com.deiser.jira.profields.api.field.duration.DurationField;
import com.deiser.jira.profields.api.field.group.GroupField;
import com.deiser.jira.profields.api.field.groupmultiple.GroupMultipleField;
import com.deiser.jira.profields.api.field.item.list.ListItem;
import com.deiser.jira.profields.api.field.item.priority.PriorityItem;
import com.deiser.jira.profields.api.field.item.status.StatusItem;
import com.deiser.jira.profields.api.field.list.ListField;
import com.deiser.jira.profields.api.field.list.multiple.ListMultipleField;
import com.deiser.jira.profields.api.field.number.NumberField;
import com.deiser.jira.profields.api.field.priority.PriorityField;
import com.deiser.jira.profields.api.field.project.ProjectField;
import com.deiser.jira.profields.api.field.projectmultiple.ProjectMultipleField;
import com.deiser.jira.profields.api.field.status.StatusField;
import com.deiser.jira.profields.api.field.text.TextField;
import com.deiser.jira.profields.api.field.user.UserField;
import com.deiser.jira.profields.api.field.usermultiple.UserMultipleField;
import org.apache.log4j.Logger;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
public class DefaultProfieldsListener extends ProfieldsListener {
private static final Logger log = Logger.getLogger(DefaultProfieldsListener.class);
private EventPublisher eventPublisher;
public DefaultProfieldsListener(EventPublisher eventPublisher) {
this.eventPublisher = eventPublisher;
}
@Override
public void afterPropertiesSet() throws Exception {
eventPublisher.register(this);
}
@Override
public void destroy() throws Exception {
eventPublisher.unregister(this);
}
@Override
protected void onValueUpdated(ApplicationUser user, Project project, Field field, Object oldValue, Object newValue) {
log.debug("DefaultProfieldsListener - onValueUpdated");
}
@Override
protected void onTextValueUpdated(ApplicationUser user, Project project, TextField field, String oldValue, String newValue) {
log.debug("DefaultProfieldsListener - onTextValueUpdated");
}
@Override
protected void onNumberValueUpdated(ApplicationUser user, Project project, NumberField field, BigDecimal oldValue, BigDecimal newValue) {
log.debug("DefaultProfieldsListener - onNumberValueUpdated");
}
@Override
protected void onDateValueUpdated(ApplicationUser user, Project project, DateField field, Date oldValue, Date newValue) {
log.debug("DefaultProfieldsListener - onDateValueUpdated");
}
@Override
protected void onDurationValueUpdated(ApplicationUser user, Project project, DurationField field, Long oldValue, Long newValue) {
log.debug("DefaultProfieldsListener - onDurationValueUpdated");
}
@Override
protected void onUserValueUpdated(ApplicationUser user, Project project, UserField field, ApplicationUser oldValue, ApplicationUser newValue) {
log.debug("DefaultProfieldsListener - onUserValueUpdated");
}
@Override
protected void onUserMultiValueUpdated(ApplicationUser user, Project project, UserMultipleField field, List<ApplicationUser> oldValue, List<ApplicationUser> newValue) {
log.debug("DefaultProfieldsListener - onUserMultiValueUpdated");
}
@Override
protected void onGroupValueUpdated(ApplicationUser user, Project project, GroupField field, Group oldValue, Group newValue) {
log.debug("DefaultProfieldsListener - onGroupValueUpdated");
}
@Override
protected void onGroupMultiValueUpdated(ApplicationUser user, Project project, GroupMultipleField field, List<Group> oldValue, List<Group> newValue) {
log.debug("DefaultProfieldsListener - onGroupMultiValueUpdated");
}
@Override
protected void onProjectValueUpdated(ApplicationUser user, Project project, ProjectField field, Project oldValue, Project newValue) {
log.debug("DefaultProfieldsListener - onProjectValueUpdated");
}
@Override
protected void onProjectMultiValueUpdated(ApplicationUser user, Project project, ProjectMultipleField field, List<Project> oldValue, List<Project> newValue) {
log.debug("DefaultProfieldsListener - onProjectMultiValueUpdated");
}
@Override
protected void onStatusValueUpdated(ApplicationUser user, Project project, StatusField field, StatusItem oldValue, StatusItem newValue) {
log.debug("DefaultProfieldsListener - onStatusValueUpdated");
}
@Override
protected void onPriorityValueUpdated(ApplicationUser user, Project project, PriorityField field, PriorityItem oldValue, PriorityItem newValue) {
log.debug("DefaultProfieldsListener - onPriorityValueUpdated");
}
@Override
protected void onListValueUpdated(ApplicationUser user, Project project, ListField field, ListItem oldValue, ListItem newValue) {
log.debug("DefaultProfieldsListener - onListValueUpdated");
}
@Override
protected void onListMultiValueUpdated(ApplicationUser user, Project project, ListMultipleField field, List<ListItem> oldValue, List<ListItem> newValue) {
log.debug("DefaultProfieldsListener - onListMultiValueUpdated");
}
}