Package com.logicaldoc.core.document

# Interface BookmarkDAO

All Superinterfaces:
  `PersistentObjectDAO<Bookmark>`

All Known Implementing Classes:
  `HibernateBookmarkDAO`

public interface BookmarkDAO extends PersistentObjectDAO<Bookmark>
DAO service for bookmarks

Since:
  5.2
Author:
  Matteo Caruso - LogicalDOC

## Field Summary

### Fields inherited from interface com.logicaldoc.core.PersistentObjectDAO

`ENTITY`

## Method Summary

Modifier and Type
Method
Description
`List<Long>`
`findBookmarkedDocs(long userId)`
Finds the identifiers of the docs bookmarked by the given user
`List<Bookmark>`
`findByUserId(long userId)`
Finds all bookmarks for the given user id
`Bookmark`
`findByUserIdAndDocId(long userId, long docId)`
Finds all bookmarks for the given user id and the given document's identifier
`Bookmark`
`findByUserIdAndFolderId(long userId, long folderId)`
Finds the bookmark for the given user id and the given folder id
`static BookmarkDAO`
`get()`
Gets the object available in the application context
`boolean`
`isDocBookmarkedByUser(long docId, long userId)`
Checks if the document is bookmarked by a user

### Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO

`bulkUpdate, count, count, count, delete, delete, deleteAll, deleteAll, evict, evict, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, initialize, initialize, isMariaDB, isMySQL, isOracle, isPostgreSQL, isSQLServer, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, queryForString, store`

## Method Details

### get

static BookmarkDAO get()
Gets the object available in the application context

Returns:
  the instance of this object in the application context

### findByUserId

List<Bookmark> findByUserId(long userId) throws PersistenceException
Finds all bookmarks for the given user id

Parameters:
  `userId` - ID of the user
Returns:
  Collection of all bookmarks for the specified user ordered by position
Throws:
  `PersistenceException` - Error in the database

### findBookmarkedDocs

List<Long> findBookmarkedDocs(long userId) throws PersistenceException
Finds the identifiers of the docs bookmarked by the given user

Parameters:
  `userId` - identifier of the user
Returns:
  list of document identifiers
Throws:
  `PersistenceException` - Error in the database

### isDocBookmarkedByUser

boolean isDocBookmarkedByUser(long docId, long userId) throws PersistenceException
Checks if the document is bookmarked by a user

Parameters:
  `docId` - identifier of the document
  `userId` - identifier of the user
Returns:
  true id the document was bookmarked
Throws:
  `PersistenceException` - Error in the database

### findByUserIdAndDocId

Bookmark findByUserIdAndDocId(long userId, long docId) throws PersistenceException
Finds all bookmarks for the given user id and the given document's identifier

Parameters:
  `userId` - ID of the user
  `docId` - ID of the document
Returns:
  The bookmark
Throws:
  `PersistenceException` - Error in the database

### findByUserIdAndFolderId

Bookmark findByUserIdAndFolderId(long userId, long folderId) throws PersistenceException
Finds the bookmark for the given user id and the given folder id

Parameters:
  `userId` - ID of the user
  `folderId` - ID of the folder
Returns:
  The bookmark
Throws:
  `PersistenceException` - Error in the database