Package com.logicaldoc.core.document
Class Version
- java.lang.Object
-
- com.logicaldoc.core.PersistentObject
-
- com.logicaldoc.core.metadata.ExtensibleObject
-
- com.logicaldoc.core.document.AbstractDocument
-
- com.logicaldoc.core.document.Version
-
- All Implemented Interfaces:
TransactionalObject
,Comparable<Version>
public class Version extends AbstractDocument implements Comparable<Version>
This class represents versions.- Version:
- 1.0
- Author:
- Marco Meschieri - LogicalDOC
-
-
Field Summary
-
Fields inherited from class com.logicaldoc.core.document.AbstractDocument
DOC_ARCHIVED, DOC_CHECKED_OUT, DOC_LOCKED, DOC_UNLOCKED, EXPORT_LOCKED, EXPORT_UNLOCKED, INDEX_INDEXED, INDEX_SKIP, INDEX_TO_INDEX, INDEX_TO_INDEX_METADATA, NATURE_DOC, NATURE_FORM
-
Fields inherited from class com.logicaldoc.core.PersistentObject
DELETED_CODE_DEFAULT, DELETED_CODE_STRONG
-
-
Constructor Summary
Constructors Constructor Description Version()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
calculateNewVersion(String oldVersionName, boolean major)
Calculate the new version name in the format X.Y.Object
clone()
Clones the document but does not replicate the CustomIDint
compareTo(Version other)
static Version
create(Document document, User user, String comment, String 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 persistentString
getCreator()
long
getCreatorId()
long
getDocId()
String
getEvent()
long
getFolderId()
String
getFolderName()
Long
getTemplateId()
long
getUserId()
String
getUsername()
Date
getVersionDate()
void
setCreator(String creator)
void
setCreatorId(long creatorId)
void
setDocId(long docId)
void
setEvent(String event)
void
setFolderId(long folderId)
void
setFolderName(String folderName)
void
setTemplateId(Long templateId)
void
setUserId(long userId)
void
setUsername(String username)
void
setVersionDate(Date versionDate)
String
toString()
-
Methods inherited from class com.logicaldoc.core.document.AbstractDocument
addTag, clearTags, copyAttributes, getBarcoded, getBarcodeTemplateId, getComment, getCreation, getCustomId, getDate, getDecodedPassword, getDeleteUser, getDeleteUserId, getDigest, getDocRef, getDocRefType, getExportId, getExportName, getExportStatus, getExportVersion, getExtResId, getFileExtension, getFileName, getFileSize, getFileVersion, getFolder, getFormId, getIcon, getImmutable, getIndexed, getLanguage, getLinks, getLocale, getLockUser, getLockUserId, getNature, getOcrd, getOcrTemplateId, getPages, getPassword, getPublished, getPublisher, getPublisherId, getRating, getSigned, getStamped, getStartPublishing, getStatus, getStopPublishing, getTags, getTagsAsWords, getTagsString, getTemplate, getTemplateName, getTgs, getTitle, getTransactionId, getType, getVersion, getWorkflowStatus, getWorkflowStatusDisplay, isGranted, isModified, isPasswordProtected, isPublishing, isToIndex, setBarcoded, setBarcodeTemplateId, setComment, setCreation, setCustomId, setDate, setDecodedPassword, setDeleteUser, setDeleteUserId, setDigest, setDocRef, setDocRefType, setExportId, setExportName, setExportStatus, setExportVersion, setExtResId, setFileName, setFileSize, setFileVersion, setFolder, setFormId, setImmutable, setIndexed, setLanguage, setLinks, setLocale, setLockUser, setLockUserId, setModified, setNature, setOcrd, setOcrTemplateId, setPages, setPassword, setPublished, setPublisher, setPublisherId, setRating, setSigned, setStamped, setStartPublishing, setStatus, setStopPublishing, setTags, setTagsFromWords, setTemplate, setTemplateName, setTgs, setTransactionId, setType, setVersion, setWorkflowStatus, setWorkflowStatusDisplay
-
Methods inherited from class com.logicaldoc.core.metadata.ExtensibleObject
getAttribute, getAttributeAtPosition, getAttributeNames, getAttributeNames, getAttributes, getValue, getValueAttributes, getValues, removeAttribute, setAttribute, setAttributes, setValue, setValues
-
Methods inherited from class com.logicaldoc.core.PersistentObject
equals, getDeleted, getId, getLastModified, getRecordVersion, getTenantId, hashCode, setDeleted, setId, setLastModified, setRecordVersion, setTenantId
-
-
-
-
Method Detail
-
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.Ymajor
- 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 interfaceComparable<Version>
-
toString
public String toString()
- Overrides:
toString
in classAbstractDocument
-
getVersionDate
public Date getVersionDate()
-
setVersionDate
public void setVersionDate(Date versionDate)
-
getFolderId
public long getFolderId()
-
setFolderId
public void setFolderId(long folderId)
-
getFolderName
public String getFolderName()
-
setFolderName
public void setFolderName(String folderName)
-
getTemplateId
public Long getTemplateId()
-
setTemplateId
public void setTemplateId(Long templateId)
-
create
public static Version create(Document document, User user, String comment, String 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 versioneduser
- The user who made the changescomment
- The version commentevent
- The event that caused the new releaserelease
- True if this is a new release(eg: 2.0) rather than a subversion(eg: 1.1)- Returns:
- The newly created version
-
getEvent
public String getEvent()
-
setEvent
public void setEvent(String event)
-
getCreator
public String getCreator()
- Overrides:
getCreator
in classAbstractDocument
-
setCreator
public void setCreator(String creator)
- Overrides:
setCreator
in classAbstractDocument
-
getCreatorId
public long getCreatorId()
- Overrides:
getCreatorId
in classAbstractDocument
-
setCreatorId
public void setCreatorId(long creatorId)
- Overrides:
setCreatorId
in classAbstractDocument
-
getDocId
public long getDocId()
-
setDocId
public void setDocId(long docId)
-
clone
public Object clone() throws CloneNotSupportedException
Clones the document but does not replicate the CustomID- Throws:
CloneNotSupportedException
-
-