org.appng.core.service

## Class TemplateService

- java.lang.Object
- - org.appng.core.service.TemplateService

-     @Transactional
      public class TemplateService
      extends Object

  A service offering methods to deal with templates.
  Author:
    Matthias Müller

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `PLATFORM_XML`
    `protected TemplateRepository` | `templateRepository`
    `protected TemplateResourceRepository` | `templateResourceRepository`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TemplateService()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `copyTemplate(Properties platformConfig, Properties siteProps, String templateRealPath)` The active template for the given `Site` is being copied to
    `Integer` | `deleteTemplate(Template template)`
    `protected static void` | `deleteTemplateFolder(File templateTargetDir)`
    `List<Identifier>` | `getInstalledTemplates()` Returns a list of all installed templates.
    `Template` | `getTemplate(String templateDir)`
    `Template` | `getTemplateByDisplayName(String name)`
    `Template` | `getTemplateByName(String name)`
    `ZipFileProcessor<Template>` | `getTemplateExtractor()` Returns a `ZipFileProcessor``<``Template``>`, which used to extract a template-zip.
    `static ZipFileProcessor<Template>` | `getTemplateInfo(String originalFilename)` Returns a `ZipFileProcessor``<``Template``>`, used to check whether a `ZipFile` contains a valid template.
    `static File` | `getTemplateRepoFolder(Properties platformConfig, Properties siteProps)`
    `Template` | `installTemplate(PackageArchive packageArchive)`
    `static void` | `materializeTemplate(Template template, Properties platformConfig, Properties siteProps)` Materializes the given template into the filesystem.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### PLATFORM_XML

          public static final String PLATFORM_XML

      See Also:
        Constant Field Values

    - #### templateRepository

          @Autowired
          protected TemplateRepository templateRepository

    - #### templateResourceRepository

          @Autowired
          protected TemplateResourceRepository templateResourceRepository

  - ### Constructor Detail

    - #### TemplateService

          public TemplateService()

  - ### Method Detail

    - #### getTemplateExtractor

          public ZipFileProcessor<Template> getTemplateExtractor()

      Returns a `ZipFileProcessor``<``Template``>`, which used to extract a template-zip.
      Returns:
        the `ZipFileProcessor`

    - #### getTemplateInfo

          public static ZipFileProcessor<Template> getTemplateInfo(String originalFilename)

      Returns a `ZipFileProcessor``<``Template``>`, used to check whether a `ZipFile` contains a valid template.
      Parameters:
        `originalFilename` - the original file name of the `ZipFile`
      Returns:
        the `ZipFileProcessor`

    - #### getInstalledTemplates

          public List<Identifier> getInstalledTemplates()

      Returns a list of all installed templates.
      Returns:
        a list containing the `Identifier`s of all installed templates

    - #### materializeTemplate

          public static void materializeTemplate(Template template,
                                                 Properties platformConfig,
                                                 Properties siteProps)

      Materializes the given template into the filesystem.
      Parameters:
        `template` - the `Template` to materialize
        `platformConfig` - the platform configuration
        `siteProps` - the `Site`'s `Properties`

    - #### copyTemplate

          public static void copyTemplate(Properties platformConfig,
                                          Properties siteProps,
                                          String templateRealPath)

      The active template for the given `Site` is being copied to

           "siteRootDir"/"wwwDir"/"templatePrefix"

      Parameters:
        `platformConfig` - the platform configuration
        `siteProps` - the `Site`'s `Properties`
        `templateRealPath` - the root path to the platform's template directory

    - #### installTemplate

          public Template installTemplate(PackageArchive packageArchive)
                                   throws BusinessException

      Throws:
        `BusinessException`

    - #### getTemplateByDisplayName

          public Template getTemplateByDisplayName(String name)

    - #### getTemplateByName

          public Template getTemplateByName(String name)

    - #### deleteTemplate

          public Integer deleteTemplate(Template template)

    - #### getTemplateRepoFolder

          public static File getTemplateRepoFolder(Properties platformConfig,
                                                   Properties siteProps)

    - #### deleteTemplateFolder

          protected static void deleteTemplateFolder(File templateTargetDir)

    - #### getTemplate

          public Template getTemplate(String templateDir)
                               throws IOException,
                                      JAXBException

      Throws:
        `IOException`
        `JAXBException`

Copyright © 2011–2023 aiticon GmbH. All rights reserved.