com.gentics.api.portalnode.templateengine
Interface TemplateProcessor


public interface TemplateProcessor

Interface for a TemplateProcessor that can be used to render data based on templates.


Nested Class Summary
static interface TemplateProcessor.SpecificationItem
          Inner interface for specification items
 
Method Summary
 Map getContext()
          Get the template context as unmodifiable map.
 String getOutput(Map map)
          Parses and renders the (portal-wide) template identified by a single classification map
 String getOutput(Map[] maps)
          Parses and renders the (portal-wide) template identified by an array of classification maps
 String getOutput(Map[] maps, GenticsPlugin plugin)
          Parses the template source.
 String getOutput(Map[] maps, GenticsPortlet module)
          Parses the template source.
 String getOutput(Map map, GenticsPlugin plugin)
          Parses the template source.
 String getOutput(Map map, GenticsPortlet module)
          Parses the template source.
 String getOutput(String templateId)
          Parses and renders the (portal-wide) template identified by id
 String getOutput(String templateId, GenticsPlugin plugin)
          Parses the template source replacing variables with their actual values, given by id, with the context The context constist of default objects (i18n, formatters, ...) and the objects given via put(String, Object)
 String getOutput(String templateId, GenticsPortlet module)
          Parses the template source replacing variables with their actual values, given by id, with the context The context constist of default objects (i18n, formatters, ...) and the objects given via put(String, Object)
 String getOutputForSource(String templateSource)
          Parse and render the template given by source
 String getOutputForSource(String templateSource, GenticsPlugin plugin)
          Parses the given template source
 String getOutputForSource(String templateSource, GenticsPortlet portlet)
          Parses the given template source
 TemplateProcessor.SpecificationItem getSpecificationItem(String key, String value)
          Get a specification item with given key and value
 String getTemplate(Map map)
          Get the template source for the (portal-wide) template identified by a classification map
 String getTemplate(Map[] maps)
          Get the template source for the (portal-wide) template identified by an array of classification maps
 String getTemplate(Map[] maps, GenticsPlugin plugin)
          Get the template source, given by a map of parameters and implements a fallback according the array exception TemplateNotFoundException
 String getTemplate(Map[] maps, GenticsPortlet module)
          Get the template source, given by a map of parameters and implements a fallback according the array exception TemplateNotFoundException
 String getTemplate(Map map, GenticsPlugin plugin)
          Get the template source, given by hashmap exception TemplateNotFoundException
 String getTemplate(Map map, GenticsPortlet module)
          Get the template source, given by hashmap exception TemplateNotFoundException
 String getTemplate(String templateId)
          Get the template source for the (portal-wide) template identified by id
 String getTemplate(String templateId, GenticsPlugin plugin)
          Get the template source, given by id exception TemplateNotFoundException
 String getTemplate(String templateId, GenticsPortlet module)
          Get the template source, given by id exception TemplateNotFoundException
 void put(String key, Object object)
          Used to store objects in the template processor which will be available in the template source as variables.
 void putAll(Map map)
          Store all objects in the given map into the context of the template processor
 void reset()
          Prepares the object for reuse.
 

Method Detail

put

void put(String key,
         Object object)
         throws PrivateKeyException
Used to store objects in the template processor which will be available in the template source as variables.

Parameters:
key - The name of the variable.
object - The value of the variable.
Throws:
PrivateKeyException - is thrown if you are trying to overwrite a private object within the template (e.g. portal in pn3)

putAll

void putAll(Map map)
            throws PrivateKeyException
Store all objects in the given map into the context of the template processor

Parameters:
map - map of objects
Throws:
PrivateKeyException - when one of the objects in the map is stored with a key that cannot be overwritten

getContext

Map getContext()
Get the template context as unmodifiable map. When the context is fetched after a rendering process, it might reflect modifications made during the rendering phase.

Returns:
template context

getOutput

String getOutput(String templateId)
                 throws TemplateNotFoundException
Parses and renders the (portal-wide) template identified by id

Parameters:
templateId - template id
Returns:
rendered output of the template
Throws:
TemplateNotFoundException

getOutput

String getOutput(Map map)
                 throws TemplateNotFoundException
Parses and renders the (portal-wide) template identified by a single classification map

