Daisy Open Source CMS

org.outerj.daisy.repository
Interface Version

All Superinterfaces:
VersionedData

public interface Version
extends VersionedData

A version of a Document.

This object provides access to the all versioned information of a document, for a specific version of the document. Versions cannot be modified (except their state, see below), they are read-only. See Document.save() for when a version is created.

A version can have a state of either 'publish' or 'draft'. This state can be changed at any time.


Method Summary
 String getChangeComment()
          Returns the change comment for this version (can be null).
 ChangeType getChangeType()
          Returns the change type for this version (never null).
 Date getCreated()
          Returns the date when this version was created.
 long getCreator()
          Returns the id of the user that created this version.
 long getId()
          The id of the version, which is a sequence number, the first version being 1, then 2, and so on.
 Date getLastModified()
          Get the time at which the state of this version was last changed.
 long getLastModifier()
          Get the id of the user that last changed the state of this version.
 org.outerx.daisy.x10.VersionDocument getShallowXml()
          Get an XML document containing information about this version, but without the actual versioned content, thus no fields, parts, links etc.
 VersionState getState()
          Returns the current state of this version.
 VersionKey getSyncedWith()
          Returns a VersionKey that identifies the version that this version was synced to.
 long getTotalSizeOfParts()
          Get the sum of the size of the parts in this version.
 org.outerx.daisy.x10.VersionDocument getXml()
          Get an XML document describing the version.
 void save()
          Saves changes made to the metadata of this version (versionState, syncedWith, changeType and changeComment).
 void setChangeComment(String changeComment)
          Changes the change comment for this version.
 void setChangeType(ChangeType changeType)
          Changes the change type for this version.
 void setState(VersionState state)
          Changes the state of this version.
 void setSyncedWith(long languageId, long versionId)
          Changes the 'synced with' field for this version.
 void setSyncedWith(VersionKey syncedWith)
          Sets the 'synced with' pointer by specifying a VersionKey object.
 
Methods inherited from interface org.outerj.daisy.repository.VersionedData
getDocumentName, getField, getField, getFields, getFieldsInOrder, getLinks, getPart, getPart, getParts, getPartsInOrder, hasField, hasField, hasPart, hasPart
 

Method Detail

getId

long getId()
The id of the version, which is a sequence number, the first version being 1, then 2, and so on.


getCreated

Date getCreated()
Returns the date when this version was created.


getCreator

long getCreator()
Returns the id of the user that created this version. You can retrieve full information on the user via the UserManager.


getShallowXml

org.outerx.daisy.x10.VersionDocument getShallowXml()
Get an XML document containing information about this version, but without the actual versioned content, thus no fields, parts, links etc. This is useful when retrieving an overview of all versions of a document.


getXml

org.outerx.daisy.x10.VersionDocument getXml()
                                            throws RepositoryException
Get an XML document describing the version.

Throws:
RepositoryException

setState

void setState(VersionState state)
Changes the state of this version.

Sinced daisy 2.2, this method no longer has immediate effect, you need to call version.save() to make the change permanent.


getState

VersionState getState()
Returns the current state of this version. This is the state as it was when this version object was loaded, it may have changed in the meantime.


setSyncedWith

void setSyncedWith(long languageId,
                   long versionId)
                   throws RepositoryException
Changes the 'synced with' field for this version. The purpose of this field is for translation management, it indicates that the data in this version is translated content which is up to date with a certain version of some other (reference) language.

This method does not have immediate effect. You need to call version.save() to make the change permanent.

To clear the 'synced with' field, specify -1 for languageId and versionId.

Throws:
IllegalArgumentException - if exactly one of languageId and versionId is -1 or versionId < 0
RepositoryException - if the languageId!=-1 and the language does not exist
Since:
daisy 2.2

setSyncedWith

void setSyncedWith(VersionKey syncedWith)
                   throws RepositoryException
Sets the 'synced with' pointer by specifying a VersionKey object. Only the language ID and version ID fields of the VersionKey object are significant. The syncedWith argument can be null.

Throws:
RepositoryException

getSyncedWith

VersionKey getSyncedWith()
Returns a VersionKey that identifies the version that this version was synced to. Returns null if not set.


setChangeType

void setChangeType(ChangeType changeType)
                   throws RepositoryException
Changes the change type for this version.

This method does not have immediate effect. You need to call version.save() to make the change permanent.

The change type indicates if the version contains major or minor changes.

When using translation management, the change type is used to indicate that a version contains changes which render translations invalid. So if a user makes changes to a version, even though these might seem minor, but which should be replicated in translations, than the change type should be set to major (when using translation management, otherwise you can assign your own meaning to this field).

Throws:
RepositoryException
Since:
daisy 2.2

getChangeType

ChangeType getChangeType()
Returns the change type for this version (never null).


setChangeComment

void setChangeComment(String changeComment)
                      throws RepositoryException
Changes the change comment for this version.

This method does not have immediate effect. You need to call version.save() to make the change permanent.

Parameters:
changeComment - the comment text, can be null to clear the change comment
Throws:
RepositoryException

getChangeComment

String getChangeComment()
Returns the change comment for this version (can be null).


save

void save()
          throws RepositoryException
Saves changes made to the metadata of this version (versionState, syncedWith, changeType and changeComment).

Throws:
RepositoryException

getLastModifier

long getLastModifier()
Get the id of the user that last changed the state of this version.


getLastModified

Date getLastModified()
Get the time at which the state of this version was last changed.


getTotalSizeOfParts

long getTotalSizeOfParts()
Get the sum of the size of the parts in this version.


Daisy Open Source CMS