Class 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 Detail

      • WELCOME_TEMPLATE

        public static final java.lang.String WELCOME_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 interface EmailController
        Parameters:
        user - The User that was just created
        sender - The User that created the new user
        passwordReset - A PasswordReset 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 a PasswordReset link to a User
        Specified by:
        sendPasswordResetLinkEmail in interface EmailController
        Parameters:
        user - The user for the reset
        passwordReset - the reset object
        Throws:
        org.springframework.mail.MailSendException - if the email failed to send
      • isMailConfigured

        public java.lang.Boolean isMailConfigured()
        Is the mail server configured?
        Specified by:
        isMailConfigured in interface EmailController
        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 interface EmailController
        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 interface EmailController
        Parameters:
        adminEmailAddress - Address of the admin to email to
        rootCause - exception to display in the email
        submissionId - 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 interface EmailController
        Parameters:
        submission - The AnalysisSubmission 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 interface EmailController
        Parameters:
        project - The project that sync failed for