Interface TemplateHandler

All Known Implementing Classes:
BaseTemplateHandler

@ProviderType public interface TemplateHandler
Author:
Juan Fernández
  • Method Details

    • getClassName

      String getClassName()
      Returns the template handler's class name.
      Returns:
      the template handler's class name
    • getCustomContextObjects

      Map<String,Object> getCustomContextObjects()
      Returns the map of name/value pairs of the objects that should be injected into the context.
      Returns:
      the objects that should be injected into the context
    • getDefaultTemplateElements

      List<Element> getDefaultTemplateElements() throws Exception
      Returns the elements containing the information of the portlet display templates to be installed by default.
      Returns:
      the elements containing the information of the portlet display templates to be installed by default. These templates are installed when registering the portlet.
      Throws:
      Exception - if an exception occurred assembling the default template elements
    • getDefaultTemplateKey

      String getDefaultTemplateKey()
      Returns the key of the template handler's default template.
      Returns:
      the key of the template handler's default template
    • getName

      String getName(Locale locale)
      Returns the template handler's name.
      Parameters:
      locale - the locale of the template handler name to get
      Returns:
      the template handler's name
    • getResourceName

      String getResourceName()
      Returns the name of the resource associated with the template. Permissions on the resource are checked when adding a new template.
      Returns:
      the name of the resource associated with the template
    • getRestrictedVariables

      String[] getRestrictedVariables(String language)
      Returns the restricted variables that are excluded from the template's context.
      Parameters:
      language - the template's scripting language. Acceptable values for the FreeMarker or Velocity languages are TemplateConstants.LANG_TYPE_FTL, or TemplateConstants.LANG_TYPE_VM, respectively.
      Returns:
      the restricted variables that are excluded from the template's context
    • getTemplatesHelpContent

      String getTemplatesHelpContent(String language)
      Returns initial template content for helping the user create a new template.
      Parameters:
      language - the template's scripting language. Acceptable values for the FreeMarker or Velocity languages are TemplateConstants.LANG_TYPE_FTL, or TemplateConstants.LANG_TYPE_VM, respectively.
      Returns:
      initial template content for helping the user create a new template
    • getTemplatesHelpPath

      String getTemplatesHelpPath(String language)
      Returns the path to the template's help content.
      Parameters:
      language - the template's scripting language. Acceptable values for the FreeMarker or Velocity languages are TemplateConstants.LANG_TYPE_FTL, or TemplateConstants.LANG_TYPE_VM, respectively.
      Returns:
      the path to the template's help content
    • getTemplatesHelpPropertyKey

      String getTemplatesHelpPropertyKey()
      Returns the name of the property in portal.properties that defines the path to the template's help content.
      Returns:
      the name of the property in portal.properties that defines the path to the template's help content
    • getTemplateVariableGroups

      Map<String,TemplateVariableGroup> getTemplateVariableGroups(long classPK, String language, Locale locale) throws Exception
      Returns the template's map of script variable groups for which hints are displayed in the template editor palette.

      Script variables can be grouped arbitrarily. As examples, a group of entity fields could be mapped to the keyword Fields, or a group of general variables portal variables could be mapped to the phrase General Variables, etc.

      Parameters:
      classPK - the primary key of the entity that defines the variable groups for the template. For example, consider specifying the primary key of the structure associated to the template.
      language - the template's scripting language. Acceptable values for the FreeMarker or Velocity languages are TemplateConstants.LANG_TYPE_FTL, or TemplateConstants.LANG_TYPE_VM, respectively.
      locale - the locale of the variable groups to get
      Returns:
      the template's map of script variable groups for which hints are displayed in the template editor palette
      Throws:
      Exception - if an exception occurred retrieving the template variable groups
    • isDisplayTemplateHandler

      boolean isDisplayTemplateHandler()
      Returns true if the entity is a display template handler.
      Returns:
      true if the entity is a display template handler; false otherwise
    • isEnabled

      default boolean isEnabled(long companyId)