Package com.logicaldoc.core.document

# Class AbstractDocument

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

All Implemented Interfaces:
  `Extensible`, `TransactionalObject`, `Serializable`

Direct Known Subclasses:
  `Document`, `Version`

@MappedSuperclass public abstract class AbstractDocument extends Fillable 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 final int`
`EXPORT_LOCKED`
Document's export status unlocked: 0
`static final int`
`EXPORT_UNLOCKED`
Document's export status unlocked: 0
`static final int`
`NATURE_DOC`
Document's nature regular document: 0

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

`DELETED_CODE_DEFAULT, DELETED_CODE_STRONG, id`

## Method Summary

Modifier and Type
Method
Description
`void`
`copyAttributes(AbstractDocument docVO)`
Copies in the current instance the attributes of the passed values object, but NOT the ID
`boolean`
`equals(Object obj)`
`Long`
`getBarcodeTemplateId()`
`String`
`getColor()`
`String`
`getComment()`
`String`
`getCreator()`
`long`
`getCreatorId()`
`String`
`getCustomId()`
Each document can be identified with a custom identifier
`Date`
`getDate()`
The document's last publication date.
`String`
`getDecodedPassword()`
`Long`
`getDeleteUserId()`
`String`
`getDigest()`
The document's digest
`int`
`getDocAttrs()`
`EmbeddingStatus`
`getEmbeddingStatus()`
`Long`
`getExportId()`
The last archive in which the document was exported
`String`
`getExportName()`
The last archive name in which the document was exported
`int`
`getExportStatus()`
The document export status
`String`
`getExportVersion()`
The last exported version
`String`
`getExtResId()`
`String`
`getFileExtension()`
`String`
`getFileName()`
The original file name
`long`
`getFileSize()`
The document's file size expressed in bytes
`String`
`getFileVersion()`
The working file version.
`abstract long`
`getFolderId()`
`Long`
`getFormId()`
`String`
`getIcon()`
The icon for this document, it may be kept from file name extension
`IndexingStatus`
`getIndexed()`
`IndexingStatus`
`getIndexingStatus()`
`String`
`getLanguage()`
The document's language.
`String`
`getLastNote()`
`int`
`getLinks()`
`Locale`
`getLocale()`
`String`
`getLockUser()`
`Long`
`getLockUserId()`
The id of the user that locked this document and that currently locks it
`int`
`getNature()`
`Long`
`getOcrTemplateId()`
`int`
`getPages()`
`String`
`getPassword()`
`int`
`getPreviewPages()`
`String`
`getPublisher()`
The username that published this document
`long`
`getPublisherId()`
The user id of the user that published this document
`String`
`getRevision()`
`Date`
`getStartPublishing()`
`DocumentStatus`
`getStatus()`
`Date`
`getStopPublishing()`
`Long`
`getTemplateId()`
`String`
`getTemplateName()`
`String`
`getTgs()`
`String`
`getTitle()`
Computes the title that is the file name without the extension
`String`
`getTransactionId()`
Gets the unique ID of the transaction
`String`
`getType()`
The document type, that is the file extension
`String`
`getVersion()`
The working version (the most recent version)
`String`
`getWorkflowStatus()`
`String`
`getWorkflowStatusDisplay()`
`int`
`hashCode()`
`boolean`
`isBarcoded()`
`boolean`
`isGranted(String myPassword)`
Checks if the document is accessible with the given password
`boolean`
`isImmutable()`
`boolean`
`isModified()`
`boolean`
`isOcrd()`
`boolean`
`isPasswordProtected()`
`boolean`
`isPublished()`
`boolean`
`isPublishing()`
`boolean`
`isSigned()`
`boolean`
`isStamped()`
`boolean`
`isToIndex()`
`void`
`setBarcoded(boolean barcoded)`
`void`
`setBarcodeTemplateId(Long barcodeTemplateId)`
`void`
`setColor(String color)`
`void`
`setComment(String comment)`
`void`
`setCreator(String creator)`
`void`
`setCreatorId(long creatorId)`
`void`
`setCustomId(String customId)`
`void`
`setDate(Date date)`
`void`
`setDecodedPassword(String pwd)`
Sets the password and encode it
`void`
`setDeleteUserId(Long deleteUserId)`
`void`
`setDigest(String digest)`
`void`
`setDocAttrs(int docAttrs)`
`void`
`setEmbeddingStatus(EmbeddingStatus embeddingStatus)`
`void`
`setExportId(Long exportId)`
`void`
`setExportName(String exportName)`
`void`
`setExportStatus(int exportStatus)`
`void`
`setExportVersion(String exportVersion)`
`void`
`setExtResId(String extResId)`
`void`
`setFileName(String fileName)`
`void`
`setFileSize(long fileSize)`
`void`
`setFileVersion(String fileVersion)`
`void`
`setFormId(Long formId)`
`void`
`setImmutable(boolean immutable)`
`void`
`setIndexingStatus(int indexingStatus)`
`void`
`setIndexingStatus(IndexingStatus indexingStatus)`
`void`
`setLanguage(String language)`
`void`
`setLastNote(String lastNote)`
`void`
`setLinks(int links)`
`void`
`setLocale(Locale locale)`
`void`
`setLockUser(String lockUser)`
`void`
`setLockUserId(Long lockUserId)`
`void`
`setModified(boolean modified)`
`void`
`setNature(int nature)`
`void`
`setOcrd(boolean ocrd)`
`void`
`setOcrTemplateId(Long ocrTemplateId)`
`void`
`setPages(int pages)`
`void`
`setPassword(String password)`
`void`
`setPreviewPages(int previewPages)`
`void`
`setPublished(boolean published)`
`void`
`setPublisher(String publisher)`
`void`
`setPublisherId(long publisherId)`
`void`
`setRevision(String revision)`
`void`
`setSigned(boolean signed)`
`void`
`setStamped(boolean stamped)`
`void`
`setStartPublishing(Date startPublishing)`
`void`
`setStatus(int status)`
`void`
`setStatus(DocumentStatus status)`
`void`
`setStopPublishing(Date stopPublishing)`
`void`
`setTagsFromWords(Set<String> tgs)`
`void`
`setTemplateId(Long templateId)`
`void`
`setTemplateName(String templateName)`
`void`
`setTgs(String tgs)`
`void`
`setTransactionId(String transactionId)`
Sets the transaction's identifier
`void`
`setType(String type)`
`void`
`setVersion(String version)`
Iterates over the versions searching for the specified id
`void`
`setWorkflowStatus(String workflowStatus)`
`void`
`setWorkflowStatusDisplay(String workflowStatusDisplay)`
`String`
`toString()`

### 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`

