Package com.logicaldoc.core.document

# Class Version

java.lang.Object
com.logicaldoc.core.PersistentObject
com.logicaldoc.core.metadata.ExtensibleObject
com.logicaldoc.core.filler.Fillable
com.logicaldoc.core.document.AbstractDocument
com.logicaldoc.core.document.Version

All Implemented Interfaces:
  `Extensible`, `TransactionalObject`, `Serializable`, `Comparable<Version>`

@Entity public class Version extends AbstractDocument implements Comparable<Version>
This class represents versions.

Version:
  1.0
Author:
  Marco Meschieri - LogicalDOC
See Also:
  - Serialized Form

## Field Summary

### Fields inherited from class com.logicaldoc.core.document.AbstractDocument

`EXPORT_LOCKED, EXPORT_UNLOCKED, NATURE_DOC`

### Fields inherited from class com.logicaldoc.core.PersistentObject

`DELETED_CODE_DEFAULT, DELETED_CODE_STRONG, id`

## Constructor Summary

Constructors
Constructor
Description
`Version()`
`Version(Version source)`

## Method Summary

Modifier and Type
Method
Description
`static String`
`calculateNewVersion(String oldVersionName, boolean major)`
Calculate the new version name in the format X.Y.
`int`
`compareTo(Version other)`
`static Version`
`create(Document document, User user, String comment, DocumentEvent event, boolean release)`
Factory method that creates a Version and replicate all given document's properties.
The new version and fileVersion will be set in both Document and Version
Important: The created Version is not persistent
`boolean`
`equals(Object obj)`
`Map<String,Attribute>`
`getAttributes()`
`String`
`getCreator()`
`long`
`getCreatorId()`
`long`
`getDocId()`
`String`
`getEvent()`
`DocumentEvent`
`getEventEnum()`
`long`
`getFolderId()`
`String`
`getFolderName()`
`Template`
`getTemplate()`
`Long`
`getTemplateId()`
`String`
`getTemplateName()`
`long`
`getUserId()`
`String`
`getUsername()`
`Date`
`getVersionDate()`
`int`
`hashCode()`
`void`
`setAttributes(Map<String,Attribute> attributes)`
`void`
`setCreator(String creator)`
`void`
`setCreatorId(long creatorId)`
`void`
`setDocId(long docId)`
`void`
`setEvent(DocumentEvent event)`
`void`
`setFolderId(long folderId)`
`void`
`setFolderName(String folderName)`
`void`
`setTemplate(Template template)`
`void`
`setTemplateId(Long templateId)`
`void`
`setTemplateName(String templateName)`
`void`
`setUserId(long userId)`
`void`
`setUsername(String username)`
`void`
`setVersionDate(Date versionDate)`
`String`
`toString()`

### Methods inherited from class com.logicaldoc.core.document.AbstractDocument

`copyAttributes, getBarcodeTemplateId, getColor, getComment, getCustomId, getDate, getDecodedPassword, getDeleteUserId, getDigest, getDocAttrs, getEmbeddingStatus, getExportId, getExportName, getExportStatus, getExportVersion, getExtResId, getFileExtension, getFileName, getFileSize, getFileVersion, getFormId, getIcon, getIndexed, getIndexingStatus, getLanguage, getLastNote, getLinks, getLocale, getLockUser, getLockUserId, getNature, getOcrTemplateId, getPages, getPassword, getPreviewPages, getPublisher, getPublisherId, getRevision, getStartPublishing, getStatus, getStopPublishing, getTgs, getTitle, getTransactionId, getType, getVersion, getWorkflowStatus, getWorkflowStatusDisplay, isBarcoded, isGranted, isImmutable, isModified, isOcrd, isPasswordProtected, isPublished, isPublishing, isSigned, isStamped, isToIndex, setBarcoded, setBarcodeTemplateId, setColor, setComment, setCustomId, setDate, setDecodedPassword, setDeleteUserId, setDigest, setDocAttrs, setEmbeddingStatus, setExportId, setExportName, setExportStatus, setExportVersion, setExtResId, setFileName, setFileSize, setFileVersion, setFormId, setImmutable, setIndexingStatus, setIndexingStatus, setLanguage, setLastNote, setLinks, setLocale, setLockUser, setLockUserId, setModified, setNature, setOcrd, setOcrTemplateId, setPages, setPassword, setPreviewPages, setPublished, setPublisher, setPublisherId, setRevision, setSigned, setStamped, setStartPublishing, setStatus, setStatus, setStopPublishing, setTagsFromWords, setTgs, setTransactionId, setType, setVersion, setWorkflowStatus, setWorkflowStatusDisplay`

