com.atlassian.jira.event.listeners.mail
Class MailListener

java.lang.Object
  extended by com.atlassian.jira.event.issue.AbstractIssueEventListener
      extended by com.atlassian.jira.event.listeners.mail.MailListener
All Implemented Interfaces:
IssueEventListener, JiraListener, UserEventListener, EventListener
Direct Known Subclasses:
DebugMailListener, MockMailListener

public class MailListener
extends AbstractIssueEventListener
implements IssueEventListener, UserEventListener

A listener for emailing notifications.

At the moment when this listener is activated it will email the reporter, assignee and any watchers.

The content of the emails is governed by Velocity templates (in /templates) and the emails are sent out by the MailSender.

Parameters: email.from - who the emails should be sent from email.server - the SMTP server to send email through email.session - the JNDI location of a MailSession to use when sending email subject.prefix - (optional) any prefix for the subject, like "[FooBar]" -> Subject: [FooBar] BazBat

See Also:
DebugMailListener

Constructor Summary
MailListener(NotificationSchemeManager notificationSchemeManager, IssueMailQueueItemFactory issueMailQueueItemFactory, UserManager userManager, NotificationFilterManager notificationFilterManager)
           
 
Method Summary
protected  void addMailItems(List<SchemeEntity> schemeEntities, IssueEvent event)
          Add mail items to the mail queue for the event and the associated notification types as defined in the notification scheme.
 void customEvent(IssueEvent event)
          Implement this method to deal with any custom events within the system
 String[] getAcceptedParams()
          Returns the parameters used by this listener.
 String getDescription()
          Returns a textual description of the listener.
 void init(Map params)
          Initialises the listener with the given parameters.
 boolean isInternal()
          Indicates whether this listener is internal, meaning it cannot be removed by an administrator.
 void issueAssigned(IssueEvent event)
          Fired when an issue is assigned or unassigned.
 void issueClosed(IssueEvent event)
          Fired when an issue is closed.
 void issueCommentDeleted(IssueEvent event)
          The default behaviour for this method calls AbstractIssueEventListener.issueUpdated(IssueEvent event).
 void issueCommented(IssueEvent event)
          Fired when a user comments on an issue.
 void issueCommentEdited(IssueEvent event)
           
 void issueCreated(IssueEvent event)
          Fired when an issue is created.
 void issueDeleted(IssueEvent event)
          Fired when an issue is deleted.
 void issueGenericEvent(IssueEvent event)
          Fired for all other events, eg.
 void issueMoved(IssueEvent event)
          Fired when an issue is moved.
 void issueReopened(IssueEvent event)
          Fired when an issue is reopened.
 void issueResolved(IssueEvent event)
          Fired when an issue is resolved.
 void issueStarted(IssueEvent event)
          Fired when user starts work on an issue (start progress)
 void issueStopped(IssueEvent event)
          Fired when user stops work on an issue (stop progress)
 void issueUpdated(IssueEvent event)
          Fired when an issue is updated.
 void issueWorklogDeleted(IssueEvent event)
           
 void issueWorkLogged(IssueEvent event)
          Fired when work is logged against an issue.
 void issueWorklogUpdated(IssueEvent event)
           
 boolean isUnique()
          Mail Listeners are unique.
protected  void sendNotification(IssueEvent event)
          Retrieve the associated notification scheme and create the mail items for notification of the specified event.
protected  void sendUserMail(UserEvent event, String subject, String subjectKey, String template)
           
 void userCannotChangePassword(UserEvent event)
          Fired when a user tries to change their password, and the password cannot be updated
 void userCreated(UserEvent event)
          Fired when a user is created automatically
 void userForgotPassword(UserEvent event)
          Fired when a user indicates they have forgotten their password
 void userForgotUsername(UserEvent event)
          Fired when a user indicates they have forgotten their username
 void userSignup(UserEvent event)
          Fired when a user signs up manually
 
Methods inherited from class com.atlassian.jira.event.issue.AbstractIssueEventListener
getI18NBean, workflowEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.jira.event.issue.IssueEventListener
workflowEvent
 

Constructor Detail

MailListener

public MailListener(NotificationSchemeManager notificationSchemeManager,
                    IssueMailQueueItemFactory issueMailQueueItemFactory,
                    UserManager userManager,
                    NotificationFilterManager notificationFilterManager)
