Interface ContentVariation

All Superinterfaces:
Versionable<ContentVariation>

public interface ContentVariation extends Versionable<ContentVariation>

Implementations of this interface allow to access a variation of a content element through a stable API, agnostic to the underlying content structure.

Variations can be synchronized with some other element. If the implementation does not provide enhances synchronization capabilities (which it is free to do), it should synchronize with the element content.

The synchronization works by using the synchronization source, taking their content, optionally applying some rules and then updating the variation with that content.

How the synchronization source is defined and how the source content is processed is implementation specific. This API only provides means to manage the synchronization state and triggering the synchronization.

The synchronization state is represented by the SyncStatus enumeration.

Transactional behavior: The caller is responsible for committing the respective ResourceResolver after calling one or more methods that change a content fragment unless specified otherwise.

  • Method Details

    • getName

      String getName()
      Gets the (technical) name of the variation.
      Returns:
      The name of the variation
    • getTitle

      String getTitle()
      Gets the (human-readable) title of the variation.
      Returns:
      The title of the variation
    • setTitle

      void setTitle(String title) throws ContentFragmentException

      Sets the current title of the variation in the provided object representation.

      Parameters:
      title - The new title of the variation
      Throws:
      ContentFragmentException - if the provided value couldn't be persisted
    • getDescription

      String getDescription()
      Gets a description for the variation.
      Returns:
      The description
    • setDescription

      void setDescription(String description) throws ContentFragmentException

      Sets the current description of the variation in the provided object representation.

      Parameters:
      description - The new description of the variation
      Throws:
      ContentFragmentException - if the provided value couldn't be persisted
    • getValue

      FragmentData getValue()

      Gets the current value of the variation in a suitable object representation.

      Note that if you change the returned FragmentData, you will have to call setValue(FragmentData) explicitly after manipulating the value.

      DataType provides additional information about how values are handled by the system.

      Returns:
      The value
      Since:
      1.1
    • setValue

      void setValue(FragmentData object) throws ContentFragmentException

      Sets the current value of the variation in the provided object representation.

      Please see DataType for more information about what "object representation" means.

      Parameters:
      object - The value
      Throws:
      ContentFragmentException - if the provided value couldn't be persisted or doesn't match the data type of the variation
      Since:
      1.1
    • getContentType

      String getContentType()
      Gets the MIME type of the variation.
      Returns:
      The MIME type; refers to some text format
    • getContent

      String getContent()
      Gets the content of the variation in a suitable text representation.
      Returns:
      The content of the variation (in a text representation)
    • setContent

      void setContent(String content, String contentType) throws ContentFragmentException
      Sets the content of the variation from the provided text value.

      The specified content & its MIME type must be textual. What MIME types are eventually supported is left to the implementation.

      For non-textual data types (added in 1.1), a MIME type of text/plain should be specified. The implementation is then responsible for translating the provided text value into a suitable object representation (or throw a ContentFragmentException if this is not possible). How the text value is converted into a suitable object value is left to the implementation. But it is required that a value returned by getContent() can successfully be converted by setContent(String, String). In other words, el.setContent(el.getContent(), el.getContentType() must not throw a ContentFragmentException because of type conversion problems.

      Parameters:
      content - The content
      contentType - The MIME type of the content
      Throws:
      ContentFragmentException - if the content could not be written or the provided text could not be converted to the data type of the underlying element correctly
      IllegalArgumentException - if the specified MIME type is not supported or not a textual MIME type
    • getSyncStatus

      SyncStatus getSyncStatus()
      Gets the synchronization status of the variation.
      Returns:
      The synchronization state of the provided variation
    • synchronize

      void synchronize() throws ContentFragmentException

      Synchronizes the variation.

      Throws:
      ContentFragmentException - if the synchronization failed
    • getCreated

      @NotNull @NotNull Calendar getCreated()
      Gets the creation date for the variation.
      Returns:
      the creation date for the variation