Clearspace API (2.5.29) Core Javadocs

com.jivesoftware.community
Interface DocumentVersion


public interface DocumentVersion

Information about a document's version is stored and retrieved using this interface. Document versions consist of a version number unique to a document but not unique in the system, the author of the version, it's creation and last modification date and comments on the version.


Method Summary
 VersionComment createVersionComment(User author, String comment)
          Creates a new version comment.
 User getAuthor()
          Returns the user that authored the document version.
 Date getCreationDate()
          Returns the date the document version was created.
 Document getDocument()
          Returns the Document object corresponding to this version.
 DocumentState getDocumentState()
          Retrieve the document state for the version.
 Date getModificationDate()
          Returns the date the document version was last modified.
 int getVersionCommentCount()
          Returns the number of comments made on the document version.
 Iterable<VersionComment> getVersionComments()
          Returns an iterator of VersionComment objects for all the comments made on the document version.
 int getVersionNumber()
          Returns the version number of the version of the document.
 boolean isMinorVersion()
          Returns true if the revision this instance represents is a minor version.
 void setAuthor(User author)
          Returns the user that authored the document version.
 void setCreationDate(Date creationDate)
          Sets the creation date of the document version.
 void setDocumentState(DocumentState state)
          Sets the document state for the version.
 void setModificationDate(Date modificationDate)
          Sets the date the document was last modified.
 

Method Detail

getVersionNumber

int getVersionNumber()
Returns the version number of the version of the document. Version numbers may not be unique identifiers between documents and only should be used for identifying versions within a particular document.

Returns:
the version number.

getDocument

Document getDocument()
Returns the Document object corresponding to this version.

Returns:
the Document object corresponding to this version.

getAuthor

User getAuthor()
Returns the user that authored the document version. If the document version was created anonymously, this method will return null.

Returns:
the author of the document version.

setAuthor

void setAuthor(User author)
               throws UnauthorizedException
Returns the user that authored the document version. If the document version was created anonymously, this method will return null.

Parameters:
author - the user to change the ownership of the document version to.
Throws:
UnauthorizedException - if the user does not have permission to modify the document.

getCreationDate

Date getCreationDate()
Returns the date the document version was created.

Returns:
the date the document version was created.

setCreationDate

void setCreationDate(Date creationDate)
                     throws UnauthorizedException
Sets the creation date of the document version. In most cases, the creation date will default to when the document version was entered into the system. However, the creation date needs to be set manually when importing documents. In other words, skin authors should ignore this method since it is only intended for system maintenance.

Parameters:
creationDate - the date the document version was created.
Throws:
UnauthorizedException - if the user does not have administrator permissions.

getModificationDate

Date getModificationDate()
Returns the date the document version was last modified. When a document version is first created, the date returned by this method is identical to the creation date. The modified date is updated every time a document version is updated, such as if the document title was modified.

Returns:
the date the document version was last modified.

setModificationDate

void setModificationDate(Date modificationDate)
                         throws UnauthorizedException
Sets the date the document was last modified. In most cases, the last modifed date will default to when the document data was last changed. However, the last modified date needs to be set manually when importing documents. In other words, skin authors should ignore this method since it is only intended for system maintenance.

Parameters:
modificationDate - the date the document was modified.
Throws:
UnauthorizedException - if the user does not have administrator permissions.

getDocumentState

DocumentState getDocumentState()
Retrieve the document state for the version.

Returns:
the DocumentState for the version.

setDocumentState

void setDocumentState(DocumentState state)
                      throws UnauthorizedException,
                             DocumentAlreadyExistsException
Sets the document state for the version. Setting a state of DocumentState.PUBLISHED will cause any other version of the document in that state to be altered to have a state of DocumentState.ARCHIVED.

Setting a document state of DocumentState.PUBLISHED may cause a DocumentAlreadyExistsException to be thrown if the subject of the document is not unique among the published documents in the community the document is contained within.

Parameters:
state - the new state of the document.
Throws:
UnauthorizedException - if the user does not have permission to modify the document.
DocumentAlreadyExistsException - if the subject of the document is not unique in the community

getVersionCommentCount

int getVersionCommentCount()
Returns the number of comments made on the document version.

Returns:
the number of comments made on the document version.

getVersionComments

Iterable<VersionComment> getVersionComments()
Returns an iterator of VersionComment objects for all the comments made on the document version.

Returns:
an iterator of VersionComment objects for all the comments made on the document version.

createVersionComment

VersionComment createVersionComment(User author,
                                    String comment)
                                    throws UnauthorizedException
Creates a new version comment.

Parameters:
author - the comment author
comment - the comment string.
Returns:
a new VersionComment object corresponding to the newly created version comment.
Throws:
UnauthorizedException - if not authorized to create comments.

isMinorVersion

boolean isMinorVersion()
Returns true if the revision this instance represents is a minor version.

Returns:
true if the revision this instance represents is a minor version.

Clearspace Project Page

Copyright © 1999-2007 Jive Software.