Class PortletTemplateHome

java.lang.Object
fr.paris.lutece.portal.business.portlet.PortletTemplateHome

public final class PortletTemplateHome extends Object
Static facade of the portlet templates : the FreeMarker templates a portlet of a given type can be rendered with
  • Field Details

    • NO_TEMPLATE_ID

      public static final int NO_TEMPLATE_ID
      The template identifier meaning "no template chosen" : the portlet renders with the default template of its type
      See Also:
  • Method Details

    • create

      public static PortletTemplate create(PortletTemplate template)
      Creates a template
      Parameters:
      template - the template
      Returns:
      the template, with its identifier
    • update

      public static PortletTemplate update(PortletTemplate template)
      Updates a template
      Parameters:
      template - the template
      Returns:
      the template
    • remove

      public static void remove(int nKey)
      Removes a template
      Parameters:
      nKey - the template identifier
    • findByPrimaryKey

      public static PortletTemplate findByPrimaryKey(int nKey)
      Finds a template
      Parameters:
      nKey - the template identifier
      Returns:
      the template, null when it does not exist
    • findAll

      public static List<PortletTemplate> findAll()
      Returns every template, ordered by portlet type
      Returns:
      the templates
    • findByPortletType

      public static List<PortletTemplate> findByPortletType(String strPortletTypeId)
      Returns the templates registered for a portlet type
      Parameters:
      strPortletTypeId - the portlet type identifier
      Returns:
      the templates, ordered by identifier
    • findByPrimaryKeyList

      public static List<PortletTemplate> findByPrimaryKeyList(List<Integer> listIdTemplates)
      Returns the templates whose identifiers are given. It is serializable as a method reference, which lets a session pager load a page of templates from their identifiers.
      Parameters:
      listIdTemplates - the template identifiers
      Returns:
      the templates, ordered by portlet type then identifier
    • findAllIds

      public static List<Integer> findAllIds()
      Returns the identifiers of every template
      Returns:
      the identifiers, ordered by portlet type then identifier
    • findIdsByPortletType

      public static List<Integer> findIdsByPortletType(String strPortletTypeId)
      Returns the identifiers of the templates registered for a portlet type
      Parameters:
      strPortletTypeId - the portlet type identifier
      Returns:
      the identifiers, ordered by identifier
    • findReferenceList

      public static ReferenceList findReferenceList(String strPortletTypeId)
      Returns the templates registered for a portlet type as a reference list for a select
      Parameters:
      strPortletTypeId - the portlet type identifier
      Returns:
      the reference list (template identifier, description)
    • findReferenceList

      public static ReferenceList findReferenceList()
      Returns the templates as a reference list for a select, whatever their portlet type
      Returns:
      the reference list (template identifier, description)
    • getTemplatePath

      public static String getTemplatePath(Portlet portlet, String strDefaultTemplatePath)
      Returns the path of the template chosen for a portlet, or a default path when the portlet has no valid template.

      A template is valid when it exists, has a path and applies to the portlet type : a template removed from the back office, or a template of another type, never breaks a page.

      Parameters:
      portlet - the portlet
      strDefaultTemplatePath - the path used when the portlet has no valid template
      Returns:
      the template path, relative to the WEB-INF/templates directory
    • isTemplateUsed

      public static boolean isTemplateUsed(int nKey)
      Tells whether at least one portlet uses a template
      Parameters:
      nKey - the template identifier
      Returns:
      true when a portlet uses the template