com.ithit.webdav.server.deltav
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 Summary
 java.lang.String checkIn()
          Creates new version.
 void checkOut()
          Allow modifications to the content and properties of this version-controlled item.
 boolean getAutoCheckIn()
          Indicates if item will be checked-in by the engine during the unlock request.
 AutoVersion getAutoVersion()
          Determines how checked-in item responds to WebDAV client attempts to modify its content or properties.
 History getVersionHistory()
          Current item version history.
 boolean isCheckedOut()
          Determines whether item is in checked-in or checked-out state.
 void putUnderVersionControl(boolean enable)
          Puts or removes current item from version control.
 void setAutoCheckIn(boolean value)
          Sets flag which indicates if item will be checked-in by the engine during the unlock request.
 void setAutoVersion(AutoVersion value)
          Sets auth versioning mode for this item.
 void unCheckOut()
          Cancels the checkout and restores the pre-checkout state of the version-controlled item.
 void updateToVersion(Version version)
          Updates content and properties of the item to those identified by version parameter.
 
Methods inherited from interface com.ithit.webdav.server.deltav.DeltaVItem
getComment, getCreatorDisplayName, setComment, setCreatorDisplayName
 
Methods inherited from interface com.ithit.webdav.server.HierarchyItem
copyTo, delete, getCreated, getModified, getName, getPath, getProperties, getPropertyNames, moveTo, updateProperties
 

Method Detail

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

java.lang.String checkIn()
                         throws ServerException
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.

checkOut

void checkOut()
              throws ServerException
Allow modifications to the content and properties of this version-controlled item.

Throws:
ServerException - in case of an error.

unCheckOut

void unCheckOut()
                throws ServerException
Cancels the checkout and restores the pre-checkout state of the version-controlled item.

Throws:
ServerException - in case of an error.

updateToVersion

void updateToVersion(Version version)
                     throws ServerException
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.

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
Sets auth versioning mode for this item.

Parameters:
value - auto versioning mode.
Throws:
ServerException - in case of an error.

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

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


Copyright © 2009 ITHit. All Rights Reserved.