### Methods inherited from interface com.logicaldoc.core.metadata.Extensible

`getAttributes, getTemplate, setAttributes, setTemplate`

## Field Details

### EXPORT_UNLOCKED

public static final int EXPORT_UNLOCKED
Document's export status unlocked: 0

See Also:
  - Constant Field Values

### EXPORT_LOCKED

public static final int EXPORT_LOCKED
Document's export status unlocked: 0

See Also:
  - Constant Field Values

### NATURE_DOC

public static final int NATURE_DOC
Document's nature regular document: 0

See Also:
  - Constant Field Values

## Method Details

### getFolderId

public abstract long getFolderId()

### 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

### getStatus

public DocumentStatus getStatus()

### setStatus

public void setStatus(DocumentStatus status)

### setStatus

public void setStatus(int status)

### getIndexingStatus

public IndexingStatus getIndexingStatus()

### getIndexed

public IndexingStatus getIndexed()

### setIndexingStatus

public void setIndexingStatus(IndexingStatus indexingStatus)

### setIndexingStatus

public void setIndexingStatus(int indexingStatus)

### getEmbeddingStatus

public EmbeddingStatus getEmbeddingStatus()

### setEmbeddingStatus

public void setEmbeddingStatus(EmbeddingStatus embeddingStatus)

### 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)`

### 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)

### getFileExtension

public String getFileExtension()

### getCustomId

public String getCustomId()
Each document can be identified with a custom identifier

Returns:
  the unique custom identifier

### setCustomId

public void setCustomId(String customId)

### getDigest

public String getDigest()
The document's digest

Returns:
  the digest

### setDigest

public void setDigest(String digest)

### 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)

### isToIndex

public boolean isToIndex()

### 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)

### 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: `TransactionalObject`
Gets the unique ID of the transaction

Specified by:
  `getTransactionId` in interface `TransactionalObject`
Returns:
  the identifier of the transaction

### setTransactionId

public void setTransactionId(String transactionId)
Description copied from interface: `TransactionalObject`
Sets the transaction's identifier

Specified by:
  `setTransactionId` in interface `TransactionalObject`
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)

### getPages

public int getPages()

### setPages

public void setPages(int pages)

### 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:
  `toString` in class `PersistentObject`

### getPassword

public String getPassword()

### setPassword

public void setPassword(String password)

### setDecodedPassword

public void setDecodedPassword(String pwd) throws NoSuchAlgorithmException
Sets the password and encode it

Parameters:
  `pwd` - The password in readable format
Throws:
  `NoSuchAlgorithmException` - Cripting error

### getDecodedPassword

public String getDecodedPassword()

### 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)

### 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)

### getTemplateName

public String getTemplateName()

Specified by:
  `getTemplateName` in interface `Extensible`

### setTemplateName

public void setTemplateName(String templateName)

Specified by:
  `setTemplateName` in interface `Extensible`

### getTemplateId

public Long getTemplateId()

Specified by:
  `getTemplateId` in interface `Extensible`

### setTemplateId

public void setTemplateId(Long templateId)

Specified by:
  `setTemplateId` in interface `Extensible`

### getRevision

public String getRevision()

### setRevision

public void setRevision(String revision)

### isImmutable

public boolean isImmutable()

### setImmutable

public void setImmutable(boolean immutable)

### isBarcoded

public boolean isBarcoded()

### setBarcoded

public void setBarcoded(boolean barcoded)

### isSigned

public boolean isSigned()

### setSigned

public void setSigned(boolean signed)

### isStamped

public boolean isStamped()

### setStamped

public void setStamped(boolean stamped)

### isPublished

public boolean isPublished()

### setPublished

public void setPublished(boolean published)

### isOcrd

public boolean isOcrd()

### setOcrd

public void setOcrd(boolean ocrd)

### 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

### setTagsFromWords

public void setTagsFromWords(Set<String> tgs)

### getDocAttrs

public int getDocAttrs()

### setDocAttrs

public void setDocAttrs(int docAttrs)

### getLastNote

public String getLastNote()

### setLastNote

public void setLastNote(String lastNote)

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Fillable`

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `Fillable`