Package com.logicaldoc.core.document
Class AbstractDocument
- java.lang.Object
-
- com.logicaldoc.core.PersistentObject
-
- com.logicaldoc.core.metadata.ExtensibleObject
-
- com.logicaldoc.core.document.AbstractDocument
-
- All Implemented Interfaces:
TransactionalObject,Serializable
public abstract class AbstractDocument extends ExtensibleObject implements TransactionalObject
The Document is the central entity of LogicalDOC. A Document is a persistent business object and represents metadata over a single file stored into the DMS.Each document has one or more Versions. The most recent version is the one used as default when we refer to a Document, but all previous versions are accessible from the history even if the are not indexed.
Each Version carries out two main informations, the version code itself that is called simply 'version', and the file version, called 'fileVersion'. The first identified the Version itself while the second refers to the file content. In general not all updates to a document involves the upload of a new file. A Document is written in a single language, this language defines the full-text index in which the document's content will be stored.
- Since:
- 4.5
- Author:
- Marco Meschieri - LogicalDOC
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intDOC_ARCHIVEDstatic intDOC_CHECKED_OUTstatic intDOC_LOCKEDstatic intDOC_UNLOCKEDstatic intEXPORT_LOCKEDstatic intEXPORT_UNLOCKEDstatic intINDEX_INDEXEDstatic intINDEX_SKIPstatic intINDEX_TO_INDEXstatic intINDEX_TO_INDEX_METADATAstatic intNATURE_DOC-
Fields inherited from class com.logicaldoc.core.PersistentObject
DELETED_CODE_DEFAULT, DELETED_CODE_STRONG
-
-
Constructor Summary
Constructors Constructor Description AbstractDocument()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTag(String word)voidclearTags()voidcopyAttributes(AbstractDocument docVO)Copies in the current instance the attributes of the passed values object, but NOT the IDintgetBarcoded()LonggetBarcodeTemplateId()StringgetColor()StringgetComment()DategetCreation()The document's creation dateStringgetCreator()longgetCreatorId()StringgetCustomId()Each document can be identified with a custom identifierDategetDate()The document's last publication date.StringgetDecodedPassword()StringgetDeleteUser()LonggetDeleteUserId()StringgetDigest()The document's digestLonggetDocRef()If the document is an alias, it is the id of the referenced documentStringgetDocRefType()LonggetExportId()The last archive in which the document was exportedStringgetExportName()The last archive name in which the document was exportedintgetExportStatus()The document export statusStringgetExportVersion()The last exported versionStringgetExtResId()StringgetFileExtension()StringgetFileName()The original file namelonggetFileSize()The document's file size expressed in bytesStringgetFileVersion()The working file version.FoldergetFolder()Retrieve the folder owning this documentLonggetFormId()StringgetIcon()The icon for this document, it may be kept from file name extensionintgetImmutable()Defines if the document is immutableintgetIndexed()StringgetLanguage()The document's language.intgetLinks()LocalegetLocale()StringgetLockUser()LonggetLockUserId()The id of the user that locked this document and that currently locks itintgetNature()intgetOcrd()LonggetOcrTemplateId()intgetPages()StringgetPassword()intgetPreviewPages()intgetPublished()StringgetPublisher()The username that published this documentlonggetPublisherId()The user id of the user that published this documentIntegergetRating()intgetSigned()Return 1 if the document was signedintgetStamped()DategetStartPublishing()intgetStatus()The document statusDategetStopPublishing()Set<Tag>getTags()The set of tags for this document.Set<String>getTagsAsWords()StringgetTagsString()StringgetTgs()StringgetTitle()Computes the title that is the file name without the extensionStringgetTransactionId()Gets the unique ID of the transactionStringgetType()The document type, that is the file extensionStringgetVersion()The working version (the most recent version)StringgetWorkflowStatus()StringgetWorkflowStatusDisplay()booleanisGranted(String myPassword)Checks if the document is accessible with the given passwordbooleanisModified()booleanisPasswordProtected()booleanisPublishing()booleanisToIndex()voidsetBarcoded(int barcoded)voidsetBarcodeTemplateId(Long barcodeTemplateId)voidsetColor(String color)voidsetComment(String comment)voidsetCreation(Date creation)voidsetCreator(String creator)voidsetCreatorId(long creatorId)voidsetCustomId(String customId)voidsetDate(Date date)voidsetDecodedPassword(String pwd)Sets the password and encode itvoidsetDeleteUser(String deleteUser)voidsetDeleteUserId(Long deleteUserId)voidsetDigest(String digest)voidsetDocRef(Long docRef)voidsetDocRefType(String docRefType)voidsetExportId(Long exportId)voidsetExportName(String exportName)voidsetExportStatus(int exportStatus)voidsetExportVersion(String exportVersion)voidsetExtResId(String extResId)voidsetFileName(String fileName)voidsetFileSize(long fileSize)voidsetFileVersion(String fileVersion)voidsetFolder(Folder folder)voidsetFormId(Long formId)voidsetImmutable(int immutable)voidsetIndexed(int indexed)voidsetLanguage(String language)voidsetLinks(int links)voidsetLocale(Locale locale)voidsetLockUser(String lockUser)voidsetLockUserId(Long lockUserId)voidsetModified(boolean modified)voidsetNature(int nature)voidsetOcrd(int ocrd)voidsetOcrTemplateId(Long ocrTemplateId)voidsetPages(int pages)voidsetPassword(String password)voidsetPreviewPages(int previewPages)voidsetPublished(int published)voidsetPublisher(String publisher)voidsetPublisherId(long publisherId)voidsetRating(Integer rating)voidsetSigned(int signed)voidsetStamped(int stamped)voidsetStartPublishing(Date startPublishing)voidsetStatus(int status)voidsetStopPublishing(Date stopPublishing)voidsetTags(Set<Tag> tags)voidsetTagsFromWords(Set<String> tgs)voidsetTgs(String tgs)voidsetTransactionId(String transactionId)Sets the transaction's identifiervoidsetType(String type)voidsetVersion(String version)Iterates over the versions searching for the specified idvoidsetWorkflowStatus(String workflowStatus)voidsetWorkflowStatusDisplay(String workflowStatusDisplay)StringtoString()-
Methods inherited from class com.logicaldoc.core.metadata.ExtensibleObject
getAttribute, getAttributeAtPosition, getAttributeNames, getAttributeNames, getAttributes, getTemplate, getTemplateId, getTemplateName, getValue, getValueAttributes, getValues, removeAttribute, setAttribute, setAttributes, setTemplate, setTemplateId, setTemplateName, setValue, setValues, setValues
-
Methods inherited from class com.logicaldoc.core.PersistentObject
equals, getDeleted, getId, getLastModified, getRecordVersion, getTenantId, hashCode, setDeleted, setId, setLastModified, setRecordVersion, setTenantId
-
-
-
-
Field Detail
-
DOC_UNLOCKED
public static final int DOC_UNLOCKED
- See Also:
- Constant Field Values
-
DOC_CHECKED_OUT
public static final int DOC_CHECKED_OUT
- See Also:
- Constant Field Values
-
DOC_LOCKED
public static final int DOC_LOCKED
- See Also:
- Constant Field Values
-
DOC_ARCHIVED
public static final int DOC_ARCHIVED
- See Also:
- Constant Field Values
-
EXPORT_UNLOCKED
public static final int EXPORT_UNLOCKED
- See Also:
- Constant Field Values
-
EXPORT_LOCKED
public static final int EXPORT_LOCKED
- See Also:
- Constant Field Values
-
INDEX_TO_INDEX
public static final int INDEX_TO_INDEX
- See Also:
- Constant Field Values
-
INDEX_INDEXED
public static final int INDEX_INDEXED
- See Also:
- Constant Field Values
-
INDEX_SKIP
public static final int INDEX_SKIP
- See Also:
- Constant Field Values
-
INDEX_TO_INDEX_METADATA
public static final int INDEX_TO_INDEX_METADATA
- See Also:
- Constant Field Values
-
NATURE_DOC
public static final int NATURE_DOC
- See Also:
- Constant Field Values
-
-
Method Detail
-
getStatus
public int getStatus()
The document status- Returns:
- the document's status
- See Also:
DOC_UNLOCKED,DOC_CHECKED_OUT,DOC_LOCKED
-
setStatus
public void setStatus(int status)
-
getVersion
public String getVersion()
The working version (the most recent version)- Returns:
- the version
-
setVersion
public void setVersion(String version)
Iterates over the versions searching for the specified id- Parameters:
version- The version id
-
getDate
public Date getDate()
The document's last publication date. This date is altered by checkin operations.- Returns:
- the publication date
-
setDate
public void setDate(Date date)
-
getPublisherId
public long getPublisherId()
The user id of the user that published this document- Returns:
- identifier of the user that published the file
-
setPublisherId
public void setPublisherId(long publisherId)
-
isModified
public boolean isModified()
-
setModified
public void setModified(boolean modified)
-
getDeleteUserId
public Long getDeleteUserId()
-
setDeleteUserId
public void setDeleteUserId(Long deleteUserId)
-
getPublisher
public String getPublisher()
The username that published this document- Returns:
- the username that published the document
-
setPublisher
public void setPublisher(String publisher)
-
getType
public String getType()
The document type, that is the file extension- Returns:
- the right part of the file name
-
setType
public void setType(String type)
-
getLockUserId
public Long getLockUserId()
The id of the user that locked this document and that currently locks it- Returns:
- identifier of the user that owns the lock
-
setLockUserId
public void setLockUserId(Long lockUserId)
-
getLanguage
public String getLanguage()
The document's language. This attribute is very important because of it is used to select the right full-text index.- Returns:
- the language
-
setLanguage
public void setLanguage(String language)
- Parameters:
language- the language- See Also:
setLanguage(java.lang.String)
-
getIndexed
public int getIndexed()
-
setIndexed
public void setIndexed(int indexed)
-
getTagsString
public String getTagsString()
-
getTitle
public String getTitle()
Computes the title that is the file name without the extension- Returns:
- the left part of the file name
-
getFileName
public String getFileName()
The original file name- Returns:
- the file name
-
setFileName
public void setFileName(String fileName)
-
getIcon
public String getIcon()
The icon for this document, it may be kept from file name extension- Returns:
- name of the icon file
-
getFileSize
public long getFileSize()
The document's file size expressed in bytes- Returns:
- the file size in bytes
-
setFileSize
public void setFileSize(long fileSize)
-
getFolder
public Folder getFolder()
Retrieve the folder owning this document- Returns:
- the parent folder
-
setFolder
public void setFolder(Folder folder)
-
addTag
public void addTag(String word)
-
clearTags
public void clearTags()
-
getFileExtension
public String getFileExtension()
-
getCreation
public Date getCreation()
The document's creation date- Returns:
- the creation date
-
setCreation
public void setCreation(Date creation)
-
getCustomId
public String getCustomId()
Each document can be identified with a custom identifier- Returns:
- the unique custom identifier
-
setCustomId
public void setCustomId(String customId)
-
getImmutable
public int getImmutable()
Defines if the document is immutable- Returns:
- 1 = immutable, 0 = regular
-
setImmutable
public void setImmutable(int immutable)
-
getDigest
public String getDigest()
The document's digest- Returns:
- the digest
-
setDigest
public void setDigest(String digest)
-
getSigned
public int getSigned()
Return 1 if the document was signed- Returns:
- 1 = signed, 0 = not signed
-
setSigned
public void setSigned(int signed)
-
getFileVersion
public String getFileVersion()
The working file version. Sometimes the version of the document may differ from the file versions. In fact if a new version differs from metadata only, we it have to reference the old file.- Returns:
- the file version
-
setFileVersion
public void setFileVersion(String fileVersion)
-
getCreatorId
public long getCreatorId()
-
setCreatorId
public void setCreatorId(long creatorId)
-
getCreator
public String getCreator()
-
setCreator
public void setCreator(String creator)
-
getLocale
public Locale getLocale()
-
setLocale
public void setLocale(Locale locale)
-
getExportStatus
public int getExportStatus()
The document export status- Returns:
- the export satus
- See Also:
EXPORT_UNLOCKED,EXPORT_LOCKED
-
setExportStatus
public void setExportStatus(int exportStatus)
-
getExportVersion
public String getExportVersion()
The last exported version- Returns:
- the last exported version
-
setExportVersion
public void setExportVersion(String exportVersion)
-
getExportName
public String getExportName()
The last archive name in which the document was exported- Returns:
- name of the export archive
-
setExportName
public void setExportName(String exportName)
-
getExportId
public Long getExportId()
The last archive in which the document was exported- Returns:
- identifier of the export archive
-
setExportId
public void setExportId(Long exportId)
-
getDocRef
public Long getDocRef()
If the document is an alias, it is the id of the referenced document- Returns:
- identifier of the referenced document
-
setDocRef
public void setDocRef(Long docRef)
-
isToIndex
public boolean isToIndex()
-
getBarcoded
public int getBarcoded()
-
setBarcoded
public void setBarcoded(int barcoded)
-
getRating
public Integer getRating()
-
setRating
public void setRating(Integer rating)
-
getComment
public String getComment()
-
setComment
public void setComment(String comment)
-
getWorkflowStatus
public String getWorkflowStatus()
-
setWorkflowStatus
public void setWorkflowStatus(String workflowStatus)
-
getWorkflowStatusDisplay
public String getWorkflowStatusDisplay()
-
setWorkflowStatusDisplay
public void setWorkflowStatusDisplay(String workflowStatusDisplay)
-
getPublished
public int getPublished()
-
setPublished
public void setPublished(int published)
-
getStartPublishing
public Date getStartPublishing()
-
setStartPublishing
public void setStartPublishing(Date startPublishing)
-
getStopPublishing
public Date getStopPublishing()
-
setStopPublishing
public void setStopPublishing(Date stopPublishing)
-
isPublishing
public boolean isPublishing()
-
getTransactionId
public String getTransactionId()
Description copied from interface:TransactionalObjectGets the unique ID of the transaction- Specified by:
getTransactionIdin interfaceTransactionalObject- Returns:
- the identifier of the transaction
-
setTransactionId
public void setTransactionId(String transactionId)
Description copied from interface:TransactionalObjectSets the transaction's identifier- Specified by:
setTransactionIdin interfaceTransactionalObject- Parameters:
transactionId- the identifier of the transacrion
-
getTgs
public String getTgs()
-
setTgs
public void setTgs(String tgs)
-
getExtResId
public String getExtResId()
-
setExtResId
public void setExtResId(String extResId)
-
getDocRefType
public String getDocRefType()
-
setDocRefType
public void setDocRefType(String docRefType)
-
getPages
public int getPages()
-
setPages
public void setPages(int pages)
-
getStamped
public int getStamped()
-
setStamped
public void setStamped(int stamped)
-
getFormId
public Long getFormId()
-
setFormId
public void setFormId(Long formId)
-
getNature
public int getNature()
-
setNature
public void setNature(int nature)
-
getLockUser
public String getLockUser()
-
setLockUser
public void setLockUser(String lockUser)
-
toString
public String toString()
- Overrides:
toStringin classPersistentObject
-
getPassword
public String getPassword()
-
setPassword
public void setPassword(String password)
-
setDecodedPassword
public void setDecodedPassword(String pwd)
Sets the password and encode it- Parameters:
pwd- The password in readable format
-
getDecodedPassword
public String getDecodedPassword()
-
getDeleteUser
public String getDeleteUser()
-
setDeleteUser
public void setDeleteUser(String deleteUser)
-
isGranted
public boolean isGranted(String myPassword)
Checks if the document is accessible with the given password- Parameters:
myPassword- the password to check- Returns:
- true id the password is correct
-
isPasswordProtected
public boolean isPasswordProtected()
-
getLinks
public int getLinks()
-
setLinks
public void setLinks(int links)
-
getOcrTemplateId
public Long getOcrTemplateId()
-
setOcrTemplateId
public void setOcrTemplateId(Long ocrTemplateId)
-
getOcrd
public int getOcrd()
-
setOcrd
public void setOcrd(int ocrd)
-
getBarcodeTemplateId
public Long getBarcodeTemplateId()
-
setBarcodeTemplateId
public void setBarcodeTemplateId(Long barcodeTemplateId)
-
getPreviewPages
public int getPreviewPages()
-
setPreviewPages
public void setPreviewPages(int previewPages)
-
getColor
public String getColor()
-
setColor
public void setColor(String color)
-
copyAttributes
public void copyAttributes(AbstractDocument docVO)
Copies in the current instance the attributes of the passed values object, but NOT the ID- Parameters:
docVO- the document to get the attributes from
-
-