Package org.opencms.xml.containerpage
Class CmsDynamicFunctionParser
- java.lang.Object
-
- org.opencms.xml.containerpage.CmsDynamicFunctionParser
-
public class CmsDynamicFunctionParser extends java.lang.Object
The parser class for creating dynamic function beans from XML contents.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
N_CONTAINER_SETTINGS
The node name for the formatter settings.
-
Constructor Summary
Constructors Constructor Description CmsDynamicFunctionParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.List<CmsDynamicFunctionBean.Format>
getAdditionalFormats(CmsObject cms, I_CmsXmlContentLocation location, CmsResource functionRes)
Parses all the additional formats from the XML content.protected CmsResource
getFunctionFormatter(CmsObject cms)
Gets the function formatter resource, possibly from the cache.protected java.util.Locale
getLocaleToUse(CmsObject cms, CmsXmlContent xmlContent)
Gets the locale to use for parsing the dynamic function.protected CmsDynamicFunctionBean.Format
getMainFormat(CmsObject cms, I_CmsXmlContentLocation location, CmsResource functionRes)
Parses the main format from the XML content.protected java.lang.String
getString(CmsObject cms, I_CmsXmlContentValueLocation location)
Gets the string value of an XML content location.protected java.lang.String
getStringValue(CmsObject cms, I_CmsXmlContentValueLocation location, java.lang.String defaultValue)
Converts a (possibly null) content value location to a string.protected CmsDynamicFunctionBean.Format
parseAdditionalFormat(CmsObject cms, I_CmsXmlContentValueLocation location, CmsResource functionRes)
Parses an additional format from the XML content.CmsDynamicFunctionBean
parseFunctionBean(CmsObject cms, CmsResource res)
Parses a dynamic function bean given a resource.CmsDynamicFunctionBean
parseFunctionBean(CmsObject cms, CmsXmlContent content)
Parses a dynamic function bean from an in-memory XML content object.protected CmsDynamicFunctionBean
parseFunctionBean(CmsObject cms, I_CmsXmlContentLocation location, CmsResource functionRes, CmsResource functionFormatter)
Parses a dynamic function bean.protected CmsPair<java.lang.String,java.lang.String>
parseParameter(CmsObject cms, I_CmsXmlContentValueLocation valueLocation)
Parses a request parameter for the JSP from the XML content.protected java.util.Map<java.lang.String,java.lang.String>
parseParameters(CmsObject cms, I_CmsXmlContentLocation location, java.lang.String name)
Parses all parameters for the JSP from the XML content.protected CmsXmlContentProperty
parseProperty(CmsObject cms, I_CmsXmlContentLocation field)
Helper method for parsing a settings definition.protected java.util.Map<java.lang.String,CmsXmlContentProperty>
parseSettings(CmsObject cms, I_CmsXmlContentLocation location, CmsResource functionResource)
Parses the settings for the dynamic function from the XML content.
-
-
-
Field Detail
-
N_CONTAINER_SETTINGS
public static final java.lang.String N_CONTAINER_SETTINGS
The node name for the formatter settings.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsDynamicFunctionParser
public CmsDynamicFunctionParser()
-
-
Method Detail
-
parseFunctionBean
public CmsDynamicFunctionBean parseFunctionBean(CmsObject cms, CmsResource res) throws CmsException
Parses a dynamic function bean given a resource.- Parameters:
cms
- the current CMS contextres
- the resource from which to read the dynamic function- Returns:
- the dynamic function bean created from the resource
- Throws:
CmsException
- if something goes wrong
-
parseFunctionBean
public CmsDynamicFunctionBean parseFunctionBean(CmsObject cms, CmsXmlContent content) throws CmsException
Parses a dynamic function bean from an in-memory XML content object.- Parameters:
cms
- the current CMS contextcontent
- the XML content from which to read the dynamic function bean- Returns:
- the dynamic function bean read from the XML content
- Throws:
CmsException
- if something goes wrong
-
getAdditionalFormats
protected java.util.List<CmsDynamicFunctionBean.Format> getAdditionalFormats(CmsObject cms, I_CmsXmlContentLocation location, CmsResource functionRes)
Parses all the additional formats from the XML content.- Parameters:
cms
- the current CMS contextlocation
- the location from which to parse the additional formatsfunctionRes
- the dynamic function resource- Returns:
- the list of parsed formats
-
getFunctionFormatter
protected CmsResource getFunctionFormatter(CmsObject cms) throws CmsException
Gets the function formatter resource, possibly from the cache.- Parameters:
cms
- the current CMS context- Returns:
- the function formatter resource
- Throws:
CmsException
- if something goes wrong
-
getLocaleToUse
protected java.util.Locale getLocaleToUse(CmsObject cms, CmsXmlContent xmlContent)
Gets the locale to use for parsing the dynamic function.- Parameters:
cms
- the current CMS contextxmlContent
- the xml content from which the dynamic function should be read- Returns:
- the locale from which the dynamic function should be read
-
getMainFormat
protected CmsDynamicFunctionBean.Format getMainFormat(CmsObject cms, I_CmsXmlContentLocation location, CmsResource functionRes)
Parses the main format from the XML content.- Parameters:
cms
- the current CMS contextlocation
- the location from which to parse main formatfunctionRes
- the dynamic function resource- Returns:
- the parsed main format
-
getString
protected java.lang.String getString(CmsObject cms, I_CmsXmlContentValueLocation location)
Gets the string value of an XML content location.- Parameters:
cms
- the current CMS contextlocation
- an XML content location- Returns:
- the string value of that XML content location
-
getStringValue
protected java.lang.String getStringValue(CmsObject cms, I_CmsXmlContentValueLocation location, java.lang.String defaultValue)
Converts a (possibly null) content value location to a string.- Parameters:
cms
- the current CMS contextlocation
- the content value locationdefaultValue
- the value to return if the location is null- Returns:
- the string value of the content value location
-
parseAdditionalFormat
protected CmsDynamicFunctionBean.Format parseAdditionalFormat(CmsObject cms, I_CmsXmlContentValueLocation location, CmsResource functionRes)
Parses an additional format from the XML content.- Parameters:
cms
- the current CMS contextlocation
- the location from which to parse the additional formatfunctionRes
- the dynamic function resource- Returns:
- the additional format
-
parseFunctionBean
protected CmsDynamicFunctionBean parseFunctionBean(CmsObject cms, I_CmsXmlContentLocation location, CmsResource functionRes, CmsResource functionFormatter)
Parses a dynamic function bean.- Parameters:
cms
- the current CMS contextlocation
- the location from which to parse the dynamic function beanfunctionRes
- the dynamic function resourcefunctionFormatter
- the function formatter resource- Returns:
- the parsed dynamic function bean
-
parseParameter
protected CmsPair<java.lang.String,java.lang.String> parseParameter(CmsObject cms, I_CmsXmlContentValueLocation valueLocation)
Parses a request parameter for the JSP from the XML content.- Parameters:
cms
- the current CMS contextvalueLocation
- the location from which to parse the parameter- Returns:
- the parsed parameter key/value pair
-
parseParameters
protected java.util.Map<java.lang.String,java.lang.String> parseParameters(CmsObject cms, I_CmsXmlContentLocation location, java.lang.String name)
Parses all parameters for the JSP from the XML content.- Parameters:
cms
- the current CMS contextlocation
- the location from which to read the parametersname
- the name of the tag from which to read the parameters- Returns:
- the parsed map of parameters
-
parseProperty
protected CmsXmlContentProperty parseProperty(CmsObject cms, I_CmsXmlContentLocation field)
Helper method for parsing a settings definition.- Parameters:
cms
- the current CMS contextfield
- the node from which to read the settings definition- Returns:
- the parsed setting definition
-
parseSettings
protected java.util.Map<java.lang.String,CmsXmlContentProperty> parseSettings(CmsObject cms, I_CmsXmlContentLocation location, CmsResource functionResource)
Parses the settings for the dynamic function from the XML content.- Parameters:
cms
- the current CMS contextlocation
- the location from which to read the dynamic function settingsfunctionResource
- the dynamic function resource- Returns:
- the parsed map of settings for the dynamic function
-
-