Package com.logicaldoc.core.document
Class HibernateDocumentDAO
java.lang.Object
com.logicaldoc.core.HibernatePersistentObjectDAO<Document>
com.logicaldoc.core.document.HibernateDocumentDAO
- All Implemented Interfaces:
DocumentDAO
,PersistentObjectDAO<Document>
public class HibernateDocumentDAO
extends HibernatePersistentObjectDAO<Document>
implements DocumentDAO
Hibernate implementation of
DocumentDAO
- Since:
- 3.0
- Author:
- Marco Meschieri - LogicalDOC
-
Field Summary
Fields inherited from interface com.logicaldoc.core.PersistentObjectDAO
ENTITY
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyParentFolderSecurity
(long docId, DocumentHistory transaction) Replaces the document's security policies with those from the parent foldervoid
archive
(long docId, DocumentHistory transaction) Archives a documentvoid
Cleans all references to expired transactions.void
Cleans the ld_uniquetag table removing no more used tags, this method is optimized and uses a couple of prepared statements, in case of error it switches toDocumentDAO.cleanUnexistingUniqueTagsOneByOne()
void
Cleans the ld_uniquetag table removing no more used tags programmatically one by one.long
computeTotalSize
(Long tenantId, Long userId, boolean computeDeleted) Obtains the total size of the repository, that is the sum of sizes of all documents and their versionslong
Counts the number of documentslong
countByIndexed
(int indexed) Counts the number of documents in a given indexation status(@seeAbstractDocument.getIndexed()
void
delete
(long docId, int delCode, DocumentHistory transaction) This method deletes the document object and insert a new document history entry.void
delete
(long docId, DocumentHistory transaction) Shortcut for delete(docId, 1, transaction)void
deleteAll
(Collection<Document> documents, int delCode, DocumentHistory transaction) Deletes all documents form the database and modifies the custom ids of all documentsvoid
deleteAll
(Collection<Document> documents, DocumentHistory transaction) Shortcut for deleteAll(documents, 1, transaction)void
deleteOrphaned
(long deleteUserId) This method deletes the documents into deleted folders.findAliasIds
(long docId) Gets the ids of all aliases associated to the document with the given docIdfindAllTags
(String firstLetter, Long tenantId) Searches for all tags,findArchivedByFolder
(long folderId) Finds archived documents in a folder (direct childeren only)findByCustomId
(String customId, long tenantId) This method finds a document by the custom ID.findByFileNameAndParentFolderId
(Long folderId, String fileName, Long excludeId, Long tenantId, Integer max) Finds that document that lies under a specific folder (given by the id) an with a given fileName(like operator is used)findByFolder
(long folderId, Integer max) Finds all documents direct children of the given folder.Finds all documents whose id is included in the given pool of idsfindByIndexed
(int indexed) Finds all documents by the indexed state.findByLockUserAndStatus
(Long userId, Integer status) Finds all document of0 the specified status and locked by the specified userfindByPath
(String path, long tenantId) Finds a document by it's full pathfindByUserId
(long userId) Finds all documents for an user.findByUserIdAndTag
(long userId, String tag, Integer max) Finds authorized documents for a user having a specified tag.findDeleted
(long userId, Integer maxHits) Finds all deleted docs of a specific user.Gets the collection of deleted document idsFinds the list of deleted documents.findDocIdByFolder
(long folderId, Integer max) Finds all document ids inside the given folder.findDocIdByTag
(String tag) This method finds all Doc Ids by a tag.findDocIdByUserIdAndTag
(long userId, String tag) Finds authorized documents ids for a user having a specified tag.findDocument
(long docId) This method finds a document by the ID and if it is an alias the referenced document is returned instead.findDuplicatedDigests
(Long tenantId, Long folderId) Retrieves the list of duplicated checksumsfindLastDownloadsByUserId
(long userId, int maxResults) Finds the last downloaded documents by the given userfindLastModifiedByUserId
(long userId, int maxElements) Finds a max number of documents last modified by an user.findLinkedDocuments
(long docId, String linkType, Integer direction) This method enlists documents linked to the given document.findPublishedIds
(Collection<Long> folderIds) Finds all document ids inside the specified folders that are published in the current date.findTags
(long docId) Retrieves the alphabetically ordered list of all the document's tagsSelects all tags and counts the occurrences.getAllowedPermissions
(long docId, long userId) Finds all permissions of a user enabled on the specified documentgetTagCloud
(long tenantId, int maxTags) Gets the tag cloud for the given tenantgetTagCloud
(String sid) Gets the tag cloud for the given tenantgetWorkspace
(long docId) Retrieves, the workspace where the document(or alias) is storedvoid
initialize
(Document doc) Doesn't do anything by defaultvoid
Puts into ld_uniquetag the new unique tagsboolean
isDownloadAllowed
(long id, long userId) boolean
isMoveAllowed
(long id, long userId) boolean
isPermissionAllowed
(Permission permission, long documentId, long userId) This method checks if the given permission is enabled for a document and an user.boolean
isPreviewAllowed
(long docId, long userId) boolean
isPrintAllowed
(long id, long userId) boolean
isReadAllowed
(long docId, long userId) boolean
isWriteAllowed
(long id, long userId) This method is looking up for writing rights for a document and an user.void
makeImmutable
(long docId, DocumentHistory transaction) Marks the document, with the given docId, as immutable.void
restore
(long docId, long folderId, DocumentHistory transaction) Restores a previously deleted documentvoid
saveDocumentHistory
(Document doc, DocumentHistory transaction) Saves a document's historyvoid
setPassword
(long docId, String password, DocumentHistory transaction) Protects the document with a password.void
This method persists the entity objectvoid
store
(Document doc, DocumentHistory transaction) This method persists the document object and insert a new document history entryvoid
unarchive
(long docId, DocumentHistory transaction) Restores a previously archived documentvoid
unsetPassword
(long docId, DocumentHistory transaction) Removes the password protection from the document.void
Updates the count of the unique tagsvoid
updateDigest
(Document doc) Updates the document's digest (SHA-1)Methods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAO
bulkUpdate, delete, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, getSessionFactory, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForRowSet, queryForRowSet, queryForString, setSessionFactory
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO
bulkUpdate, delete, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForRowSet, queryForRowSet, queryForString
-
Method Details
-
archive
Description copied from interface:DocumentDAO
Archives a document- Specified by:
archive
in interfaceDocumentDAO
- Parameters:
docId
- identifier of the documenttransaction
- entry to log the event- Throws:
PersistenceException
- error at data layer
-
unarchive
Description copied from interface:DocumentDAO
Restores a previously archived document- Specified by:
unarchive
in interfaceDocumentDAO
- Parameters:
docId
- Ids of the document to be restoredtransaction
- entry to log the event- Throws:
PersistenceException
- error at data layer
-
delete
Description copied from interface:DocumentDAO
Shortcut for delete(docId, 1, transaction)- Specified by:
delete
in interfaceDocumentDAO
- Parameters:
docId
- identifier of the documenttransaction
- entry to log the event- Throws:
PersistenceException
- error at data layer
-
delete
public void delete(long docId, int delCode, DocumentHistory transaction) throws PersistenceException Description copied from interface:DocumentDAO
This method deletes the document object and insert a new document history entry.- Specified by:
delete
in interfaceDocumentDAO
- Parameters:
docId
- The id of the document to deletedelCode
- The deletion codetransaction
- entry to log the event- Throws:
PersistenceException
- error at data layer
-
findByUserId
Description copied from interface:DocumentDAO
Finds all documents for an user.- Specified by:
findByUserId
in interfaceDocumentDAO
- Parameters:
userId
- ID of the user.- Returns:
- Collection of all documentId required for the specified user.
- Throws:
PersistenceException
- error at data layer
-
findByLockUserAndStatus
Description copied from interface:DocumentDAO
Finds all document of0 the specified status and locked by the specified user- Specified by:
findByLockUserAndStatus
in interfaceDocumentDAO
- Parameters:
userId
- The user id(optional)status
- The status code(optional)- Returns:
- Collection of all Documents locked by the specified user and of the specified status.
-
findDocIdByTag
Description copied from interface:DocumentDAO
This method finds all Doc Ids by a tag.- Specified by:
findDocIdByTag
in interfaceDocumentDAO
- Parameters:
tag
- Tag of the document.- Returns:
- Document with specified tag.
- Throws:
PersistenceException
- error at data layer
-
store
Description copied from interface:PersistentObjectDAO
This method persists the entity object- Specified by:
store
in interfacePersistentObjectDAO<Document>
- Overrides:
store
in classHibernatePersistentObjectDAO<Document>
- Parameters:
doc
- entity to be stored- Throws:
PersistenceException
- raised in case of errors in the database
-
store
Description copied from interface:DocumentDAO
This method persists the document object and insert a new document history entry- Specified by:
store
in interfaceDocumentDAO
- Parameters:
doc
- the documenttransaction
- entry to log the event- Throws:
PersistenceException
- error at data layer
-
updateDigest
Description copied from interface:DocumentDAO
Updates the document's digest (SHA-1)- Specified by:
updateDigest
in interfaceDocumentDAO
- Parameters:
doc
- The document to be processed- Throws:
PersistenceException
- error at data layer
-
findLastModifiedByUserId
public List<Document> findLastModifiedByUserId(long userId, int maxElements) throws PersistenceException Description copied from interface:DocumentDAO
Finds a max number of documents last modified by an user.- Specified by:
findLastModifiedByUserId
in interfaceDocumentDAO
- Parameters:
userId
- ID of the user.maxElements
- maximum number of returned elements- Returns:
- Collection of the last documents changed by the specified user.
- Throws:
PersistenceException
- error at data layer
-
findTags
Description copied from interface:DocumentDAO
Retrieves the alphabetically ordered list of all the document's tags- Specified by:
findTags
in interfaceDocumentDAO
- Parameters:
docId
- identifier of the document- Returns:
- list of the document's tags
- Throws:
PersistenceException
- error at data layer
-
findTags
Description copied from interface:DocumentDAO
Selects all tags and counts the occurrences.- Specified by:
findTags
in interfaceDocumentDAO
- Parameters:
firstLetter
- the first lettertenantId
- identifier of the tenant- Returns:
- the map tag - count
- Throws:
PersistenceException
- error at data layer
-
findAllTags
Description copied from interface:DocumentDAO
Searches for all tags,- Specified by:
findAllTags
in interfaceDocumentDAO
- Parameters:
firstLetter
- Optional first letter hinttenantId
- ID of the tenant to search in- Returns:
- The list of all tags in the system
- Throws:
PersistenceException
- error at data layer
-
findByUserIdAndTag
public List<Document> findByUserIdAndTag(long userId, String tag, Integer max) throws PersistenceException Description copied from interface:DocumentDAO
Finds authorized documents for a user having a specified tag.- Specified by:
findByUserIdAndTag
in interfaceDocumentDAO
- Parameters:
userId
- ID of the usertag
- Tag of the documentmax
- Optional, defines the maximum records number- Returns:
- Collection of found documents
- Throws:
PersistenceException
- error at data layer
-
findDocIdByUserIdAndTag
Description copied from interface:DocumentDAO
Finds authorized documents ids for a user having a specified tag.- Specified by:
findDocIdByUserIdAndTag
in interfaceDocumentDAO
- Parameters:
userId
- ID of the user.tag
- Tag of the document- Returns:
- Set of found ids.
- Throws:
PersistenceException
- error at data layer
-
findLastDownloadsByUserId
public List<Document> findLastDownloadsByUserId(long userId, int maxResults) throws PersistenceException Description copied from interface:DocumentDAO
Finds the last downloaded documents by the given user- Specified by:
findLastDownloadsByUserId
in interfaceDocumentDAO
- Parameters:
userId
- id of the usermaxResults
- maximum number of returned elements- Returns:
- list of documents
- Throws:
PersistenceException
- error at data layer
-
findDocIdByFolder
Description copied from interface:DocumentDAO
Finds all document ids inside the given folder.- Specified by:
findDocIdByFolder
in interfaceDocumentDAO
- Parameters:
folderId
- Folder identifiermax
- Optional, maximum number of returned elements- Returns:
- Collection of all document id in the folder.
- Throws:
PersistenceException
- error at data layer
-
findByFolder
Description copied from interface:DocumentDAO
Finds all documents direct children of the given folder.- Specified by:
findByFolder
in interfaceDocumentDAO
- Parameters:
folderId
- Folder identifiermax
- Optional, defines the maximum records number- Returns:
- Collection of all documents in the folder
- Throws:
PersistenceException
- error at data layer
-
findArchivedByFolder
Description copied from interface:DocumentDAO
Finds archived documents in a folder (direct childeren only)- Specified by:
findArchivedByFolder
in interfaceDocumentDAO
- Parameters:
folderId
- identifier of the folder- Returns:
- list of documents
- Throws:
PersistenceException
- error at data layer
-
findLinkedDocuments
public List<Document> findLinkedDocuments(long docId, String linkType, Integer direction) throws PersistenceException Description copied from interface:DocumentDAO
This method enlists documents linked to the given document.Important: The attribute
direction
defines the search logic as follows:- 1: docId will be compared to link's document1
- 2: docId will be compared to link's document2
- null: docId will be compared to both document1 and document2
- Specified by:
findLinkedDocuments
in interfaceDocumentDAO
- Parameters:
docId
- All documents linked to this one will be searchedlinkType
- Type of the link (optional)direction
- if 1 docId will be compared to link's document1, id 2 docId will be compared to link's document2, if null docId will be compared to both document1 and document2 of the link.- Returns:
- The collection of linked documents
- Throws:
PersistenceException
- error at data layer
-
findByFileNameAndParentFolderId
public List<Document> findByFileNameAndParentFolderId(Long folderId, String fileName, Long excludeId, Long tenantId, Integer max) throws PersistenceException Description copied from interface:DocumentDAO
Finds that document that lies under a specific folder (given by the id) an with a given fileName(like operator is used)- Specified by:
findByFileNameAndParentFolderId
in interfaceDocumentDAO
- Parameters:
folderId
- The folder id (it can be null).fileName
- name of the file or a part of it (you can use SQL % jolly chars, eg: contract.pdf, %ontrac%)excludeId
- Optional id of a document that must not be consideredtenantId
- Optional id of the tenantmax
- Optional maximum number of returned elements- Returns:
- The list of documents with the given fileName. If the folder id is null, the searched document can belong to any folder in the repository
- Throws:
PersistenceException
- error at data layer
-
initialize
Description copied from class:HibernatePersistentObjectDAO
Doesn't do anything by default- Specified by:
initialize
in interfaceDocumentDAO
- Specified by:
initialize
in interfacePersistentObjectDAO<Document>
- Overrides:
initialize
in classHibernatePersistentObjectDAO<Document>
- Parameters:
doc
- The entity to be initialised
-
findDeletedDocIds
Description copied from interface:DocumentDAO
Gets the collection of deleted document ids- Specified by:
findDeletedDocIds
in interfaceDocumentDAO
- Returns:
- collection of document identifiers
- Throws:
PersistenceException
- error at data layer
-
findDeletedDocs
Description copied from interface:DocumentDAO
Finds the list of deleted documents.Attention: The returned objects are not fully operative and are populated with a minimal set of data.
- Specified by:
findDeletedDocs
in interfaceDocumentDAO
- Returns:
- the list of documents
- Throws:
PersistenceException
- error at data layer
-
computeTotalSize
public long computeTotalSize(Long tenantId, Long userId, boolean computeDeleted) throws PersistenceException Description copied from interface:DocumentDAO
Obtains the total size of the repository, that is the sum of sizes of all documents and their versions- Specified by:
computeTotalSize
in interfaceDocumentDAO
- Parameters:
tenantId
- identifier of the tenant(optional)userId
- identifier of the publisher user (optional)computeDeleted
- If true, even deleted documents are considered- Returns:
- the total size expressed in bytes
- Throws:
PersistenceException
- error at data layer
-
count
public long count(Long tenantId, boolean computeDeleted, boolean computeArchived) throws PersistenceException Description copied from interface:DocumentDAO
Counts the number of documents- Specified by:
count
in interfaceDocumentDAO
- Parameters:
tenantId
- The tenant to search incomputeDeleted
- If true, even deleted documents are consideredcomputeArchived
- If true, even archived documents are considered- Returns:
- number of documents
- Throws:
PersistenceException
- error at data layer
-
findByIndexed
Description copied from interface:DocumentDAO
Finds all documents by the indexed state. Order by ascending lastModifed- Specified by:
findByIndexed
in interfaceDocumentDAO
- Parameters:
indexed
- the indexed property- Returns:
- Collection of all documents
- Throws:
PersistenceException
- error at data layer
-
restore
public void restore(long docId, long folderId, DocumentHistory transaction) throws PersistenceException Description copied from interface:DocumentDAO
Restores a previously deleted document- Specified by:
restore
in interfaceDocumentDAO
- Parameters:
docId
- Id of the document to be restoredfolderId
- Id of the folder the document will be restored intotransaction
- entry to log the event- Throws:
PersistenceException
- error at data layer
-
findByCustomId
Description copied from interface:DocumentDAO
This method finds a document by the custom ID.- Specified by:
findByCustomId
in interfaceDocumentDAO
- Parameters:
customId
- custom ID of the document.tenantId
- ID of the contained tenant.- Returns:
- Document with given ID.
- Throws:
PersistenceException
- error at data layer
-
makeImmutable
Description copied from interface:DocumentDAO
Marks the document, with the given docId, as immutable. Unlocks the document if it was locked.- Specified by:
makeImmutable
in interfaceDocumentDAO
- Parameters:
docId
- identifier of the documenttransaction
- entry to log the event- Throws:
PersistenceException
- error at data layer
-
deleteAll
public void deleteAll(Collection<Document> documents, DocumentHistory transaction) throws PersistenceException Description copied from interface:DocumentDAO
Shortcut for deleteAll(documents, 1, transaction)- Specified by:
deleteAll
in interfaceDocumentDAO
- Parameters:
documents
- the documentstransaction
- the current session- Throws:
PersistenceException
- error at data layer
-
deleteAll
public void deleteAll(Collection<Document> documents, int delCode, DocumentHistory transaction) throws PersistenceException Description copied from interface:DocumentDAO
Deletes all documents form the database and modifies the custom ids of all documents- Specified by:
deleteAll
in interfaceDocumentDAO
- Parameters:
documents
- The documents to be deleteddelCode
- The deletion codetransaction
- entry to log the event- Throws:
PersistenceException
- error at data layer
-
saveDocumentHistory
public void saveDocumentHistory(Document doc, DocumentHistory transaction) throws PersistenceException Description copied from interface:DocumentDAO
Saves a document's history- Specified by:
saveDocumentHistory
in interfaceDocumentDAO
- Parameters:
doc
- the documenttransaction
- the current session- Throws:
PersistenceException
- error at data layer
-
countByIndexed
Description copied from interface:DocumentDAO
Counts the number of documents in a given indexation status(@seeAbstractDocument.getIndexed()
- Specified by:
countByIndexed
in interfaceDocumentDAO
- Parameters:
indexed
- the indexation status to check- Returns:
- number of documents
- Throws:
PersistenceException
- error at data layer
-
findAliasIds
Description copied from interface:DocumentDAO
Gets the ids of all aliases associated to the document with the given docId- Specified by:
findAliasIds
in interfaceDocumentDAO
- Parameters:
docId
- identifier of the document- Returns:
- list of identifiers of aliases
- Throws:
PersistenceException
- error at data layer
-
findDeleted
Description copied from interface:DocumentDAO
Finds all deleted docs of a specific user.- Specified by:
findDeleted
in interfaceDocumentDAO
- Parameters:
userId
- The user that performed the deletionmaxHits
- Optional, defines the max number of returned elements- Returns:
- The documents list
- Throws:
PersistenceException
- error at data layer
-
findByIds
Description copied from interface:DocumentDAO
Finds all documents whose id is included in the given pool of ids- Specified by:
findByIds
in interfaceDocumentDAO
- Parameters:
ids
- identifiers of the documentsmax
- Optional, maximum number of returned elements- Returns:
- list of documents
-
deleteOrphaned
Description copied from interface:DocumentDAO
This method deletes the documents into deleted folders.- Specified by:
deleteOrphaned
in interfaceDocumentDAO
- Parameters:
deleteUserId
- The id of the user that performs the deleting- Throws:
PersistenceException
- error at data layer
-
findPublishedIds
Description copied from interface:DocumentDAO
Finds all document ids inside the specified folders that are published in the current date.- Specified by:
findPublishedIds
in interfaceDocumentDAO
- Parameters:
folderIds
- Set of folder ids in which the method will search- Returns:
- List of published document ids
- Throws:
PersistenceException
- error at data layer
-
cleanExpiredTransactions
Description copied from interface:DocumentDAO
Cleans all references to expired transactions. If no lock is found for a document referencing a given transaction, the transactionId will be set to null.- Specified by:
cleanExpiredTransactions
in interfaceDocumentDAO
- Throws:
PersistenceException
- error at data layer
-
cleanUnexistingUniqueTags
Description copied from interface:DocumentDAO
Cleans the ld_uniquetag table removing no more used tags, this method is optimized and uses a couple of prepared statements, in case of error it switches toDocumentDAO.cleanUnexistingUniqueTagsOneByOne()
- Specified by:
cleanUnexistingUniqueTags
in interfaceDocumentDAO
- Throws:
PersistenceException
- error at data layer
-
cleanUnexistingUniqueTagsOneByOne
Description copied from interface:DocumentDAO
Cleans the ld_uniquetag table removing no more used tags programmatically one by one. This method is not as optimized asDocumentDAO.cleanUnexistingUniqueTags()
and should not be invoked directly- Specified by:
cleanUnexistingUniqueTagsOneByOne
in interfaceDocumentDAO
- Throws:
PersistenceException
- error at data layer
-
insertNewUniqueTags
Description copied from interface:DocumentDAO
Puts into ld_uniquetag the new unique tags- Specified by:
insertNewUniqueTags
in interfaceDocumentDAO
- Throws:
PersistenceException
- error at data layer
-
updateCountUniqueTags
Description copied from interface:DocumentDAO
Updates the count of the unique tags- Specified by:
updateCountUniqueTags
in interfaceDocumentDAO
- Throws:
PersistenceException
- error at data layer
-
getTagCloud
Description copied from interface:DocumentDAO
Gets the tag cloud for the given tenant- Specified by:
getTagCloud
in interfaceDocumentDAO
- Parameters:
tenantId
- identifier of the tenantmaxTags
- maximum number of returned elements- Returns:
- list of tag clouds
- Throws:
PersistenceException
- error at data layer
-
getTagCloud
Description copied from interface:DocumentDAO
Gets the tag cloud for the given tenant- Specified by:
getTagCloud
in interfaceDocumentDAO
- Parameters:
sid
- identifier of the session- Returns:
- list of tag clouds
- Throws:
PersistenceException
- error at data layer
-
findDocument
Description copied from interface:DocumentDAO
This method finds a document by the ID and if it is an alias the referenced document is returned instead.- Specified by:
findDocument
in interfaceDocumentDAO
- Parameters:
docId
- ID of the document(or the alias)- Returns:
- Document with given ID
- Throws:
PersistenceException
- an error happened in the database
-
getWorkspace
Description copied from interface:DocumentDAO
Retrieves, the workspace where the document(or alias) is stored- Specified by:
getWorkspace
in interfaceDocumentDAO
- Parameters:
docId
- identifier of a document- Returns:
- the parent workspace
- Throws:
PersistenceException
- error at data layer
-
setPassword
public void setPassword(long docId, String password, DocumentHistory transaction) throws PersistenceException Description copied from interface:DocumentDAO
Protects the document with a password. The same password is replicated to all the versions- Specified by:
setPassword
in interfaceDocumentDAO
- Parameters:
docId
- ID of the documentpassword
- The new password in cleartransaction
- history informations- Throws:
PersistenceException
- error at data layer
-
unsetPassword
Description copied from interface:DocumentDAO
Removes the password protection from the document. The same action is replicated to all the versions- Specified by:
unsetPassword
in interfaceDocumentDAO
- Parameters:
docId
- ID of the documenttransaction
- session informations- Throws:
PersistenceException
- error at data layer
-
findByPath
Description copied from interface:DocumentDAO
Finds a document by it's full path- Specified by:
findByPath
in interfaceDocumentDAO
- Parameters:
path
- The path comprehensive of the file nametenantId
- The tenant- Returns:
- the found document
- Throws:
PersistenceException
- error at data layer
-
findDuplicatedDigests
Description copied from interface:DocumentDAO
Retrieves the list of duplicated checksums- Specified by:
findDuplicatedDigests
in interfaceDocumentDAO
- Parameters:
tenantId
- identifier of the tenantfolderId
- identifier of the folder- Returns:
- list of duplicated digests
- Throws:
PersistenceException
- error at data layer
-
isPrintAllowed
- Specified by:
isPrintAllowed
in interfaceDocumentDAO
- Throws:
PersistenceException
-
isWriteAllowed
Description copied from interface:DocumentDAO
This method is looking up for writing rights for a document and an user.- Specified by:
isWriteAllowed
in interfaceDocumentDAO
- Parameters:
id
- ID of the documentuserId
- ID of the user- Returns:
- if the write permission is granted
- Throws:
PersistenceException
- error at data layer
-
isDownloadAllowed
- Specified by:
isDownloadAllowed
in interfaceDocumentDAO
- Throws:
PersistenceException
-
isMoveAllowed
- Specified by:
isMoveAllowed
in interfaceDocumentDAO
- Throws:
PersistenceException
-
isReadAllowed
- Specified by:
isReadAllowed
in interfaceDocumentDAO
- Throws:
PersistenceException
-
isPreviewAllowed
- Specified by:
isPreviewAllowed
in interfaceDocumentDAO
- Throws:
PersistenceException
-
isPermissionAllowed
public boolean isPermissionAllowed(Permission permission, long documentId, long userId) throws PersistenceException Description copied from interface:DocumentDAO
This method checks if the given permission is enabled for a document and an user.- Specified by:
isPermissionAllowed
in interfaceDocumentDAO
- Parameters:
permission
- the permission to checkdocumentId
- ID of the folderuserId
- ID of the user- Returns:
- if the permission is granted to the user
- Throws:
PersistenceException
- error at data layer
-
getAllowedPermissions
Description copied from interface:DocumentDAO
Finds all permissions of a user enabled on the specified document- Specified by:
getAllowedPermissions
in interfaceDocumentDAO
- Parameters:
docId
- ID of the documentuserId
- ID of the user- Returns:
- Collection of enabled permissions
- Throws:
PersistenceException
- error at data layer
-
applyParentFolderSecurity
public void applyParentFolderSecurity(long docId, DocumentHistory transaction) throws PersistenceException Description copied from interface:DocumentDAO
Replaces the document's security policies with those from the parent folder- Specified by:
applyParentFolderSecurity
in interfaceDocumentDAO
- Parameters:
docId
- identifier of the documenttransaction
- the current transaction- Throws:
PersistenceException
- error at data layer
-