Interface VersionableItem
- All Superinterfaces:
DeltaVItem
,HierarchyItem
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:
- Engine calls
putUnderVersionControl(boolean)
. Create new version, copy content and properties from this item to new version. - Engine calls
checkOut()
. Mark item as checked-out. - Engine calls
File.read(java.io.OutputStream, long, long)
orHierarchyItem.updateProperties(com.ithit.webdav.server.Property[], com.ithit.webdav.server.Property[])
. Modify item content and properties. - Engine calls
checkIn()
orunCheckOut()
. ForcheckIn()
- create new version, copy content and properties from this item to new version. ForunCheckOut()
- 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
Modifier and TypeMethodDescriptioncheckIn()
Creates new version.void
checkOut()
Allow modifications to the content and properties of this version-controlled item.boolean
Indicates if item will be checked-in by the engine during the unlock request.Determines how checked-in item responds to WebDAV client attempts to modify its content or properties.Current item version history.boolean
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
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 Details
-
getVersionHistory
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
Allow modifications to the content and properties of this version-controlled item.- Throws:
ServerException
- in case of an error.LockedException
-
unCheckOut
Cancels the checkout and restores the pre-checkout state of the version-controlled item.- Throws:
ServerException
- in case of an error.LockedException
-
updateToVersion
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
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
Sets auth versioning mode for this item.- Parameters:
value
- Auto versioning mode.- Throws:
ServerException
- in case of an error.LockedException
-
isCheckedOut
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
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
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 callscheckIn()
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
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 callscheckIn()
if necessary. This property is required for auto-versioning.- Parameters:
value
- Value of the flag.- Throws:
ServerException
- in case of an error.LockedException
-