Class FreemarkerMailGenerator
- java.lang.Object
-
- org.apache.archiva.redback.integration.mail.FreemarkerMailGenerator
-
- All Implemented Interfaces:
MailGenerator
@Service("mailGenerator#freemarker") public class FreemarkerMailGenerator extends Object implements MailGenerator
Mail generator that uses freemarker templates. This implementation sets the following model values that can be used in templates:- applicationUrl
- urlPath
- authKey
- accountId
- requestedOn
- expiresOn
null
. This implementation is location enabled. That means, it will try to find templates in the following order:- templateName_language_country.ftl
- templateName_language.ftl
- templateName.ftl
- Author:
- Martin Stockhammer
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_ENCODING
-
Constructor Summary
Constructors Constructor Description FreemarkerMailGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
generateMail(String templateName, Locale locale, AuthenticationKey authenticationKey, String baseUrl)
Generates a mail string from a template.String
generateMail(String templateName, Locale locale, AuthenticationKey authkey, String baseUrl, Map<String,Object> templateData)
Generates a mail string from a template.String
generateMail(String templateName, AuthenticationKey authenticationKey, String baseUrl)
Generates a mail string from a template.UserConfiguration
getConfig()
freemarker.template.Configuration
getFreemarkerConfiguration()
void
setConfig(UserConfiguration config)
void
setFreemarkerConfiguration(freemarker.template.Configuration freemarkerConfiguration)
-
-
-
Field Detail
-
DEFAULT_ENCODING
public static final String DEFAULT_ENCODING
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FreemarkerMailGenerator
public FreemarkerMailGenerator()
-
-
Method Detail
-
generateMail
public String generateMail(String templateName, Locale locale, AuthenticationKey authkey, String baseUrl, Map<String,Object> templateData)
Description copied from interface:MailGenerator
Generates a mail string from a template. The given locale is used for retrieving the template. How the template will be located depends on the underlying implementation. The templateData is used as model data that is interpolated from the template.- Specified by:
generateMail
in interfaceMailGenerator
- Parameters:
templateName
- the template name without extensionlocale
- the locale used to find the template fileauthkey
- the authentication keybaseUrl
- the base urltemplateData
- additional template data, may benull
- Returns:
- the string generated from the template
-
generateMail
public String generateMail(String templateName, AuthenticationKey authenticationKey, String baseUrl)
Description copied from interface:MailGenerator
Generates a mail string from a template. How the template will be located depends on the underlying implementation. It uses a default locale.- Specified by:
generateMail
in interfaceMailGenerator
- Parameters:
templateName
- the template name without extensionauthenticationKey
- the authentication key of the current userbaseUrl
- the base url- Returns:
- A string for the mail body generated from the template
-
generateMail
public String generateMail(String templateName, Locale locale, AuthenticationKey authenticationKey, String baseUrl)
Description copied from interface:MailGenerator
Generates a mail string from a template. The given locale is used for retrieving the template. How the template will be located depends on the underlying implementation.- Specified by:
generateMail
in interfaceMailGenerator
- Parameters:
templateName
- the template name without extensionlocale
- the locale used to find the template fileauthenticationKey
- the authentication key of the current userbaseUrl
- the base url- Returns:
- a string for the mail body generated from the template
-
getFreemarkerConfiguration
public freemarker.template.Configuration getFreemarkerConfiguration()
-
setFreemarkerConfiguration
public void setFreemarkerConfiguration(freemarker.template.Configuration freemarkerConfiguration)
-
getConfig
public UserConfiguration getConfig()
-
setConfig
public void setConfig(UserConfiguration config)
-
-