Package org.alfresco.util
Class EmailHelper
java.lang.Object
org.alfresco.util.EmailHelper
A helper class to provide email template related utility functions.
- Since:
- 5.2.1
- Author:
- Jamal Kaabi-Mofrad
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetEmailTemplate(String clientName, String emailTemplatePath, String fallbackTemplatePath) Gets the email template path or the given fallback template path.getLocalizedEmailTemplateNodeRef(String emailTemplateXPath) Gets the localized email template nodeRef.getUserLocaleOrDefault(String userId) Gets the user's locale.voidinit()voidsetCompanyHomeChildName(String companyHomeChildName) voidsetPreferenceService(PreferenceService preferenceService) voidsetRepositoryHelper(Repository repositoryHelper) voidsetServiceRegistry(ServiceRegistry serviceRegistry) voidsetTemplateLoader(freemarker.cache.TemplateLoader templateLoader)
-
Constructor Details
-
EmailHelper
public EmailHelper()
-
-
Method Details
-
setServiceRegistry
-
setPreferenceService
-
setRepositoryHelper
-
setTemplateLoader
public void setTemplateLoader(freemarker.cache.TemplateLoader templateLoader) -
setCompanyHomeChildName
-
init
public void init() -
getEmailTemplate
public String getEmailTemplate(String clientName, String emailTemplatePath, String fallbackTemplatePath) Gets the email template path or the given fallback template path.- Parameters:
clientName- optional client app name (used only for logging)emailTemplatePath- the email template xpath or class pathfallbackTemplatePath- the fallback template- Returns:
- If
emailTemplatePathis empty the fallback template is returned. - if the given
emailTemplatePathis an xpath (i.e. starts with app:company_home), then an xpath search will be performed to find theNodeRef. If no nodeRef is found, the fallback template is returned. - If
emailTemplatePathis a nodeRef and the node does not exist, the fallback template is returned, otherwise a string representation of the NodeRef is returned. - if
emailTemplatePathis a class path which results in a template being found, then theemailTemplatePathis returned; otherwise, the fallback template is returned.
- If
-
getLocalizedEmailTemplateNodeRef
Gets the localized email template nodeRef.- Parameters:
emailTemplateXPath- the xpath of the template- Returns:
NodeRefof the localized template or null if no node is found
-
getUserLocaleOrDefault
Gets the user's locale.- Parameters:
userId- the user id- Returns:
- the default locale or the user's preferred locale, if available
-