Package org.opencms.xml.templatemapper
Class CmsTemplateMapper
- java.lang.Object
-
- org.opencms.xml.templatemapper.CmsTemplateMapper
-
public final class CmsTemplateMapper extends java.lang.Object
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
Fields Modifier and Type Field Description protected java.lang.String
m_configPath
The path to the mapper configuration.protected boolean
m_enabled
Flag which controls whether this is enabled.
-
Constructor Summary
Constructors Constructor Description CmsTemplateMapper(java.lang.String configPath)
Creates a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CmsTemplateMapper
get()
Gets a template mapper.static CmsTemplateMapper
get(javax.servlet.ServletRequest request)
Gets the template mapper for the current request.static java.lang.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.CmsContainerPageBean
transformContainerpageBean(CmsObject cms, CmsContainerPageBean input, java.lang.String rootPath)
Transforms a container page bean.CmsContainerElementBean
transformDetailElement(CmsObject cms, CmsContainerElementBean input, java.lang.String rootPath)
Transforms a container element bean used for detail elements.CmsGroupContainerBean
transformGroupContainer(CmsObject cms, CmsGroupContainerBean input, java.lang.String rootPath)
Transforms a group container bean.
-
-
-
Field Detail
-
m_enabled
protected boolean m_enabled
Flag which controls whether this is enabled.
-
m_configPath
protected java.lang.String m_configPath
The path to the mapper configuration.
-
-
Constructor Detail
-
CmsTemplateMapper
public CmsTemplateMapper(java.lang.String configPath)
Creates a new instance.- Parameters:
configPath
- the template mapper configuration VFS path
-
-
Method Detail
-
get
public static CmsTemplateMapper get()
Gets a template mapper.- Returns:
- a template mapper
-
get
public static CmsTemplateMapper get(javax.servlet.ServletRequest request)
Gets the template mapper for the current request.- Parameters:
request
- the current request- Returns:
- the template mapper
-
getTemplateMapperConfig
public static java.lang.String getTemplateMapperConfig(javax.servlet.ServletRequest request)
Checks if the selected template context is "templatemapper".- Parameters:
request
- the current request- Returns:
- true if the selected template context is "templatemapper"
-
setForSave
public void setForSave(boolean forSave)
Sets the for-save mode.- Parameters:
forSave
- true if for-save mode should be enabled
-
transformContainerpageBean
public CmsContainerPageBean transformContainerpageBean(CmsObject cms, CmsContainerPageBean input, java.lang.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, java.lang.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, java.lang.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
-
-