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 FreemarkerEngine
engine
protected static Properties
MAIL_PROPERTIES
Mail properties read from mail.properties.protected Mailer
mailer
protected ConcurrentMap<String,URL>
urls
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Mailer
createMailer()
FreemarkerEngine
getEngine()
Mailer
getMailer()
protected static Properties
getMailProperties()
protected static File
getMailPropertiesFile()
Mailer.Message
newHtmlMessage(String templateContent, Object ctx)
Mailer.Message
newHtmlMessage(URL template, Object ctx)
Mailer.Message
newMessage()
Mailer.Message
newMixedMessage(String templateContent, Object ctx, String textType, List<Blob> attachments)
Mailer.Message
newTextMessage(String templateContent, Object ctx)
Mailer.Message
newTextMessage(URL template, Object ctx)
void
registerTemplate(URL url)
String
render(String templateContent, Object ctx)
void
render(String template, Object ctx, Writer writer)
String
render(URL template, Object ctx)
void
render(URL template, Object ctx, Writer writer)
void
unregisterAllTemplates()
void
unregisterTemplate(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.TemplateException
IOException
-
newMessage
public Mailer.Message newMessage()
-
newTextMessage
public Mailer.Message newTextMessage(URL template, Object ctx) throws RenderingException, javax.mail.MessagingException
- Throws:
RenderingException
javax.mail.MessagingException
-
newTextMessage
public Mailer.Message newTextMessage(String templateContent, Object ctx) throws RenderingException, javax.mail.MessagingException, freemarker.template.TemplateException, IOException
- Throws:
RenderingException
javax.mail.MessagingException
freemarker.template.TemplateException
IOException
-
newHtmlMessage
public Mailer.Message newHtmlMessage(URL template, Object ctx) throws RenderingException, javax.mail.MessagingException
- Throws:
RenderingException
javax.mail.MessagingException
-
newHtmlMessage
public Mailer.Message newHtmlMessage(String templateContent, Object ctx) throws javax.mail.MessagingException, freemarker.template.TemplateException, IOException
- Throws:
javax.mail.MessagingException
freemarker.template.TemplateException
IOException
-
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.TemplateException
IOException
javax.mail.MessagingException
-
-