Package org.opencms.xml.content
Class CmsMappingResolutionContext
- java.lang.Object
-
- org.opencms.xml.content.CmsMappingResolutionContext
-
public class CmsMappingResolutionContext extends java.lang.Object
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
Nested Classes Modifier and Type Class Description static class
CmsMappingResolutionContext.AttributeType
The attribute type.
-
Constructor Summary
Constructors Constructor Description CmsMappingResolutionContext(CmsXmlContent content, boolean hasAttributeMappings)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
commitUrlNameMappings()
Writes all the stored URL name mappings to the database.void
finalizeMappings()
Finalizes the mappings.void
putExpirationDate(java.util.Locale locale, long expiration)
Stores the mapped expiration date for the given locale.void
putReleaseDate(java.util.Locale locale, long release)
Stores the mapped release date for the given locale.void
setAttribute(CmsResource res, CmsMappingResolutionContext.AttributeType type, java.lang.Long value)
Helper method for setting release/expiration date.void
setCmsObject(CmsObject cms)
Sets the CMS context to use.protected void
writeAttributes()
Writes the mapped attributes.
-
-
-
Constructor Detail
-
CmsMappingResolutionContext
public CmsMappingResolutionContext(CmsXmlContent content, boolean hasAttributeMappings)
Creates a new instance.- Parameters:
content
- the xml contenthasAttributeMappings
- true if the schema has attribute mappings
-
-
Method Detail
-
commitUrlNameMappings
public void commitUrlNameMappings() throws CmsException
Writes all the stored URL name mappings to the database.- Throws:
CmsException
- if something goes wrong
-
finalizeMappings
public void finalizeMappings() throws CmsException
Finalizes the mappings.- Throws:
CmsException
- if something goes wrong
-
putExpirationDate
public void putExpirationDate(java.util.Locale locale, long expiration)
Stores the mapped expiration date for the given locale.- Parameters:
locale
- the localeexpiration
- the expiration date
-
putReleaseDate
public void putReleaseDate(java.util.Locale locale, long release)
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, java.lang.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
public void setCmsObject(CmsObject cms)
Sets the CMS context to use.- Parameters:
cms
- the CMS context
-
writeAttributes
protected void writeAttributes()
Writes the mapped attributes.
-
-