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 EmailControllerThis 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_NAMESstatic java.lang.StringPIPELINE_STATUS_TEMPLATEstatic java.lang.StringRESET_TEMPLATEstatic java.lang.StringSUBSCRIPTION_TEMPLATEstatic java.lang.StringSYNC_EXPIRED_TEMPLATEstatic java.lang.StringWELCOME_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.BooleanisMailConfigured()Is the mail server configured?voidsendFilesystemExceptionEmail(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.voidsendNCBIUploadExceptionEmail(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.voidsendPasswordResetLinkEmail(User user, PasswordReset passwordReset)Send aPasswordResetlink to aUservoidsendPipelineStatusEmail(AnalysisSubmission submission)Send pipeline status email to a user when a pipeline that they have launched is completed or has an errorvoidsendProjectSyncUnauthorizedEmail(Project project)Email user responsible for a synchronized project when the sync job's credentials expirevoidsendSubscriptionUpdateEmail(User user, java.util.List<ProjectEvent> events)Send a subscription email to the givenUsercontaining the givenProjectEventsvoidsendWelcomeEmail(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:
sendWelcomeEmailin interfaceEmailController- Parameters:
user- TheUserthat was just createdsender- TheUserthat created the new userpasswordReset- APasswordResetobject 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 aPasswordResetlink to aUser- Specified by:
sendPasswordResetLinkEmailin 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 givenUsercontaining the givenProjectEvents- Specified by:
sendSubscriptionUpdateEmailin 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:
isMailConfiguredin interfaceEmailController- Returns:
Boolean.TRUEif configured,Boolean.FALSEif not.
-
sendFilesystemExceptionEmail
public void sendFilesystemExceptionEmail(java.lang.String adminEmailAddress, java.lang.Exception rootCause) throws org.springframework.mail.MailSendExceptionSend an e-mail to the administrative user with an exception when there's a serious storage related exception.- Specified by:
sendFilesystemExceptionEmailin 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.MailSendExceptionSend 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:
sendNCBIUploadExceptionEmailin 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:
sendPipelineStatusEmailin interfaceEmailController- Parameters:
submission- TheAnalysisSubmissionthat 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:
sendProjectSyncUnauthorizedEmailin interfaceEmailController- Parameters:
project- The project that sync failed for
-
-