Class MailNotificationProcessor

  • All Implemented Interfaces:
    DeploymentProcessor, InitializableByConfigBean, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware

    public class MailNotificationProcessor
    extends AbstractPostDeploymentProcessor
    Post processor that sends an email notification with the result of a deployment, whenever a deployment fails or files where processed. The output file is attached if it's available. A processor instance can be configured with the following YAML properties:
    • templateName: The name of the Freemarker template used for email creation.
    • from: The value of the From field in the emails.
    • to: The value of the To field in the emails.
    • subject: The value of the Subject field in the emails.
    • html: Whether the emails are HTML.
    • serverName: The hostname of the email server.
    • dateTimePattern: The date time pattern to use when specifying a date in the email.
    Author:
    avasquez
    • Constructor Detail

      • MailNotificationProcessor

        public MailNotificationProcessor()
    • Method Detail

      • setDefaultTemplateName

        public void setDefaultTemplateName​(String defaultTemplateName)
        Sets the default name of the Freemarker template used for email creation.
      • setDefaultFrom

        public void setDefaultFrom​(String defaultFrom)
        Sets the default value of the From field in the emails.
      • setDefaultSubject

        public void setDefaultSubject​(String defaultSubject)
        Sets the default value of the Subject field in the emails.
      • setDefaultHtml

        public void setDefaultHtml​(boolean defaultHtml)
        Sets whether the emails are HTML by default.
      • setDefaultStatusCondition

        public void setDefaultStatusCondition​(String defaultStatusCondition)
        Sets the default condition to send emails.
      • setDefaultDateTimePattern

        public void setDefaultDateTimePattern​(String defaultDateTimePattern)
        Sets the default date time pattern to use when specifying a date in the email.
      • setEmailFactory

        public void setEmailFactory​(org.craftercms.commons.mail.EmailFactory emailFactory)
        Sets the EmailFactory used to generate the emails.
      • setObjectMapper

        public void setObjectMapper​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
        Sets the ObjectMapper used to serialize the deployment result.
      • doInit

        public void doInit​(org.apache.commons.configuration2.Configuration config)
                    throws org.craftercms.commons.config.ConfigurationException,
                           DeployerException
        Description copied from class: AbstractDeploymentProcessor
        Allows extending classes perform any custom initialization
        Specified by:
        doInit in class AbstractDeploymentProcessor
        Parameters:
        config - the bean's configuration
        Throws:
        org.craftercms.commons.config.ConfigurationException - if there's configuration related exception
        DeployerException - if there's a general exception on init
      • hasExecutionsFailures

        protected boolean hasExecutionsFailures​(Deployment deployment)