Class 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.

    • Constructor Detail

      • CmsMappingResolutionContext

        public CmsMappingResolutionContext​(CmsXmlContent content,
                                           boolean hasAttributeMappings)
        Creates a new instance.

        Parameters:
        content - the xml content
        hasAttributeMappings - true if the schema has attribute mappings
    • Method Detail

      • putExpirationDate

        public void putExpirationDate​(java.util.Locale locale,
                                      long expiration)
        Stores the mapped expiration date for the given locale.
        Parameters:
        locale - the locale
        expiration - 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 locale
        release - 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 set
        type - the attribute type
        value - 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.