Package org.javlo.template
Class TemplateFactory
- java.lang.Object
-
- org.javlo.template.TemplateFactory
-
public class TemplateFactory extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static Loggerloggercreate a static logger.static List<String>TEMPLATE_COLOR_AMBIANCE
-
Constructor Summary
Constructors Constructor Description TemplateFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcleanAllRenderer(ContentContext ctx, boolean secure)static voidcleanRenderer(ContentContext ctx, Collection<String> inTemplates, boolean secure)clear only template with id contains in inTemplatesstatic voidclearTemplate(javax.servlet.ServletContext application)static voidcopyDefaultTemplate(javax.servlet.ServletContext application)static TemplatecreateDiskTemplates(javax.servlet.ServletContext application, String name)create new template with parent files.static TemplatecreateDiskTemplates(javax.servlet.ServletContext application, String name, String source)create new template.static List<String>getAllAuthors(javax.servlet.ServletContext application)static List<Template>getAllDiskTemplates(javax.servlet.ServletContext application)get all templates from disk without cachestatic List<String>getAllSources(javax.servlet.ServletContext application)static List<Template>getAllTemplates(javax.servlet.ServletContext application)static List<Template>getAllTemplatesFromContext(GlobalContext context)static List<Template>getAllValidTemplates(javax.servlet.ServletContext application)static TemplategetDiskTemplate(javax.servlet.ServletContext application, String templateName)get a template from diskstatic Map<String,Template>getDiskTemplates(javax.servlet.ServletContext application)get template from disk.static TemplategetTemplate(javax.servlet.ServletContext application, ContentContextBean ctxb, MenuElement elem)static TemplategetTemplate(ContentContext ctx, MenuElement elem)static Collection<Template>getTemplateAllChildren(javax.servlet.ServletContext application, Template template)get all descendants of the templatestatic Collection<Template>getTemplateChildren(javax.servlet.ServletContext application, Template template)get children of the template.static Map<String,Template>getTemplates(javax.servlet.ServletContext application)get templates from template list cache or from disk if the cache does'nt exist.static booleanisTemplateExistOnDisk(javax.servlet.ServletContext application, String templateID, boolean mailing)static Collection<NavigationWithContent>searchPageNeedTemplate(ContentContext ctx, String templateId)
-
-
-
Method Detail
-
cleanAllRenderer
public static void cleanAllRenderer(ContentContext ctx, boolean secure) throws Exception
- Throws:
Exception
-
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 idmailing- true is mailing templatesecure-- Throws:
IOExceptionException
-
clearTemplate
public static void clearTemplate(javax.servlet.ServletContext application)
-
getAllAuthors
public static List<String> getAllAuthors(javax.servlet.ServletContext application) throws Exception
- Throws:
Exception
-
getAllSources
public static List<String> getAllSources(javax.servlet.ServletContext application) throws Exception
- Throws:
Exception
-
getAllTemplates
public static List<Template> getAllTemplates(javax.servlet.ServletContext application) throws Exception
- Throws:
Exception
-
getAllTemplatesFromContext
public static List<Template> getAllTemplatesFromContext(GlobalContext context) throws Exception
- Throws:
Exception
-
getTemplateChildren
public static Collection<Template> getTemplateChildren(javax.servlet.ServletContext application, Template template) throws Exception
get children of the template.- Parameters:
application-template-- Returns:
- Throws:
IOExceptionException
-
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:
IOExceptionException
-
getAllDiskTemplates
public static List<Template> getAllDiskTemplates(javax.servlet.ServletContext application) throws Exception
get all templates from disk without cache- Parameters:
application-- Returns:
- Throws:
IOExceptionException
-
getDiskTemplate
public static Template getDiskTemplate(javax.servlet.ServletContext application, String templateName) throws Exception
get a template from disk- Parameters:
application- appplication contexttemplateName- the name of the template- Returns:
- Throws:
IOExceptionException
-
getAllValidTemplates
public static List<Template> getAllValidTemplates(javax.servlet.ServletContext application) throws Exception
- Throws:
Exception
-
getDiskTemplates
public static Map<String,Template> getDiskTemplates(javax.servlet.ServletContext application) throws Exception
get template from disk.- Parameters:
application-- Returns:
- Throws:
IOExceptionException
-
createDiskTemplates
public static Template createDiskTemplates(javax.servlet.ServletContext application, String name) throws Exception
create new template with parent files.- Parameters:
application-- Returns:
- Throws:
IOExceptionException
-
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:
IOExceptionException
-
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:
IOExceptionException
-
isTemplateExistOnDisk
public static boolean isTemplateExistOnDisk(javax.servlet.ServletContext application, String templateID, boolean mailing) throws Exception- Throws:
Exception
-
getTemplate
public static Template getTemplate(ContentContext ctx, MenuElement elem) throws Exception
- Throws:
Exception
-
getTemplate
public static Template getTemplate(javax.servlet.ServletContext application, ContentContextBean ctxb, MenuElement elem) throws Exception
- Throws:
Exception
-
copyDefaultTemplate
public static void copyDefaultTemplate(javax.servlet.ServletContext application)
-
searchPageNeedTemplate
public static Collection<NavigationWithContent> searchPageNeedTemplate(ContentContext ctx, String templateId) throws Exception
- Throws:
Exception
-
-