Class Composer
- java.lang.Object
-
- org.nuxeo.ecm.automation.core.mail.Composer
-
public class Composer extends Object
- Author:
- Bogdan Stefanescu
-
-
Field Summary
Fields Modifier and Type Field Description protected FreemarkerEngineengineprotected static PropertiesMAIL_PROPERTIESMail properties read from mail.properties.protected Mailermailerprotected ConcurrentMap<String,URL>urls
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MailercreateMailer()FreemarkerEnginegetEngine()MailergetMailer()protected static PropertiesgetMailProperties()protected static FilegetMailPropertiesFile()Mailer.MessagenewHtmlMessage(String templateContent, Object ctx)Mailer.MessagenewHtmlMessage(URL template, Object ctx)Mailer.MessagenewMessage()Mailer.MessagenewMixedMessage(String templateContent, Object ctx, String textType, List<Blob> attachments)Mailer.MessagenewTextMessage(String templateContent, Object ctx)Mailer.MessagenewTextMessage(URL template, Object ctx)voidregisterTemplate(URL url)Stringrender(String templateContent, Object ctx)voidrender(String template, Object ctx, Writer writer)Stringrender(URL template, Object ctx)voidrender(URL template, Object ctx, Writer writer)voidunregisterAllTemplates()voidunregisterTemplate(URL url)
-
-
-
Field Detail
-
MAIL_PROPERTIES
protected static final Properties MAIL_PROPERTIES
Mail properties read from mail.properties.
-
engine
protected final FreemarkerEngine engine
-
mailer
protected Mailer mailer
-
urls
protected final ConcurrentMap<String,URL> urls
-
-
Constructor Detail
-
Composer
public Composer()
-
Composer
public Composer(Mailer mailer)
-
-
Method Detail
-
createMailer
protected Mailer createMailer()
-
getMailProperties
@NotNull protected static Properties getMailProperties()
-
getMailPropertiesFile
protected static File getMailPropertiesFile()
-
registerTemplate
public void registerTemplate(URL url)
-
unregisterTemplate
public void unregisterTemplate(URL url)
-
unregisterAllTemplates
public void unregisterAllTemplates()
-
getMailer
public Mailer getMailer()
-
getEngine
public FreemarkerEngine getEngine()
-
render
public void render(String template, Object ctx, Writer writer) throws RenderingException
- Throws:
RenderingException
-
render
public void render(URL template, Object ctx, Writer writer) throws RenderingException
- Throws:
RenderingException
-
render
public String render(URL template, Object ctx) throws RenderingException
- Throws:
RenderingException
-
render
public String render(String templateContent, Object ctx) throws freemarker.template.TemplateException, IOException
- Throws:
freemarker.template.TemplateExceptionIOException
-
newMessage
public Mailer.Message newMessage()
-
newTextMessage
public Mailer.Message newTextMessage(URL template, Object ctx) throws RenderingException, javax.mail.MessagingException
- Throws:
RenderingExceptionjavax.mail.MessagingException
-
newTextMessage
public Mailer.Message newTextMessage(String templateContent, Object ctx) throws RenderingException, javax.mail.MessagingException, freemarker.template.TemplateException, IOException
- Throws:
RenderingExceptionjavax.mail.MessagingExceptionfreemarker.template.TemplateExceptionIOException
-
newHtmlMessage
public Mailer.Message newHtmlMessage(URL template, Object ctx) throws RenderingException, javax.mail.MessagingException
- Throws:
RenderingExceptionjavax.mail.MessagingException
-
newHtmlMessage
public Mailer.Message newHtmlMessage(String templateContent, Object ctx) throws javax.mail.MessagingException, freemarker.template.TemplateException, IOException
- Throws:
javax.mail.MessagingExceptionfreemarker.template.TemplateExceptionIOException
-
newMixedMessage
public Mailer.Message newMixedMessage(String templateContent, Object ctx, String textType, List<Blob> attachments) throws freemarker.template.TemplateException, IOException, javax.mail.MessagingException
- Throws:
freemarker.template.TemplateExceptionIOExceptionjavax.mail.MessagingException
-
-