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 Details

    • EmailHelper

      public EmailHelper()
  • Method Details

    • 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 path
      fallbackTemplatePath - the fallback template
      Returns:
      • If emailTemplatePath is empty the fallback template is returned.
      • if the given emailTemplatePath is an xpath (i.e. starts with app:company_home), then an xpath search will be performed to find the NodeRef. If no nodeRef is found, the fallback template is returned.
      • If emailTemplatePath is a nodeRef and the node does not exist, the fallback template is returned, otherwise a string representation of the NodeRef is returned.
      • if emailTemplatePath is a class path which results in a template being found, then the emailTemplatePath is returned; otherwise, the fallback template is returned.
    • getLocalizedEmailTemplateNodeRef

      public NodeRef getLocalizedEmailTemplateNodeRef(String emailTemplateXPath)
      Gets the localized email template nodeRef.
      Parameters:
      emailTemplateXPath - the xpath of the template
      Returns:
      NodeRef of the localized template or null if no node is found
    • getUserLocaleOrDefault

      public Locale getUserLocaleOrDefault(String userId)
      Gets the user's locale.
      Parameters:
      userId - the user id
      Returns:
      the default locale or the user's preferred locale, if available