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.Stringm_configPathThe path to the mapper configuration.protected booleanm_enabledFlag 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 CmsTemplateMapperget()Gets a template mapper.static CmsTemplateMapperget(javax.servlet.ServletRequest request)Gets the template mapper for the current request.static java.lang.StringgetTemplateMapperConfig(javax.servlet.ServletRequest request)Checks if the selected template context is "templatemapper".voidsetForSave(boolean forSave)Sets the for-save mode.protected CmsContainerElementBeantransformContainerElement(CmsObject cms, CmsTemplateMapperConfiguration config, CmsContainerElementBean element)Helper method to transform a single container element.CmsContainerPageBeantransformContainerpageBean(CmsObject cms, CmsContainerPageBean input, java.lang.String rootPath)Transforms a container page bean.CmsContainerElementBeantransformDetailElement(CmsObject cms, CmsContainerElementBean input, java.lang.String rootPath)Transforms a container element bean used for detail elements.CmsGroupContainerBeantransformGroupContainer(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
-
-