### Methods inherited from class com.logicaldoc.core.filler.Fillable

`getFillerId, setFillerId`

### Methods inherited from class com.logicaldoc.core.metadata.ExtensibleObject

`getAttribute, getAttributeAtPosition, getAttributeNames, getAttributeNames, getValue, getValueAttributes, getValues, removeAttribute, setAttribute, setValue, setValues`

### Methods inherited from class com.logicaldoc.core.PersistentObject

`getCreation, getDeleted, getId, getLastModified, getRecordVersion, getTenantId, setCreation, setDeleted, setId, setLastModified, setRecordVersion, setTenantId`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### Version

public Version()

### Version

public Version(Version source)

## Method Details

### getAttributes

public Map<String,Attribute> getAttributes()

Specified by:
  `getAttributes` in interface `Extensible`

### setAttributes

public void setAttributes(Map<String,Attribute> attributes)

Specified by:
  `setAttributes` in interface `Extensible`

### getUserId

public long getUserId()

### setUserId

public void setUserId(long userId)

### getUsername

public String getUsername()

### setUsername

public void setUsername(String username)

### calculateNewVersion

public static String calculateNewVersion(String oldVersionName, boolean major)
Calculate the new version name in the format X.Y.

Parameters:
  `oldVersionName` - the old version in the format X.Y
  `major` - if the new version is a major release or not
Returns:
  the new version name in the format X.Y
See Also:
  - `getNewVersionName(String, boolean)`

### compareTo

public int compareTo(Version other)

Specified by:
  `compareTo` in interface `Comparable<Version>`

### toString

public String toString()

Overrides:
  `toString` in class `AbstractDocument`

### getVersionDate

public Date getVersionDate()

### setVersionDate

public void setVersionDate(Date versionDate)

### getFolderId

public long getFolderId()

Specified by:
  `getFolderId` in class `AbstractDocument`

### setFolderId

public void setFolderId(long folderId)

### getFolderName

public String getFolderName()

### setFolderName

public void setFolderName(String folderName)

### getTemplateName

public String getTemplateName()

Specified by:
  `getTemplateName` in interface `Extensible`
Overrides:
  `getTemplateName` in class `AbstractDocument`

### setTemplateName

public void setTemplateName(String templateName)

Specified by:
  `setTemplateName` in interface `Extensible`
Overrides:
  `setTemplateName` in class `AbstractDocument`

### create

public static Version create(Document document, User user, String comment, DocumentEvent event, boolean release)
Factory method that creates a Version and replicate all given document's properties.
The new version and fileVersion will be set in both Document and Version
Important: The created Version is not persistent

Parameters:
  `document` - The document to be versioned
  `user` - The user who made the changes
  `comment` - The version comment
  `event` - The event that caused the new release
  `release` - True if this is a new release(eg: 2.0) rather than a subversion(eg: 1.1)
Returns:
  The newly created version

### setEvent

public void setEvent(DocumentEvent event)

### getEventEnum

public DocumentEvent getEventEnum()

### getEvent

public String getEvent()

### getCreator

public String getCreator()

Overrides:
  `getCreator` in class `AbstractDocument`

### setCreator

public void setCreator(String creator)

Overrides:
  `setCreator` in class `AbstractDocument`

### getCreatorId

public long getCreatorId()

Overrides:
  `getCreatorId` in class `AbstractDocument`

### setCreatorId

public void setCreatorId(long creatorId)

Overrides:
  `setCreatorId` in class `AbstractDocument`

### getDocId

public long getDocId()

### setDocId

public void setDocId(long docId)

### getTemplateId

public Long getTemplateId()

Specified by:
  `getTemplateId` in interface `Extensible`
Overrides:
  `getTemplateId` in class `AbstractDocument`

### setTemplateId

public void setTemplateId(Long templateId)

Specified by:
  `setTemplateId` in interface `Extensible`
Overrides:
  `setTemplateId` in class `AbstractDocument`

### getTemplate

public Template getTemplate()

Specified by:
  `getTemplate` in interface `Extensible`

### setTemplate

public void setTemplate(Template template)

Specified by:
  `setTemplate` in interface `Extensible`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `AbstractDocument`

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `AbstractDocument`