Package org.alfresco.util
Class EmailHelper
- java.lang.Object
-
- org.alfresco.util.EmailHelper
-
public class EmailHelper extends Object
A helper class to provide email template related utility functions.- Since:
- 5.2.1
- Author:
- Jamal Kaabi-Mofrad
-
-
Constructor Summary
Constructors Constructor Description EmailHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetEmailTemplate(String clientName, String emailTemplatePath, String fallbackTemplatePath)Gets the email template path or the given fallback template path.NodeRefgetLocalizedEmailTemplateNodeRef(String emailTemplateXPath)Gets the localized email template nodeRef.LocalegetUserLocaleOrDefault(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)
-
-
-
Method Detail
-
setServiceRegistry
public void setServiceRegistry(ServiceRegistry serviceRegistry)
-
setPreferenceService
public void setPreferenceService(PreferenceService preferenceService)
-
setRepositoryHelper
public void setRepositoryHelper(Repository repositoryHelper)
-
setTemplateLoader
public void setTemplateLoader(freemarker.cache.TemplateLoader templateLoader)
-
setCompanyHomeChildName
public void setCompanyHomeChildName(String companyHomeChildName)
-
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
public NodeRef getLocalizedEmailTemplateNodeRef(String emailTemplateXPath)
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
-
-