Class IssueEvent

java.lang.Object
com.atlassian.jira.event.AbstractEvent
com.atlassian.jira.event.issue.IssueEvent
All Implemented Interfaces:
IssueRelatedEvent, JiraEvent, SpanningOperationEvent

@PublicApi public final class IssueEvent extends AbstractEvent implements IssueRelatedEvent
Basic representation of something that happens to an Issue, such as a modification or comment. Event listeners register to receive these.

The IssueEvent object thrown as a result of an edit operation, may now return null from a getChangeLog() call. This can occur when a user chooses to edit an issue but only leaves a comment and makes no other changes to the issue.

Prior to 3.5.2 no event was fired in this case and this was identified as a bug (JRA-9415) and has since been fixed. Check any calls to getChangeLog() for null.

  • Field Details

    • SEND_MAIL

      public static final String SEND_MAIL
      See Also:
    • BASE_URL_PARAM_NAME

      public static final String BASE_URL_PARAM_NAME
      Key of event parameter holding the application's base URL.
    • CUSTOM_FIELDS_PARAM_NAME

      public static final String CUSTOM_FIELDS_PARAM_NAME

      In case of issue delete events, a param with this key may store the custom field values of the deleted issue.

      NOTE: this parameter is not guaranteed to exist so explicit check in the event parameters map must be performed by the clients. If not found, the custom field values may be retrieved by means of field manager from the issue object associated with the event.

    • WATCHERS_PARAM_NAME

      public static final String WATCHERS_PARAM_NAME

      In case of issue delete events, a param with this key may store list of this issue's watchers as a list of User objects.

      NOTE: this parameter is not guaranteed to exist so explicit check in the event parameters map must be performed by the clients. If not found, the value may be retrieved via IssueManager.getWatchers(com.atlassian.jira.issue.Issue).

    • CHANGE_HISTORY_PARAM_NAME

      public static final String CHANGE_HISTORY_PARAM_NAME
      In case of issue delete events, a param with this key will store list of this issue's change history as a list of ChangeHistoryItem objects.
    • COMMENTS_PARAM_NAME

      public static final String COMMENTS_PARAM_NAME
      In case of issue delete events, a param with this key will store list of this issue's comments as a list of Comment objects.
  • Constructor Details

    • IssueEvent

      public IssueEvent(Issue issue, Map params, ApplicationUser user, Long eventTypeId)
      Create a new IssueEvent with a given list of parameters.
      Parameters:
      issue - the issue this event refers to
      params - parameters that can be retrieved by the Listener
      user - the user who has initiated this event
      eventTypeId - the type ID of this event
    • IssueEvent

      public IssueEvent(Issue issue, Map params, ApplicationUser user, Long eventTypeId, boolean sendMail)
      Allows configuration of whether the mail notification should be sent
      Parameters:
      issue - the issue this event refers to
      params - parameters that can be retrieved by the Listener
      user - the user who has initiated this event
      eventTypeId - the type ID of this event
      sendMail - configure whether mail notifications should be sent
    • IssueEvent

      public IssueEvent(Issue issue, ApplicationUser user, Comment comment, Worklog worklog, org.ofbiz.core.entity.GenericValue changeGroup, Map params, Long eventTypeId)
      Create a new IssueEvent with a given list of parameters.

      This event also has an attached changeGroup, comment and worklog (any of which may be null).

      Parameters:
      issue - The issue this event refers to
      user - the user who has initiated this event
      comment - A comment for this event
      worklog - A worklog for this event
      changeGroup - An attached changeGroup for this event
      params - Parameters that can be retrieved by the Listener
      eventTypeId - the type ID of this event
    • IssueEvent

      public IssueEvent(Issue issue, ApplicationUser user, Comment comment, Worklog worklog, org.ofbiz.core.entity.GenericValue changeGroup, Map params, Long eventTypeId, boolean sendMail)
      Create a new IssueEvent with a given list of parameters.

      This event also has an attached changeGroup, comment and worklog (any of which may be null).

      Parameters:
      issue - the issue this event refers to
      user - the user who has initiated this event
      comment - comment for this event
      worklog - A worklog for this event
      changeGroup - an attached changeGroup for this event
      params - parameters that can be retrieved by the Listener
      eventTypeId - the type ID of this event
      sendMail - configure whether mail notifications should be sent
    • IssueEvent

      public IssueEvent(Issue issue, ApplicationUser user, Comment comment, Worklog worklog, org.ofbiz.core.entity.GenericValue changeGroup, Map params, Long eventTypeId, boolean sendMail, boolean subtasksUpdated)
    • IssueEvent

      public IssueEvent(Issue issue, ApplicationUser user, Comment comment, Worklog worklog, org.ofbiz.core.entity.GenericValue changeGroup, Map params, Long eventTypeId, boolean sendMail, boolean subtasksUpdated, @Nullable SpanningOperation spanningOperation)
      Create a new IssueEvent with a given list of parameters.

      This event also has an attached changeGroup, comment and worklog (any of which may be null).

      Parameters:
      issue - the issue this event refers to
      user - the user who has initiated this event
      comment - comment for this event
      worklog - A worklog for this event
      changeGroup - an attached changeGroup for this event
      params - parameters that can be retrieved by the Listener
      eventTypeId - the type ID of this event
      sendMail - configure whether mail notifications should be sent
      subtasksUpdated -
      spanningOperation - operation that this event is part of
  • Method Details

    • getIssue

      public Issue getIssue()
      Specified by:
      getIssue in interface IssueRelatedEvent
    • getProject

      public Project getProject()
    • getUser

      public ApplicationUser getUser()
      Returns the user who initiated this event.
      Returns:
      the user who initiated this event.
    • getChangeLog

      public org.ofbiz.core.entity.GenericValue getChangeLog()
    • getComment

      public Comment getComment()
    • getWorklog

      public Worklog getWorklog()
    • setWorklog

      public void setWorklog(Worklog worklog)
    • getEventTypeId

      public Long getEventTypeId()
    • isSendMail

      public boolean isSendMail()
    • isSubtasksUpdated

      public boolean isSubtasksUpdated()
    • isRedundant

      @Internal public boolean isRedundant()
      If true, indicates that this issue event can be ignored by listeners, and that some other issue event representing the same thing has been published.
      Returns:
      a boolean indicating whether this event is redundant.
    • getSpanningOperation

      public Optional<SpanningOperation> getSpanningOperation()
      Description copied from interface: SpanningOperationEvent
      Gets spanning operation that this event is part of.
      Specified by:
      getSpanningOperation in interface SpanningOperationEvent
      Returns:
      spanning operation that this event is part of.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Note: this will not compare the time stamps of two events - only everything else.
      Overrides:
      equals in class AbstractEvent
    • accept

      public <T> T accept(IssueEventVisitor<T> visitor)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractEvent