Class EmailControllerImpl
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.service.impl.EmailControllerImpl
-
- All Implemented Interfaces:
EmailController
- Direct Known Subclasses:
TestEmailController
@Component @Profile({"prod","dev","web","analysis","ncbi","processing","sync"}) public class EmailControllerImpl extends java.lang.Object implements EmailController
This class is responsible for all email sent to the server that are templated with Thymeleaf.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Map<java.lang.Class<? extends ProjectEvent>,java.lang.String>
FRAGMENT_NAMES
static java.lang.String
PIPELINE_STATUS_TEMPLATE
static java.lang.String
RESET_TEMPLATE
static java.lang.String
SUBSCRIPTION_TEMPLATE
static java.lang.String
SYNC_EXPIRED_TEMPLATE
static java.lang.String
WELCOME_TEMPLATE
-
Constructor Summary
Constructors Constructor Description EmailControllerImpl(WebEmailConfig.ConfigurableJavaMailSender javaMailSender, org.thymeleaf.TemplateEngine templateEngine, org.springframework.context.MessageSource messageSource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Boolean
isMailConfigured()
Is the mail server configured?void
sendFilesystemExceptionEmail(java.lang.String adminEmailAddress, java.lang.Exception rootCause)
Send an e-mail to the administrative user with an exception when there's a serious storage related exception.void
sendNCBIUploadExceptionEmail(java.lang.String adminEmailAddress, java.lang.Exception rootCause, java.lang.Long submissionId)
Send an email to the administrators with an exception when there's an error uploading data or getting upload status from NCBI's SRA.void
sendPasswordResetLinkEmail(User user, PasswordReset passwordReset)
Send aPasswordReset
link to aUser
void
sendPipelineStatusEmail(AnalysisSubmission submission)
Send pipeline status email to a user when a pipeline that they have launched is completed or has an errorvoid
sendProjectSyncUnauthorizedEmail(Project project)
Email user responsible for a synchronized project when the sync job's credentials expirevoid
sendSubscriptionUpdateEmail(User user, java.util.List<ProjectEvent> events)
Send a subscription email to the givenUser
containing the givenProjectEvent
svoid
sendWelcomeEmail(User user, User sender, PasswordReset passwordReset)
Send welcome email to a user who joined the platform
-
-
-
Field Detail
-
WELCOME_TEMPLATE
public static final java.lang.String WELCOME_TEMPLATE
- See Also:
- Constant Field Values
-
RESET_TEMPLATE
public static final java.lang.String RESET_TEMPLATE
- See Also:
- Constant Field Values
-
SUBSCRIPTION_TEMPLATE
public static final java.lang.String SUBSCRIPTION_TEMPLATE
- See Also:
- Constant Field Values
-
PIPELINE_STATUS_TEMPLATE
public static final java.lang.String PIPELINE_STATUS_TEMPLATE
- See Also:
- Constant Field Values
-
SYNC_EXPIRED_TEMPLATE
public static final java.lang.String SYNC_EXPIRED_TEMPLATE
- See Also:
- Constant Field Values
-
FRAGMENT_NAMES
public static final java.util.Map<java.lang.Class<? extends ProjectEvent>,java.lang.String> FRAGMENT_NAMES
-
-
Constructor Detail
-
EmailControllerImpl
@Autowired public EmailControllerImpl(WebEmailConfig.ConfigurableJavaMailSender javaMailSender, @Qualifier("emailTemplateEngine") org.thymeleaf.TemplateEngine templateEngine, org.springframework.context.MessageSource messageSource)
-
-
Method Detail
-
sendWelcomeEmail
public void sendWelcomeEmail(User user, User sender, PasswordReset passwordReset) throws org.springframework.mail.MailSendException
Send welcome email to a user who joined the platform- Specified by:
sendWelcomeEmail
in interfaceEmailController
- Parameters:
user
- TheUser
that was just createdsender
- TheUser
that created the new userpasswordReset
- APasswordReset
object to send an activation link- Throws:
org.springframework.mail.MailSendException
- if the email failed to send
-
sendPasswordResetLinkEmail
public void sendPasswordResetLinkEmail(User user, PasswordReset passwordReset) throws org.springframework.mail.MailSendException
Send aPasswordReset
link to aUser
- Specified by:
sendPasswordResetLinkEmail
in interfaceEmailController
- Parameters:
user
- The user for the resetpasswordReset
- the reset object- Throws:
org.springframework.mail.MailSendException
- if the email failed to send
-
sendSubscriptionUpdateEmail
public void sendSubscriptionUpdateEmail(User user, java.util.List<ProjectEvent> events)
Send a subscription email to the givenUser
containing the givenProjectEvent
s- Specified by:
sendSubscriptionUpdateEmail
in interfaceEmailController
- Parameters:
user
- The user to emailevents
- the events to send to the user
-
isMailConfigured
public java.lang.Boolean isMailConfigured()
Is the mail server configured?- Specified by:
isMailConfigured
in interfaceEmailController
- Returns:
Boolean.TRUE
if configured,Boolean.FALSE
if not.
-
sendFilesystemExceptionEmail
public void sendFilesystemExceptionEmail(java.lang.String adminEmailAddress, java.lang.Exception rootCause) throws org.springframework.mail.MailSendException
Send an e-mail to the administrative user with an exception when there's a serious storage related exception.- Specified by:
sendFilesystemExceptionEmail
in interfaceEmailController
- Parameters:
adminEmailAddress
- the address to which notifications should be sent.rootCause
- the exception to send to the user.- Throws:
org.springframework.mail.MailSendException
- if the email failed to send
-
sendNCBIUploadExceptionEmail
public void sendNCBIUploadExceptionEmail(java.lang.String adminEmailAddress, java.lang.Exception rootCause, java.lang.Long submissionId) throws org.springframework.mail.MailSendException
Send an email to the administrators with an exception when there's an error uploading data or getting upload status from NCBI's SRA.- Specified by:
sendNCBIUploadExceptionEmail
in interfaceEmailController
- Parameters:
adminEmailAddress
- Address of the admin to email torootCause
- exception to display in the emailsubmissionId
- the ID of the NCBI export submission that failed- Throws:
org.springframework.mail.MailSendException
- If there's an error sending the message
-
sendPipelineStatusEmail
public void sendPipelineStatusEmail(AnalysisSubmission submission) throws org.springframework.mail.MailSendException
Send pipeline status email to a user when a pipeline that they have launched is completed or has an error- Specified by:
sendPipelineStatusEmail
in interfaceEmailController
- Parameters:
submission
- TheAnalysisSubmission
that the pipeline status email will be sent for- Throws:
org.springframework.mail.MailSendException
- if the email failed to send
-
sendProjectSyncUnauthorizedEmail
public void sendProjectSyncUnauthorizedEmail(Project project)
Email user responsible for a synchronized project when the sync job's credentials expire- Specified by:
sendProjectSyncUnauthorizedEmail
in interfaceEmailController
- Parameters:
project
- The project that sync failed for
-
-