org.outerj.daisy.repository
Interface Version


public interface Version

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.

The methods getParts(), getFields() and getLinks() can throw a RepositoryException because that information may sometimes be loaded lazily (depending on the implementation).

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


Method Summary
 java.util.Date getCreated()
          Returns the date when this version was created.
 long getCreator()
          Returns the id of the user that created this version.
 java.lang.String getDocumentName()
          Returns the name of the document as it was on the time this version was created.
 Field getField(long fieldTypeId)
          Get a field by id.
 Fields getFields()
          Returns the fields contained in this version.
 Fields getFieldsInOrder()
          Returns the fields contained in this version, in the order as they are defined in the document type of the document.
 long getId()
          The id of the version, which is a sequence number, the first version being 1, then 2, and so on.
 Links getLinks()
          Get the links.
 Part getPart(long typeId)
          Get a part by id.
 Part getPart(java.lang.String typeName)
          Get a part by name.
 Parts getParts()
          Returns the parts contained in this version.
 Parts getPartsInOrder()
          Returns the parts contained in this version, in the order as they are defined in the document type of the document.
 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.
 java.util.Date getStateLastModified()
          Get the time at which the state of this version was last changed.
 long getStateLastModifier()
          Get the id of the user that last changed the state of this version.
 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.
 boolean hasField(long fieldTypeId)
          Checks if this version has a certain field.
 boolean hasPart(long typeId)
          Checks if this version has a certain part.
 boolean hasPart(java.lang.String typeName)
          Checks if this version has a certain part.
 void setState(VersionState state)
          Changes the state of this version.
 

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

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


getDocumentName

java.lang.String getDocumentName()
Returns the name of the document as it was on the time this version was created.


getParts

Parts getParts()
               throws RepositoryException
Returns the parts contained in this version.

Throws:
RepositoryException

getPartsInOrder

Parts getPartsInOrder()
                      throws RepositoryException
Returns the parts contained in this version, in the order as they are defined in the document type of the document. Any parts contained in this version that are not present in the current document type are returned in no specific order, but after the ordered parts.

Throws:
RepositoryException

getPart

Part getPart(long typeId)
Get a part by id.

Throws a PartNotFoundException if this version has no part with the specified id. Use hasPart(long) to check if this version has the wanted part.


hasPart

boolean hasPart(long typeId)
Checks if this version has a certain part.


hasPart

boolean hasPart(java.lang.String typeName)
Checks if this version has a certain part.


getPart

Part getPart(java.lang.String typeName)
             throws RepositoryException
Get a part by name.

Throws a PartNotFoundException if this version has not part with the specified name.

Throws:
RepositoryException

getFields

Fields getFields()
                 throws RepositoryException
Returns the fields contained in this version.

Throws:
RepositoryException

getFieldsInOrder

Fields getFieldsInOrder()
                        throws RepositoryException
Returns the fields contained in this version, in the order as they are defined in the document type of the document. Any fields contained in this version that are not present in the current document type are returned in no specific order, but after the ordered fields.

Throws:
RepositoryException

getField

Field getField(long fieldTypeId)
               throws FieldNotFoundException
Get a field by id.

Throws a FieldNotFoundException if this version has no field with the specified id. Use hasField(long) to check if this version has the wanted field.

Throws:
FieldNotFoundException

hasField

boolean hasField(long fieldTypeId)
Checks if this version has a certain field.


getLinks

Links getLinks()
               throws RepositoryException
Get the links.

Throws:
RepositoryException

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)
              throws RepositoryException
Changes the state of this version.

This method has immediate effect, it is not needed to call document.save() after calling this method.

Throws:
RepositoryException

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.


getStateLastModifier

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


getStateLastModified

java.util.Date getStateLastModified()
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.



Copyright © -2012 . All Rights Reserved.