Package org.opencms.xml.content
Class CmsMappingResolutionContext
java.lang.Object
org.opencms.xml.content.CmsMappingResolutionContext
A class which represents the context for resolving all content value mappings of an XML content.
Since the content handler instance is shared between all contents of the same XML content type, we can't use it to store data which is only relevant for resolving the mappings of a single XML content, so this class was created.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The attribute type. -
Constructor Summary
ConstructorDescriptionCmsMappingResolutionContext
(CmsXmlContent content, boolean hasAttributeMappings) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Writes all the stored URL name mappings to the database.void
Finalizes the mappings.void
putExpirationDate
(Locale locale, long expiration) Stores the mapped expiration date for the given locale.void
putReleaseDate
(Locale locale, long release) Stores the mapped release date for the given locale.void
setAttribute
(CmsResource res, CmsMappingResolutionContext.AttributeType type, Long value) Helper method for setting release/expiration date.void
setCmsObject
(CmsObject cms) Sets the CMS context to use.protected void
Writes the mapped attributes.
-
Constructor Details
-
CmsMappingResolutionContext
Creates a new instance.- Parameters:
content
- the xml contenthasAttributeMappings
- true if the schema has attribute mappings
-
-
Method Details
-
commitUrlNameMappings
Writes all the stored URL name mappings to the database.- Throws:
CmsException
- if something goes wrong
-
finalizeMappings
Finalizes the mappings.- Throws:
CmsException
- if something goes wrong
-
putExpirationDate
Stores the mapped expiration date for the given locale.- Parameters:
locale
- the localeexpiration
- the expiration date
-
putReleaseDate
Stores the mapped release date for the given locale.- Parameters:
locale
- the localerelease
- the release date
-
setAttribute
public void setAttribute(CmsResource res, CmsMappingResolutionContext.AttributeType type, Long value) throws CmsException Helper method for setting release/expiration date.Needs to also set the attributes on the resource of m_content because it's written later by the content handler.
- Parameters:
res
- the resource to settype
- the attribute typevalue
- the value to set (null for default value)- Throws:
CmsException
- if something goes wrong
-
setCmsObject
Sets the CMS context to use.- Parameters:
cms
- the CMS context
-
writeAttributes
Writes the mapped attributes.
-