Class TemplateEmailMessage
- java.lang.Object
-
- fr.ens.biologie.genomique.aozan.aozan3.TemplateEmailMessage
-
- Direct Known Subclasses:
DataProcessorTemplateEmailMessage
public class TemplateEmailMessage extends Object
This class allow to generate EmailMessage from templates.- Since:
- 3.1
- Author:
- Laurent Jourdren
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_MAIL_FOOTER
static String
DEFAULT_MAIL_HEADER
static String
DEFAULT_SUBJECT_PREFIX
-
Constructor Summary
Constructors Constructor Description TemplateEmailMessage()
Public constructor.TemplateEmailMessage(Configuration conf)
Public constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EmailMessage
errorMessage(Configuration conf, Throwable t)
EmailMessage
errorMessage(Throwable t)
Generate error EmailMessage object.void
setFooter(String footer)
Set the footer of the message.void
setHeader(String header)
Set the header of the message.void
setTemplate(String template)
Set the template of the message.void
setTemplateFromFile(Path templateFile)
Set the template from a resource file.void
setTemplateFromResource(String resource)
Set the template from a resource file.EmailMessage
toEmailMessage(long id, String subject, Map<String,String> variables)
Generate EmailMessage object.EmailMessage
toEmailMessage(String subject, Map<String,String> variables)
Generate EmailMessage object.
-
-
-
Field Detail
-
DEFAULT_SUBJECT_PREFIX
public static final String DEFAULT_SUBJECT_PREFIX
- See Also:
- Constant Field Values
-
DEFAULT_MAIL_HEADER
public static final String DEFAULT_MAIL_HEADER
- See Also:
- Constant Field Values
-
DEFAULT_MAIL_FOOTER
public static final String DEFAULT_MAIL_FOOTER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TemplateEmailMessage
public TemplateEmailMessage()
Public constructor.
-
TemplateEmailMessage
public TemplateEmailMessage(Configuration conf)
Public constructor.- Parameters:
conf
- configuration
-
-
Method Detail
-
setHeader
public void setHeader(String header)
Set the header of the message.- Parameters:
header
- the footer of the message
-
setFooter
public void setFooter(String footer)
Set the footer of the message.- Parameters:
footer
- the footer of the message
-
setTemplate
public void setTemplate(String template)
Set the template of the message.- Parameters:
template
- the template of the message
-
setTemplateFromResource
public void setTemplateFromResource(String resource) throws IOException
Set the template from a resource file.- Parameters:
resource
- path of the resource file- Throws:
IOException
- if an error occurs while reading the resource
-
setTemplateFromFile
public void setTemplateFromFile(Path templateFile) throws IOException
Set the template from a resource file.- Parameters:
templateFile
- path of the template file- Throws:
IOException
- if an error occurs while reading the tenplate file
-
toEmailMessage
public EmailMessage toEmailMessage(String subject, Map<String,String> variables) throws Aozan3Exception
Generate EmailMessage object.- Parameters:
subject
- subject of the messagevariables
- variables for the template- Throws:
Aozan3Exception
-
toEmailMessage
public EmailMessage toEmailMessage(long id, String subject, Map<String,String> variables) throws Aozan3Exception
Generate EmailMessage object.- Parameters:
id
- id of the emailsubject
- subject of the messagevariables
- variables for the template- Throws:
Aozan3Exception
-
errorMessage
public EmailMessage errorMessage(Throwable t)
Generate error EmailMessage object.- Parameters:
t
- exception
-
errorMessage
public static EmailMessage errorMessage(Configuration conf, Throwable t)
-
-