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 Logger
logger
create 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 void
cleanAllRenderer(ContentContext ctx, boolean secure)
static void
cleanRenderer(ContentContext ctx, Collection<String> inTemplates, boolean secure)
clear only template with id contains in inTemplatesstatic void
clearTemplate(javax.servlet.ServletContext application)
static void
copyDefaultTemplate(javax.servlet.ServletContext application)
static Template
createDiskTemplates(javax.servlet.ServletContext application, String name)
create new template with parent files.static Template
createDiskTemplates(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 Template
getDiskTemplate(javax.servlet.ServletContext application, String templateName)
get a template from diskstatic Map<String,Template>
getDiskTemplates(javax.servlet.ServletContext application)
get template from disk.static Template
getTemplate(javax.servlet.ServletContext application, ContentContextBean ctxb, MenuElement elem)
static Template
getTemplate(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 boolean
isTemplateExistOnDisk(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:
IOException
Exception
-
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:
IOException
Exception
-
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 contexttemplateName
- the name of the template- Returns:
- Throws:
IOException
Exception
-
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:
IOException
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
-
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
-
-