Package org.opencms.xml.templatemapper
Class CmsTemplateMapper
java.lang.Object
org.opencms.xml.templatemapper.CmsTemplateMapper
Responsible for mapping formatters, containers and settings to different formatters, containers and settings according to
the configuration file /system/config/template-mapping.xml.
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
The path to the mapper configuration.protected boolean
Flag which controls whether this is enabled. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic CmsTemplateMapper
get()
Gets a template mapper.static CmsTemplateMapper
get
(javax.servlet.ServletRequest request) Gets the template mapper for the current request.static String
getTemplateMapperConfig
(javax.servlet.ServletRequest request) Checks if the selected template context is "templatemapper".void
setForSave
(boolean forSave) Sets the for-save mode.protected CmsContainerElementBean
transformContainerElement
(CmsObject cms, CmsTemplateMapperConfiguration config, CmsContainerElementBean element) Helper method to transform a single container element.transformContainerpageBean
(CmsObject cms, CmsContainerPageBean input, String rootPath) Transforms a container page bean.transformDetailElement
(CmsObject cms, CmsContainerElementBean input, String rootPath) Transforms a container element bean used for detail elements.transformGroupContainer
(CmsObject cms, CmsGroupContainerBean input, String rootPath) Transforms a group container bean.
-
Field Details
-
m_enabled
Flag which controls whether this is enabled. -
m_configPath
The path to the mapper configuration.
-
-
Constructor Details
-
CmsTemplateMapper
Creates a new instance.- Parameters:
configPath
- the template mapper configuration VFS path
-
-
Method Details
-
get
Gets a template mapper.- Returns:
- a template mapper
-
get
Gets the template mapper for the current request.- Parameters:
request
- the current request- Returns:
- the template mapper
-
getTemplateMapperConfig
Checks if the selected template context is "templatemapper".- Parameters:
request
- the current request- Returns:
- true if the selected template context is "templatemapper"
-
setForSave
Sets the for-save mode.- Parameters:
forSave
- true if for-save mode should be enabled
-
transformContainerpageBean
public CmsContainerPageBean transformContainerpageBean(CmsObject cms, CmsContainerPageBean input, String rootPath) Transforms a container page bean.- Parameters:
cms
- the current CMS contextinput
- the bean to be transformedrootPath
- the root path of the page- Returns:
- the transformed bean
-
transformDetailElement
public CmsContainerElementBean transformDetailElement(CmsObject cms, CmsContainerElementBean input, String rootPath) Transforms a container element bean used for detail elements.- Parameters:
cms
- the current CMS contextinput
- the bean to be transformedrootPath
- the root path of the page- Returns:
- the transformed bean
-
transformGroupContainer
public CmsGroupContainerBean transformGroupContainer(CmsObject cms, CmsGroupContainerBean input, String rootPath) Transforms a group container bean.- Parameters:
cms
- the current CMS contextinput
- the input bean to be transformedrootPath
- the root path of the container page- Returns:
- the transformed bean
-
transformContainerElement
protected CmsContainerElementBean transformContainerElement(CmsObject cms, CmsTemplateMapperConfiguration config, CmsContainerElementBean element) Helper method to transform a single container element.- Parameters:
cms
- the CMS contextconfig
- the configurationelement
- the container element to be transformed- Returns:
- the transformed bean
-