Interface Versionable<T>

All Known Subinterfaces:
ContentElement, ContentFragment, ContentVariation

public interface Versionable<T>
Implementations of this interface provide means to version their content.
  • Method Details

    • createVersion

      VersionDef createVersion(String label, String comment) throws ContentFragmentException
      Creates a new version of the implementing element.

      Transactional behavior: All previous changes to the entire content fragment need to be committed before this method is called. The method will also commit all required changes, so the caller does not have to explicitly commit the respective ResourceResolver.

      Parameters:
      label - The label
      comment - A comment
      Returns:
      Definition of the newly created version
      Throws:
      ContentFragmentException - if the element could not be versioned
      IllegalStateException - if the required transactional prerequisites are not met, for example if the respective ResourceResolver has pending/uncommitted changes
    • listVersions

      Creates an iterator on the versions that are available for the implementing element.

      The list does not contain the "current" version of the element itself, only archived versions.

      Returns:
      Iterator on available versions
      Throws:
      ContentFragmentException - if the version history could not be created
    • getVersionedContent

      @Deprecated VersionedContent getVersionedContent(VersionDef version) throws ContentFragmentException
      Deprecated.

      Gets the content of the version of the implementing element that is specified by the provided VersionDef.

      The VersionDef should match one of those returned by listVersions().

      Parameters:
      version - The version definition
      Returns:
      The versioned content
      Throws:
      ContentFragmentException - if the version content could not be determined or an invalid version definition was provided
    • getVersion

      T getVersion(VersionDef versionDef) throws ContentFragmentException
      Retrieves the implementing element in a version specified by versionDef
      Parameters:
      versionDef - The version definition
      Returns:
      A read-only versioned resource that cannot be altered through the object's setters, and does not support further versioning
      Throws:
      ContentFragmentException - if the versioned resource could not be retrieved