Class CmsMappingResolutionContext

java.lang.Object
org.opencms.xml.content.CmsMappingResolutionContext

public class CmsMappingResolutionContext extends 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 Details

    • 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 Details

    • 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(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(Locale locale, long release)
      Stores the mapped release date for the given locale.
      Parameters:
      locale - the locale
      release - the release date
    • setAttribute

      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.