JDBC Configuration (Template)The JDBC Configuration plugin allows the Fax header and Footer details to be pulled from a database on a per email address basis.
This allows each person to have their own header, footer, company name and return fax number displayed on each fax they send.
The plugin calls a stored procedure (not supplied) which is passed a single parameter the senders 'from email address'.
The database must return the following fields:
- Company Name
- Return Fax Number
- Left Header
- Centre Header
- Right Header
- Left Footer
- Centre Footer
- Right Footer
- Header Font Name
- Header Font Size
- Header Font Style
- Header Margin
- Footer Font Name
- Footer Font Size
- Footer Font Style
- Footer Margin
If any of the returned fields are null then then default settings from NoojeeFax.xml are used.
The following example creates the necessary database object for My SQL.
create table Template
(
Id int auto_increment,
EmailAddress varchar(40),
CompanyName varchar(120),
ReturnFaxNumber varchar(25),
LeftHeader varchar(20),
CentreHeader varchar(20),
RightHeader varchar(20),
LeftFooter varchar(20),
CentreFooter varchar(20),
RightFooter varchar(20),
HeaderFontName varchar(20),
HeaderFontSize int,
HeaderFontStyle int,
HeaderMargin int,
FooterFontName varchar(20),
FooterFontSize int,
FooterFontStyle int,
FooterMargin int,
primary key (Id) auto_increment
);
create index TemplateEmailAddress on Template (EmailAddress);
delimeter %%
create procedure sp_GetTemplate (aEmailAddress varchar(25))
BEGIN
select * from Template where EmailAddress = aEmailAddress;
END%%
delimiter ;
Note that the stored procedure name is sp_GetTemplate by default but that can be reconfigured if need be.
The NoojeeFax configuration entry is as follows:
<Template>
<Name>au.com.noojee.noojeefax.template.JdbcTemplate</Name>
<Arguments>com.mysql.jdbc.Driver,jdbc:mysql://localhost/noojeefax,noojeefax,noojeefax,sp_GetTemplatetemp</Arguments>
</Template>
Note that the default configuration file ships with a DefaultTemplate as described in the Template section above. The DefaultTemplate has a Templates element in the configuration file which must be removed when configuring the JdbcTemplate.