Class TemplateFactory


  • public class TemplateFactory
    extends Object
    • Field Detail

      • logger

        protected static Logger logger
        create a static logger.
      • TEMPLATE_COLOR_AMBIANCE

        public static List<String> TEMPLATE_COLOR_AMBIANCE
    • Constructor Detail

      • TemplateFactory

        public TemplateFactory()
    • Method Detail

      • cleanRenderer

        public static void cleanRenderer​(ContentContext ctx,
                                         Collection<String> inTemplates,
                                         boolean secure)
                                  throws Exception
        clear only template with id contains in inTemplates
        Parameters:
        ctx -
        inTemplates - a list of template id
        mailing - true is mailing template
        secure -
        Throws:
        IOException
        Exception
      • clearTemplate

        public static void clearTemplate​(javax.servlet.ServletContext application)
      • getTemplateAllChildren

        public static Collection<Template> getTemplateAllChildren​(javax.servlet.ServletContext application,
                                                                  Template template)
                                                           throws Exception
        get all descendants of the template
        Parameters:
        application -
        template -
        Returns:
        Throws:
        IOException
        Exception
      • getAllDiskTemplates

        public static List<Template> getAllDiskTemplates​(javax.servlet.ServletContext application)
                                                  throws Exception
        get all templates from disk without cache
        Parameters:
        application -
        Returns:
        Throws:
        IOException
        Exception
      • getDiskTemplate

        public static Template getDiskTemplate​(javax.servlet.ServletContext application,
                                               String templateName)
                                        throws Exception
        get a template from disk
        Parameters:
        application - appplication context
        templateName - the name of the template
        Returns:
        Throws:
        IOException
        Exception
      • getAllValidTemplates

        public static List<Template> getAllValidTemplates​(javax.servlet.ServletContext application)
                                                   throws Exception
        Throws:
        Exception
      • createDiskTemplates

        public static Template createDiskTemplates​(javax.servlet.ServletContext application,
                                                   String name)
                                            throws Exception
        create new template with parent files.
        Parameters:
        application -
        Returns:
        Throws:
        IOException
        Exception
      • createDiskTemplates

        public static Template createDiskTemplates​(javax.servlet.ServletContext application,
                                                   String name,
                                                   String source)
                                            throws Exception
        create new template.
        Parameters:
        application -
        name - name of the new template, if all ready exist return null.
        source - name of the source template, all files must be copied inside new template (!with config.properties) null = no source template.
        Returns:
        Throws:
        IOException
        Exception
      • getTemplates

        public static Map<String,​Template> getTemplates​(javax.servlet.ServletContext application)
                                                       throws Exception
        get templates from template list cache or from disk if the cache does'nt exist.
        Parameters:
        application -
        Returns:
        Throws:
        IOException
        Exception
      • isTemplateExistOnDisk

        public static boolean isTemplateExistOnDisk​(javax.servlet.ServletContext application,
                                                    String templateID,
                                                    boolean mailing)
                                             throws Exception
        Throws:
        Exception
      • copyDefaultTemplate

        public static void copyDefaultTemplate​(javax.servlet.ServletContext application)