public final class TemplateEngine extends Object
This class uses specified template to construct E-Mail messages.
Constructor and Description |
---|
TemplateEngine(MailMessage templateMessage)
Initializes a new instance of the
TemplateEngine class. |
TemplateEngine(String fileName)
Initializes a new instance of the
TemplateEngine class. |
Modifier and Type | Method and Description |
---|---|
MailMessageCollection |
instantiate(DataRowCollection rows)
Instantiates the template with a DataRowCollection as datasource.
|
MailMessageCollection |
instantiate(DataRowCollection rows,
DataColumnMappingCollection mappings)
Instantiates the template with a DataRowCollection as datasource.
|
MailMessageCollection |
instantiate(DataTable table)
Instantiates the template with a DataTable as datasource.
|
MailMessageCollection |
instantiate(DataTable table,
DataColumnMappingCollection mappings)
Instantiates the template with a DataTable as datasource.
|
MailMessageCollection |
instantiate(IDataReader reader)
Instantiates the template with a IDataReader as datasource.
|
boolean |
isRoutineRegistered(String name)
Determines if a name of template routine is registered in the template engine.
|
MailMessage |
merge(DataRow row)
Merge a source DataRow with the template.
|
MailMessage |
merge(MailMessage source)
Merge a source MailMessage with the template
|
void |
registerRoutine(String name,
TemplateRoutine routine)
Registers the template routine to the temaplate engine.
|
void |
reset()
Resets this instance.
|
void |
unregisterRoutine(String name)
Unregister the template routine from the template engine by name.
|
public TemplateEngine(String fileName)
Initializes a new instance of the TemplateEngine
class.
fileName
- Name of the file.public TemplateEngine(MailMessage templateMessage)
Initializes a new instance of the TemplateEngine
class.
templateMessage
- The template message.public final void registerRoutine(String name, TemplateRoutine routine)
Registers the template routine to the temaplate engine.
name
- The name of the funciton.routine
- Delegate processing the datapublic final boolean isRoutineRegistered(String name)
Determines if a name of template routine is registered in the template engine.
name
- The name that is used to register the template routine.public final void unregisterRoutine(String name)
Unregister the template routine from the template engine by name.
name
- The name that is used to unregister the template routine.public final MailMessage merge(MailMessage source)
Merge a source MailMessage with the template
source
- The source MailMessagepublic final MailMessage merge(DataRow row)
Merge a source DataRow with the template.
row
- The source DataRow.public final void reset()
Resets this instance.
public final MailMessageCollection instantiate(DataTable table, DataColumnMappingCollection mappings)
Instantiates the template with a DataTable as datasource.
table
- The DataTable, which contains the source data to instantiate the template.mappings
- The IColumnMappingCollection, which represents the mapping between the source column in DataTable and target field in templatepublic final MailMessageCollection instantiate(DataTable table)
Instantiates the template with a DataTable as datasource.
table
- The DataTable, which contains the source data to instantiate the template.public final MailMessageCollection instantiate(DataRowCollection rows, DataColumnMappingCollection mappings)
Instantiates the template with a DataRowCollection as datasource.
rows
- The DataRowCollection, which contains the source data to instantiate the template.mappings
- The IColumnMappingCollection, which represents the mapping between the source column in data source and target field in templatepublic final MailMessageCollection instantiate(DataRowCollection rows)
Instantiates the template with a DataRowCollection as datasource.
rows
- The DataRowCollection, which contains the source data to instantiate the template.public final MailMessageCollection instantiate(IDataReader reader)
Instantiates the template with a IDataReader as datasource.
reader
- The IDataReader, which will provide the source data to instantiate the template.