Class CMSTemplateManager

java.lang.Object
io.goobi.viewer.model.cms.pages.CMSTemplateManager
All Implemented Interfaces:
Serializable

@Singleton @Startup @Named("cmsTemplateManager") public class CMSTemplateManager extends Object implements Serializable
Loads and provides access to available CMS page templates from the filesystem.
See Also:
  • Constructor Details

  • Method Details

    • init

      @PostConstruct public void init() throws PresentationException
      Throws:
      PresentationException
    • loadLegacyTemplate

      public Optional<CMSPageTemplate> loadLegacyTemplate(String filename)
    • getContentManager

      public CMSPageContentManager getContentManager()
    • reloadContentManager

      public void reloadContentManager()
    • toURI

      public static Path toURI(URL url)
      toURI.
      Parameters:
      url - URL to convert to a filesystem path
      Returns:
      the filesystem path corresponding to the given URL, or null if conversion fails
    • getCoreTemplateFolderUrl

      public static Optional<URL> getCoreTemplateFolderUrl(String filesystemPath, ServletContext servletContext, String templateFolderUrl) throws MalformedURLException, URISyntaxException
      Getter for the field coreTemplateFolderUrl.
      Parameters:
      filesystemPath - base filesystem path used when servlet context is absent
      servletContext - servlet context for resolving web resource paths
      templateFolderUrl - relative URL path of the template folder
      Returns:
      an Optional containing the URL to the core CMS template folder, or empty if not found
      Throws:
      MalformedURLException - if any.
      UnsupportedEncodingException - if any.
      URISyntaxException - if any.
    • updateTemplates

      public void updateTemplates(Optional<Path> corePath, Optional<Path> themePath)
      updateTemplates.
      Parameters:
      corePath - optional path to the core legacy template folder
      themePath - optional path to the theme legacy template folder
    • getLegacyComponents

      public Collection<CMSComponent> getLegacyComponents()
      Getter for the field templates.
      Returns:
      the collection of all loaded legacy CMS template components
    • getLegacyComponentMap

      public Map<String,CMSComponent> getLegacyComponentMap()
    • getLegacyComponent

      public CMSComponent getLegacyComponent(String templateId)
      getTemplate.
      Parameters:
      templateId - unique identifier of the legacy template
      Returns:
      the legacy CMS component matching the given template ID, or null if not found
    • getThemeFolderPath

      public Optional<Path> getThemeFolderPath()
      Getter for the field themeFolderPath.
      Returns:
      an Optional containing the path to the theme's CMS template folder, or empty if no theme folder is configured
    • getCoreFolderPath

      public Optional<Path> getCoreFolderPath()
      Getter for the field coreFolderPath.
      Returns:
      an Optional containing the path to the core CMS template folder, or empty if no core folder is configured
    • getCoreViewFolderPath

      public Optional<Path> getCoreViewFolderPath()
      getCoreViewFolderPath.
      Returns:
      an Optional containing the path to the core CMS template views folder, or empty if no core folder is configured
    • getThemeViewFolderPath

      public Optional<Path> getThemeViewFolderPath()
      getThemeViewFolderPath.
      Returns:
      an Optional containing the path to the theme CMS template views folder, or empty if no theme folder is configured
    • getCoreIconFolderPath

      public Optional<Path> getCoreIconFolderPath()
      getCoreIconFolderPath.
      Returns:
      an Optional containing the path to the core CMS template icons folder, or empty if no core folder is configured
    • getThemeIconFolderPath

      public Optional<Path> getThemeIconFolderPath()
      getThemeIconFolderPath.
      Returns:
      an Optional containing the path to the theme CMS template icons folder, or empty if no theme folder is configured
    • getComponent

      public Optional<CMSComponent> getComponent(String templateFilename)