public class HibernateDocumentDAO extends HibernatePersistentObjectDAO<Document> implements DocumentDAO
DocumentDAO
entityClass, log, sessionFactory
Modifier and Type | Method and Description |
---|---|
void |
cleanExpiredTransactions()
Cleans all references to expired transactions.
|
long |
count(boolean computeDeleted)
Counts the number of documents
|
long |
countByIndexed(int indexed)
Counts the number of documents indexed or not
|
boolean |
delete(long docId,
History transaction)
This method deletes the document object and insert a new document history
entry.
|
void |
deleteAll(Collection<Document> documents,
History transaction)
Deletes all documents form the database and modifies the custom ids of
all documents
|
boolean |
deleteOrphaned(long deleteUserId)
This method deletes the documents into deleted folders.
|
List<String> |
findAllTags(String firstLetter)
Searches for all tags,
|
Document |
findByCustomId(String customId)
This method finds a document by the custom ID.
|
List<Document> |
findByFileNameAndParentFolderId(Long folderId,
String fileName,
Long excludeId,
Integer max)
Finds that document that lies under a specific folder (given by the id)
an with a given fileName(like operator is used)
|
List<Document> |
findByFolder(long folderId,
Integer max)
Finds all documents inside the given folder.
|
List<Document> |
findByIds(Long[] ids,
Integer max)
Finds all documents whose id is included in the given pool of ids
|
List<Document> |
findByIndexed(int indexed)
Finds all documents by the indexed state.
|
List<Document> |
findByLockUserAndStatus(Long userId,
Integer status)
Finds all document of the specified status and locked by the specified
user
|
List<Document> |
findByTitleAndParentFolderId(long folderId,
String title,
Long excludeId)
Finds that document that lies under a specific folder (given by the id)
an with a given title(like operator is used)
|
List<Long> |
findByUserId(long userId)
Finds all documents for an user.
|
List<Document> |
findByUserIdAndTag(long userId,
String tag,
Integer max)
Finds authorized documents for a user having a specified tag.
|
List<Document> |
findDeleted(long userId,
Integer maxHits)
Finds all deleted docs of a specific user.
|
List<Long> |
findDeletedDocIds()
Gets the collection of deleted document ids
|
List<Document> |
findDeletedDocs()
Finds the list of deleted documents.
|
List<Long> |
findDocIdByFolder(long folderId,
Integer max)
Finds all document ids inside the given folder.
|
List<Long> |
findDocIdByTag(String tag)
This method finds all Doc Ids by a tag.
|
List<Long> |
findDocIdByUserIdAndTag(long userId,
String tag)
Finds authorized documents ids for a user having a specified tag.
|
List<Document> |
findLastDownloadsByUserId(long userId,
int maxResults)
Finds the last downloaded documents by the given user
|
List<Document> |
findLastModifiedByUserId(long userId,
int maxElements)
Finds a max number of documents last modified by an user.
|
List<Document> |
findLinkedDocuments(long docId,
String linkType,
Integer direction)
This method enlists documents linked to the given document.
|
List<Document> |
findLockedByUserId(long userId)
Deprecated.
|
Collection<Long> |
findPublishedIds(Collection<Long> folderIds)
Finds all document ids inside the specified folders that are published in
the current date.
|
List<Long> |
findShortcutIds(long docId)
Gets the ids of all shortcuts associated to the document with the given
docId
|
Map<String,Integer> |
findTags(String firstLetter)
This method selects all tags and counts the occurrences.
|
long |
getTotalSize(boolean computeDeleted)
Obtains the total size of the archive, that is the sum of sizes of all
documents
|
void |
initialize(Document doc)
Doesn't do anything by default
|
void |
makeImmutable(long docId,
History transaction)
Marks the document, with the given docId, as immutable.
|
void |
restore(long docId,
long folderId,
History transaction)
Restores a previously deleted document
|
void |
setConfig(ContextProperties config) |
void |
setFolderDAO(FolderDAO folderDAO) |
void |
setHistoryDAO(HistoryDAO historyDAO) |
void |
setLinkDAO(DocumentLinkDAO linkDAO) |
void |
setListenerManager(DocumentListenerManager listenerManager) |
void |
setNoteDAO(DocumentNoteDAO noteDAO) |
void |
setStorer(Storer storer) |
void |
setUserDAO(UserDAO userDAO) |
void |
setUserDocDAO(UserDocDAO userDocDAO) |
void |
setVersionDAO(VersionDAO versionDAO) |
boolean |
store(Document doc)
This method persists the entity object.
|
boolean |
store(Document doc,
History transaction)
This method persists the document object and insert a new document
history entry.
|
void |
updateDigest(Document doc)
Updates the document's digest (SHA-1)
|
bulkUpdate, delete, deleteAll, evict, findAll, findAllIds, findById, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, flush, getConnection, getCurrentSession, getDbms, getSessionFactory, isHsql, isMySQL, isOracle, isSqlServer, jdbcUpdate, jdbcUpdate, merge, prepareQuery, query, queryForInt, queryForList, queryForList, queryForLong, queryForRowSet, refresh, saveOrUpdate, setSessionFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
bulkUpdate, delete, deleteAll, findAll, findAllIds, findById, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForRowSet
public void setListenerManager(DocumentListenerManager listenerManager)
public void setUserDocDAO(UserDocDAO userDocDAO)
public void setVersionDAO(VersionDAO versionDAO)
public void setLinkDAO(DocumentLinkDAO linkDAO)
public void setUserDAO(UserDAO userDAO)
public void setHistoryDAO(HistoryDAO historyDAO)
public boolean delete(long docId, History transaction)
DocumentDAO
delete
in interface DocumentDAO
docId
- The id of the document to deletetransaction
- entry to log the eventpublic List<Long> findByUserId(long userId)
DocumentDAO
findByUserId
in interface DocumentDAO
userId
- ID of the user.@Deprecated public List<Document> findLockedByUserId(long userId)
DocumentDAO
findLockedByUserId
in interface DocumentDAO
userId
- Id of the user.com.logicaldoc.core.document.dao.DocumentDAO#findLockedByUserId(java.lang.String)
public List<Document> findByLockUserAndStatus(Long userId, Integer status)
DocumentDAO
findByLockUserAndStatus
in interface DocumentDAO
userId
- The user id(optional)status
- The status code(optional)public List<Long> findDocIdByTag(String tag)
DocumentDAO
findDocIdByTag
in interface DocumentDAO
tag
- Tag of the document.public boolean store(Document doc)
PersistentObjectDAO
store
in interface PersistentObjectDAO<Document>
store
in class HibernatePersistentObjectDAO<Document>
doc
- entity to be stored.public boolean store(Document doc, History transaction)
DocumentDAO
store
in interface DocumentDAO
transaction
- entry to log the eventpublic void updateDigest(Document doc)
DocumentDAO
updateDigest
in interface DocumentDAO
doc
- The document to be processedpublic List<Document> findLastModifiedByUserId(long userId, int maxElements)
DocumentDAO
findLastModifiedByUserId
in interface DocumentDAO
userId
- ID of the user.public Map<String,Integer> findTags(String firstLetter)
DocumentDAO
findTags
in interface DocumentDAO
public List<String> findAllTags(String firstLetter)
DocumentDAO
findAllTags
in interface DocumentDAO
firstLetter
- Optional first letter hintpublic List<Document> findByUserIdAndTag(long userId, String tag, Integer max)
DocumentDAO
findByUserIdAndTag
in interface DocumentDAO
userId
- ID of the usertag
- Tag of the documentmax
- Optional, defines the maximum records numberpublic List<Long> findDocIdByUserIdAndTag(long userId, String tag)
DocumentDAO
findDocIdByUserIdAndTag
in interface DocumentDAO
userId
- ID of the user.tag
- Tag of the documentpublic List<Document> findLastDownloadsByUserId(long userId, int maxResults)
DocumentDAO
findLastDownloadsByUserId
in interface DocumentDAO
userId
- id of the usermaxResults
- maximum number of returned elementspublic List<Long> findDocIdByFolder(long folderId, Integer max)
DocumentDAO
findDocIdByFolder
in interface DocumentDAO
folderId
- Folder identifierpublic List<Document> findByFolder(long folderId, Integer max)
DocumentDAO
findByFolder
in interface DocumentDAO
folderId
- Folder identifierpublic List<Document> findLinkedDocuments(long docId, String linkType, Integer direction)
DocumentDAO
Important: The attribute direction
defines the search
logic as follows:
findLinkedDocuments
in interface DocumentDAO
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.public List<Document> findByFileNameAndParentFolderId(Long folderId, String fileName, Long excludeId, Integer max)
DocumentDAO
findByFileNameAndParentFolderId
in interface DocumentDAO
folderId
- The folder id (it can be null).excludeId
- Optional id of a document that must not be consideredmax
- Optional maximum number of returned elementspublic List<Document> findByTitleAndParentFolderId(long folderId, String title, Long excludeId)
DocumentDAO
findByTitleAndParentFolderId
in interface DocumentDAO
folderId
- The folder id (it can be null).excludeId
- Optional id of a document that must not be consideredpublic void initialize(Document doc)
HibernatePersistentObjectDAO
initialize
in interface DocumentDAO
initialize
in interface PersistentObjectDAO<Document>
initialize
in class HibernatePersistentObjectDAO<Document>
doc
- The entity to be initialisedpublic List<Long> findDeletedDocIds()
DocumentDAO
findDeletedDocIds
in interface DocumentDAO
public List<Document> findDeletedDocs()
DocumentDAO
Attention: The returned objects are not fully operative and are populated with a minimal set of data.
findDeletedDocs
in interface DocumentDAO
public long getTotalSize(boolean computeDeleted)
DocumentDAO
getTotalSize
in interface DocumentDAO
computeDeleted
- If true, even deleted documents are consideredpublic long count(boolean computeDeleted)
DocumentDAO
count
in interface DocumentDAO
computeDeleted
- If true, even deleted documents are consideredpublic List<Document> findByIndexed(int indexed)
DocumentDAO
findByIndexed
in interface DocumentDAO
indexed
- the indexed propertypublic void restore(long docId, long folderId, History transaction)
DocumentDAO
restore
in interface DocumentDAO
docId
- Id of the document to be restoredfolderId
- Id of the folder the document will be restored intotransaction
- entry to log the eventpublic Document findByCustomId(String customId)
DocumentDAO
findByCustomId
in interface DocumentDAO
customId
- custom ID of the document.public void makeImmutable(long docId, History transaction)
DocumentDAO
makeImmutable
in interface DocumentDAO
transaction
- entry to log the eventpublic void deleteAll(Collection<Document> documents, History transaction)
DocumentDAO
deleteAll
in interface DocumentDAO
documents
- The documents to be deletedtransaction
- entry to log the eventpublic void setNoteDAO(DocumentNoteDAO noteDAO)
public void setStorer(Storer storer)
public long countByIndexed(int indexed)
DocumentDAO
countByIndexed
in interface DocumentDAO
public List<Long> findShortcutIds(long docId)
DocumentDAO
findShortcutIds
in interface DocumentDAO
docId
- The document Idpublic List<Document> findDeleted(long userId, Integer maxHits)
DocumentDAO
findDeleted
in interface DocumentDAO
userId
- The user that performed the deletionmaxHits
- Optional defines the max number of returned hitspublic void setConfig(ContextProperties config)
public void setFolderDAO(FolderDAO folderDAO)
public List<Document> findByIds(Long[] ids, Integer max)
DocumentDAO
findByIds
in interface DocumentDAO
public boolean deleteOrphaned(long deleteUserId)
DocumentDAO
deleteOrphaned
in interface DocumentDAO
deleteUserId
- The id of the user that performs the deleting.public Collection<Long> findPublishedIds(Collection<Long> folderIds)
DocumentDAO
findPublishedIds
in interface DocumentDAO
folderIds
- Set of folder ids in which the method will searchpublic void cleanExpiredTransactions()
DocumentDAO
cleanExpiredTransactions
in interface DocumentDAO
Copyright © 2008-2014 Logical Objects. All Rights Reserved.