Package org.alfresco.util
Class EmailHelper
- java.lang.Object
-
- org.alfresco.util.EmailHelper
-
public class EmailHelper extends java.lang.ObjectA 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 java.lang.StringgetEmailTemplate(java.lang.String clientName, java.lang.String emailTemplatePath, java.lang.String fallbackTemplatePath)Gets the email template path or the given fallback template path.org.alfresco.service.cmr.repository.NodeRefgetLocalizedEmailTemplateNodeRef(java.lang.String emailTemplateXPath)Gets the localized email template nodeRef.java.util.LocalegetUserLocaleOrDefault(java.lang.String userId)Gets the user's locale.voidinit()voidsetCompanyHomeChildName(java.lang.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(java.lang.String companyHomeChildName)
-
init
public void init()
-
getEmailTemplate
public java.lang.String getEmailTemplate(java.lang.String clientName, java.lang.String emailTemplatePath, java.lang.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 org.alfresco.service.cmr.repository.NodeRef getLocalizedEmailTemplateNodeRef(java.lang.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
-
getUserLocaleOrDefault
public java.util.Locale getUserLocaleOrDefault(java.lang.String userId)
Gets the user's locale.- Parameters:
userId- the user id- Returns:
- the default locale or the user's preferred locale, if available
-
-