Package com.logicaldoc.core.security

# Interface SessionDAO

All Superinterfaces:
  `PersistentObjectDAO<Session>`

All Known Implementing Classes:
  `HibernateSessionDAO`

public interface SessionDAO extends PersistentObjectDAO<Session>
DAO for `Session`s handling.

Since:
  7.7
Author:
  Marco Meschieri - LogicalDOC

## Field Summary

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

`ENTITY`

## Method Summary

Modifier and Type
Method
Description
`void`
`cleanOldSessions(int ttl)`
This method deletes all the session entries oldest than the given days since now.
`int`
`countSessions(Long tenantId, SessionStatus status)`
Counts the number of sessions.
`int`
`countSessions(String username, SessionStatus status)`
Counts the number of sessions.
`void`
`deleteCurrentNodeSessions()`
Removes all the sessions that refers to the current node
`List<Session>`
`findByNode(String node)`
Retrieves the session of the given node
`Session`
`findBySid(String sid)`
Retrieves the session of the given SID
`static SessionDAO`
`get()`
Gets the object available in the application context

### 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 SessionDAO get()
Gets the object available in the application context

Returns:
  the instance of this object in the application context

### deleteCurrentNodeSessions

void deleteCurrentNodeSessions()
Removes all the sessions that refers to the current node

### countSessions

int countSessions(Long tenantId, SessionStatus status)
Counts the number of sessions.

Parameters:
  `tenantId` - The tenant (optional)
  `status` - The current status (optional)
Returns:
  the number of sessions

### countSessions

int countSessions(String username, SessionStatus status)
Counts the number of sessions.

Parameters:
  `username` - The username owning the session
  `status` - The current status (optional)
Returns:
  the number of sessions

### findBySid

Session findBySid(String sid)
Retrieves the session of the given SID

Parameters:
  `sid` - identifier of the session
Returns:
  the session

### findByNode

List<Session> findByNode(String node)
Retrieves the session of the given node

Parameters:
  `node` - the node
Returns:
  the list of sessions

### cleanOldSessions

void cleanOldSessions(int ttl)
This method deletes all the session entries oldest than the given days since now. If `ttl` is 0 or -1, the deletion is not made.

Parameters:
  `ttl` - The maximum number of days over which the session is considered old