Method Detail

init

public void init(Map params)
Description copied from interface: JiraListener
Initialises the listener with the given parameters.

Specified by:
init in interface JiraListener
Overrides:
init in class AbstractIssueEventListener
Parameters:
params - the initialisation parameters given in the Listener Properties

getAcceptedParams

public String[] getAcceptedParams()
Description copied from interface: JiraListener
Returns the parameters used by this listener.

Specified by:
getAcceptedParams in interface JiraListener
Overrides:
getAcceptedParams in class AbstractIssueEventListener
Returns:
a non-null array (can be empty)

sendNotification

protected void sendNotification(IssueEvent event)
Retrieve the associated notification scheme and create the mail items for notification of the specified event.

Parameters:
event - the IssueEvent triggering the notification

addMailItems

protected void addMailItems(List<SchemeEntity> schemeEntities,
                            IssueEvent event)
                     throws org.ofbiz.core.entity.GenericEntityException
Add mail items to the mail queue for the event and the associated notification types as defined in the notification scheme.

Only the first email encountered for a user will be sent in the case where a user is included in multiple notification types.

Parameters:
schemeEntities - used to determine the recipients of the notification of the specified event
event - the cause of the notification
Throws:
org.ofbiz.core.entity.GenericEntityException - thrown if we can't retrieve the SchemeEntities or NotificationRecipients

issueCreated

public void issueCreated(IssueEvent event)
Description copied from interface: IssueEventListener
Fired when an issue is created.

Specified by:
issueCreated in interface IssueEventListener
Overrides:
issueCreated in class AbstractIssueEventListener

issueAssigned

public void issueAssigned(IssueEvent event)
Description copied from interface: IssueEventListener
Fired when an issue is assigned or unassigned.

Check the issue assignee to work out which is the case.

Specified by:
issueAssigned in interface IssueEventListener
Overrides:
issueAssigned in class AbstractIssueEventListener

issueClosed

public void issueClosed(IssueEvent event)
Description copied from interface: IssueEventListener
Fired when an issue is closed.

The closure comment (if there is one) will be attached to the event as an action.

Specified by:
issueClosed in interface IssueEventListener
Overrides:
issueClosed in class AbstractIssueEventListener

issueResolved

public void issueResolved(IssueEvent event)
Description copied from interface: IssueEventListener
Fired when an issue is resolved.

The resolution comment (if there is one) will be attached to the event as an action.

Specified by:
issueResolved in interface IssueEventListener
Overrides:
issueResolved in class AbstractIssueEventListener

issueReopened

public void issueReopened(IssueEvent event)
Description copied from interface: IssueEventListener
Fired when an issue is reopened.

Specified by:
issueReopened in interface IssueEventListener
Overrides:
issueReopened in class AbstractIssueEventListener

issueUpdated

public void issueUpdated(IssueEvent event)
Description copied from interface: IssueEventListener
Fired when an issue is updated.

The update changelog will be attached to the event as an action.

Specified by:
issueUpdated in interface IssueEventListener
Overrides:
issueUpdated in class AbstractIssueEventListener

issueCommented

public void issueCommented(IssueEvent event)
Description copied from interface: IssueEventListener
Fired when a user comments on an issue.

The comment will be attached to the event as an action.

Specified by:
issueCommented in interface IssueEventListener
Overrides:
issueCommented in class AbstractIssueEventListener

issueCommentEdited

public void issueCommentEdited(IssueEvent event)
Overrides:
issueCommentEdited in class AbstractIssueEventListener

issueCommentDeleted

public void issueCommentDeleted(IssueEvent event)
Description copied from class: AbstractIssueEventListener
The default behaviour for this method calls AbstractIssueEventListener.issueUpdated(IssueEvent event). This preserves the behaviour of JIRA prior to v5.2

Overrides:
issueCommentDeleted in class AbstractIssueEventListener

issueWorkLogged

public void issueWorkLogged(IssueEvent event)
Description copied from interface: IssueEventListener
Fired when work is logged against an issue.

The work log will be attached to the event as an action.

Specified by:
issueWorkLogged in interface IssueEventListener
Overrides:
issueWorkLogged in class AbstractIssueEventListener

issueWorklogUpdated

