Interface VersionableItem

All Superinterfaces:
DeltaVItem, HierarchyItem

public interface VersionableItem extends DeltaVItem
This interface must be implemented on items that support versioning.

By default items in the repository are not under version control. When item is being put under version control engine calls putUnderVersionControl(boolean) method passing true as a parameter. In your putUnderVersionControl(boolean) implementation you must create a new version. The content and properties of the new version must be copied from this item. After the call to putUnderVersionControl(boolean) getVersionHistory() method must return an object implementing History interface that will contain single version. The isCheckedOut() method must return false.

If item is under version control it mast always have at last one version in its versions list.

After the item had been put under version control client can issue checkout command. In your checkOut() implementation you will mark item as checked-out and allow item modifications. When item is in check-out state WebDAV client can issue commands updating item contents and properties.

Finally client issues check-in command or discards changes issuing uncheck-out command. In your checkIn() implementation you will create a new version. The content and properties of the new version must be copied from this item. The item must be marked as checked-in. In your unCheckOut() implementation you will discard changes and restore pre-checkout state. Content and properties must be copied from current version to this item. The item must be marked as checked-in.

The typical versioning workflow:

  1. Engine calls putUnderVersionControl(boolean). Create new version, copy content and properties from this item to new version.
  2. Engine calls checkOut(). Mark item as checked-out.
  3. Engine calls File.read(java.io.OutputStream, long, long) or HierarchyItem.updateProperties(com.ithit.webdav.server.Property[], com.ithit.webdav.server.Property[]). Modify item content and properties.
  4. Engine calls checkIn() or unCheckOut(). For checkIn() - create new version, copy content and properties from this item to new version. For unCheckOut() - copy content and properties from current version to this item. Mark item as checked-in.

In your updateToVersion(com.ithit.webdav.server.deltav.Version) implementation you will create a new version and copy content and properties from Version passed as a parameter to new version. You will also replace content and properties of this item. The new created version becomes current version. The updateToVersion(com.ithit.webdav.server.deltav.Version) method can only be called when item is in check-in state.

When item is being removed from version control engine calls putUnderVersionControl(boolean) method passing false as a parameter. In your implementation you will usually delete all versions. getVersionHistory() method must return null after this call.

  • Method Details

    • getVersionHistory

      History getVersionHistory() throws ServerException
      Current item version history. Null, if item is not under version control. If item is under version control it always has at last one version in its versions list.
      Returns:
      Item implementing History interface or null if item is not under version control.
      Throws:
      ServerException - In case of an error.
    • checkIn

      Creates new version. Copies all properties and content from this item.
      Returns:
      Url of the newly created version.
      Throws:
      ServerException - In case of an error.
      LockedException
    • checkOut

      void checkOut() throws ServerException, LockedException
      Allow modifications to the content and properties of this version-controlled item.
      Throws:
      ServerException - in case of an error.
      LockedException
    • unCheckOut

      void unCheckOut() throws ServerException, LockedException
      Cancels the checkout and restores the pre-checkout state of the version-controlled item.
      Throws:
      ServerException - in case of an error.
      LockedException
    • updateToVersion

      void updateToVersion(Version version) throws ServerException, LockedException
      Updates content and properties of the item to those identified by version parameter.
      Parameters:
      version - Version that contains reference properties and content.
      Throws:
      ServerException - in case of an error.
      LockedException
    • getAutoVersion

      AutoVersion getAutoVersion() throws ServerException
      Determines how checked-in item responds to WebDAV client attempts to modify its content or properties.
      Returns:
      One of AutoVersion enum values.
      Throws:
      ServerException - in case of an error.
    • setAutoVersion

      void setAutoVersion(AutoVersion value) throws ServerException, LockedException
      Sets auth versioning mode for this item.
      Parameters:
      value - Auto versioning mode.
      Throws:
      ServerException - in case of an error.
      LockedException
    • isCheckedOut

      boolean isCheckedOut() throws ServerException
      Determines whether item is in checked-in or checked-out state.
      Returns:
      Boolean value indicating if item is in checked-out state.
      Throws:
      ServerException - in case of an error.
    • putUnderVersionControl

      void putUnderVersionControl(boolean enable) throws ServerException, LockedException
      Puts or removes current item from version control.
      Parameters:
      enable - True to enable version control, false - to disable.
      Throws:
      ServerException - in case of an error.
      LockedException
    • getAutoCheckIn

      boolean getAutoCheckIn() throws ServerException
      Indicates if item will be checked-in by the engine during the unlock request. Before checking-out the engine sets this property. When item is being unlocked engine reads this property and calls checkIn() if necessary. This property is required for auto-versioning.
      Returns:
      If item will be checked-in by the engine during the unlock request.
      Throws:
      ServerException - in case of an error.
    • setAutoCheckIn

      void setAutoCheckIn(boolean value) throws ServerException, LockedException
      Sets flag which indicates if item will be checked-in by the engine during the unlock request. Before checking-out the engine sets this property. When item is being unlocked engine reads this property and calls checkIn() if necessary. This property is required for auto-versioning.
      Parameters:
      value - Value of the flag.
      Throws:
      ServerException - in case of an error.
      LockedException