Parameters:
map - classification map
Returns:
rendered output of the template
Throws:
TemplateNotFoundException

getOutput

String getOutput(Map[] maps)
                 throws TemplateNotFoundException
Parses and renders the (portal-wide) template identified by an array of classification maps

Parameters:
maps - array of classification maps
Returns:
rendered output of the template
Throws:
TemplateNotFoundException

getTemplate

String getTemplate(String templateId)
                   throws TemplateNotFoundException
Get the template source for the (portal-wide) template identified by id

Parameters:
templateId - template id
Returns:
template source
Throws:
TemplateNotFoundException

getTemplate

String getTemplate(Map map)
                   throws TemplateNotFoundException
Get the template source for the (portal-wide) template identified by a classification map

Parameters:
map - classification map
Returns:
template source
Throws:
TemplateNotFoundException

getTemplate

String getTemplate(Map[] maps)
                   throws TemplateNotFoundException
Get the template source for the (portal-wide) template identified by an array of classification maps

Parameters:
maps - array of classification maps
Returns:
template source
Throws:
TemplateNotFoundException

getOutputForSource

String getOutputForSource(String templateSource)
                          throws TemplateNotFoundException
Parse and render the template given by source

Parameters:
templateSource - template source
Returns:
rendered template
Throws:
TemplateNotFoundException

getOutput

String getOutput(String templateId,
                 GenticsPortlet module)
                 throws TemplateNotFoundException
Parses the template source replacing variables with their actual values, given by id, with the context The context constist of default objects (i18n, formatters, ...) and the objects given via put(String, Object)

Parameters:
templateId - The id of the template.
module - the module for which called
Returns:
output A String created by merging the template and the context.
Throws:
TemplateNotFoundException - is only thrown when the parameter on.invalid.template.halt is true. otherwise the error message defined in the parameter on.invalid.template.message is returned.

getOutput

String getOutput(Map map,
                 GenticsPortlet module)
                 throws TemplateNotFoundException
Parses the template source. The template is selected by a map of parameters

Parameters:
map - Hashmap of parameters
module - the module for which called
Returns:
output A String created by merging the template and the context.
Throws:
TemplateNotFoundException - is only thrown when the parameter on.invalid.template.halt is true. otherwise the error message defined in the parameter on.invalid.template.message is returned.
See Also:
getOutput(java.lang.String, com.gentics.api.portalnode.portlet.GenticsPortlet)

getOutput

String getOutput(Map[] maps,
                 GenticsPortlet module)
                 throws TemplateNotFoundException
Parses the template source. The template is selected by a map of parameters and implements a fallback according the array

Parameters:
maps - Array of Hashmaps of parameters
module - the module for which called
Returns:
output A String created by merging the template and the context.
Throws:
TemplateNotFoundException - is only thrown when the parameter on.invalid.template.halt is true. otherwise the error message defined in the parameter on.invalid.template.message is returned.
See Also:
getOutput(java.lang.String, com.gentics.api.portalnode.portlet.GenticsPortlet)

getTemplate

String getTemplate(String templateId,
                   GenticsPortlet module)
                   throws TemplateNotFoundException
Get the template source, given by id exception TemplateNotFoundException

Parameters:
templateId - id of the template
module - the module for which called
Returns:
source of the template
Throws:
TemplateNotFoundException - is only thrown when the parameter on.invalid.template.halt is true. otherwise the error message defined in the parameter on.invalid.template.message is returned.

getTemplate

String getTemplate(Map map,
                   GenticsPortlet module)
                   throws TemplateNotFoundException
Get the template source, given by hashmap exception TemplateNotFoundException

Parameters:
map - Hashmap of parameters
module - the module for which called
Returns:
source of the template
Throws:
TemplateNotFoundException - is only thrown when the parameter on.invalid.template.halt is true. otherwise the error message defined in the parameter on.invalid.template.message is returned.

getTemplate

String getTemplate(Map[] maps,
                   GenticsPortlet module)
                   throws TemplateNotFoundException
Get the template source, given by a map of parameters and implements a fallback according the array exception TemplateNotFoundException