public void issueWorklogUpdated(IssueEvent event)
Overrides:
issueWorklogUpdated in class AbstractIssueEventListener

issueWorklogDeleted

public void issueWorklogDeleted(IssueEvent event)
Overrides:
issueWorklogDeleted in class AbstractIssueEventListener

issueDeleted

public void issueDeleted(IssueEvent event)
Description copied from interface: IssueEventListener
Fired when an issue is deleted.

Specified by:
issueDeleted in interface IssueEventListener
Overrides:
issueDeleted in class AbstractIssueEventListener

issueMoved

public void issueMoved(IssueEvent event)
Description copied from interface: IssueEventListener
Fired when an issue is moved.

Specified by:
issueMoved in interface IssueEventListener
Overrides:
issueMoved in class AbstractIssueEventListener

issueStarted

public void issueStarted(IssueEvent event)
Description copied from interface: IssueEventListener
Fired when user starts work on an issue (start progress)

Specified by:
issueStarted in interface IssueEventListener
Overrides:
issueStarted in class AbstractIssueEventListener

issueStopped

public void issueStopped(IssueEvent event)
Description copied from interface: IssueEventListener
Fired when user stops work on an issue (stop progress)

Specified by:
issueStopped in interface IssueEventListener
Overrides:
issueStopped in class AbstractIssueEventListener

issueGenericEvent

public void issueGenericEvent(IssueEvent event)
Description copied from interface: IssueEventListener
Fired for all other events, eg. those fired from new workflow transitions.

Specified by:
issueGenericEvent in interface IssueEventListener
Overrides:
issueGenericEvent in class AbstractIssueEventListener

customEvent

public void customEvent(IssueEvent event)
Description copied from class: AbstractIssueEventListener
Implement this method to deal with any custom events within the system

Specified by:
customEvent in interface IssueEventListener
Overrides:
customEvent in class AbstractIssueEventListener
Parameters:
event - IssueEvent

sendUserMail

protected void sendUserMail(UserEvent event,
                            String subject,
                            String subjectKey,
                            String template)

userSignup

public void userSignup(UserEvent event)
Description copied from interface: UserEventListener
Fired when a user signs up manually

Specified by:
userSignup in interface UserEventListener
Parameters:
event - the event in play

userCreated

public void userCreated(UserEvent event)
Description copied from interface: UserEventListener
Fired when a user is created automatically

Specified by:
userCreated in interface UserEventListener
Parameters:
event - the event in play

userForgotPassword

public void userForgotPassword(UserEvent event)
Description copied from interface: UserEventListener
Fired when a user indicates they have forgotten their password

Specified by:
userForgotPassword in interface UserEventListener
Parameters:
event - the event in play

userForgotUsername

public void userForgotUsername(UserEvent event)
Description copied from interface: UserEventListener
Fired when a user indicates they have forgotten their username

Specified by:
userForgotUsername in interface UserEventListener
Parameters:
event - the event in play

userCannotChangePassword

public void userCannotChangePassword(UserEvent event)
Description copied from interface: UserEventListener
Fired when a user tries to change their password, and the password cannot be updated

Specified by:
userCannotChangePassword in interface UserEventListener
Parameters:
event - the event in play

isInternal

public boolean isInternal()
Description copied from interface: JiraListener
Indicates whether this listener is internal, meaning it cannot be removed by an administrator.

Specified by:
isInternal in interface JiraListener
Overrides:
isInternal in class AbstractIssueEventListener
Returns:
true if this is an Atlassian listener, otherwise false

isUnique

public boolean isUnique()
Mail Listeners are unique. It would be a rare case when you would want two emails sent out.

Specified by:
isUnique in interface JiraListener
Overrides:
isUnique in class AbstractIssueEventListener
Returns:
whether this listener should be a singleton

getDescription

public String getDescription()
Description copied from interface: JiraListener
Returns a textual description of the listener. You can include HTML if required, but do not use tables or DHTML, as the description may be displayed inside tables or frames.

A good description will describe what this listener does and explain the parameters required for configuring it.

Specified by:
getDescription in interface JiraListener
Overrides:
getDescription in class AbstractIssueEventListener
Returns:
a description of the listener, or null if no description is appropriate


Copyright © 2002-2014 Atlassian. All Rights Reserved.