Parameters:
maps - Array of Hashmaps of parameters
module - the module for which called
Returns:
source of the template
Throws:
TemplateNotFoundException - is only thrown when the parameter on.invalid.template.halt is true. otherwise the error message defined in the parameter on.invalid.template.message is returned.

getOutput

String getOutput(String templateId,
                 GenticsPlugin plugin)
                 throws TemplateNotFoundException
Parses the template source replacing variables with their actual values, given by id, with the context The context constist of default objects (i18n, formatters, ...) and the objects given via put(String, Object)

Parameters:
templateId - The id of the template.
plugin - the plugin for which called
Returns:
output A String created by merging the template and the context.
Throws:
TemplateNotFoundException - is only thrown when the parameter on.invalid.template.halt is true. otherwise the error message defined in the parameter on.invalid.template.message is returned.

getOutput

String getOutput(Map map,
                 GenticsPlugin plugin)
                 throws TemplateNotFoundException
Parses the template source. The template is selected by a map of parameters

Parameters:
map - Hashmap of parameters
plugin - the plugin for which called
Returns:
output A String created by merging the template and the context.
Throws:
TemplateNotFoundException - is only thrown when the parameter on.invalid.template.halt is true. otherwise the error message defined in the parameter on.invalid.template.message is returned.
See Also:
getOutput(java.lang.String, com.gentics.api.portalnode.portlet.GenticsPortlet)

getOutput

String getOutput(Map[] maps,
                 GenticsPlugin plugin)
                 throws TemplateNotFoundException
Parses the template source. The template is selected by a map of parameters and implements a fallback according the array

Parameters:
maps - Array of Hashmaps of parameters
plugin - the plugin for which called
Returns:
output A String created by merging the template and the context.
Throws:
TemplateNotFoundException - is only thrown when the parameter on.invalid.template.halt is true. otherwise the error message defined in the parameter on.invalid.template.message is returned.
See Also:
getOutput(java.lang.String, com.gentics.api.portalnode.portlet.GenticsPortlet)

getOutputForSource

String getOutputForSource(String templateSource,
                          GenticsPortlet portlet)
                          throws TemplateNotFoundException
Parses the given template source

Parameters:
templateSource - source of the template
portlet - calling portlet
Returns:
processed template
Throws:
TemplateNotFoundException

getOutputForSource

String getOutputForSource(String templateSource,
                          GenticsPlugin plugin)
                          throws TemplateNotFoundException
Parses the given template source

Parameters:
templateSource - source of the template
plugin - calling plugin
Returns:
processed template
Throws:
TemplateNotFoundException

getTemplate

String getTemplate(String templateId,
                   GenticsPlugin plugin)
                   throws TemplateNotFoundException
Get the template source, given by id exception TemplateNotFoundException

Parameters:
templateId - id of the template
plugin - the plugin for which called
Returns:
source of the template
Throws:
TemplateNotFoundException - is only thrown when the parameter on.invalid.template.halt is true. otherwise the error message defined in the parameter on.invalid.template.message is returned.

getTemplate

String getTemplate(Map map,
                   GenticsPlugin plugin)
                   throws TemplateNotFoundException
Get the template source, given by hashmap exception TemplateNotFoundException

Parameters:
map - Hashmap of parameters
plugin - the plugin for which called
Returns:
source of the template
Throws:
TemplateNotFoundException - is only thrown when the parameter on.invalid.template.halt is true. otherwise the error message defined in the parameter on.invalid.template.message is returned.

getTemplate

String getTemplate(Map[] maps,
                   GenticsPlugin plugin)
                   throws TemplateNotFoundException
Get the template source, given by a map of parameters and implements a fallback according the array exception TemplateNotFoundException

Parameters:
maps - Array of Hashmaps of parameters
plugin - the plugin for which called
Returns:
source of the template
Throws:
TemplateNotFoundException - is only thrown when the parameter on.invalid.template.halt is true. otherwise the error message defined in the parameter on.invalid.template.message is returned.

reset

void reset()
Prepares the object for reuse.


getSpecificationItem

TemplateProcessor.SpecificationItem getSpecificationItem(String key,
                                                         String value)
Get a specification item with given key and value

Parameters:
key - key of the specification item
value - value of the specification item
Returns:
specification item


Copyright © 2013 Gentics Software GmbH. All Rights Reserved.