Package com.logicaldoc.core.security

# Class HibernateSessionDAO

java.lang.Object
com.logicaldoc.core.HibernatePersistentObjectDAO<Session>
com.logicaldoc.core.security.HibernateSessionDAO

All Implemented Interfaces:
  `PersistentObjectDAO<Session>`, `SessionDAO`

@Repository("sessionDAO") public class HibernateSessionDAO extends HibernatePersistentObjectDAO<Session> implements SessionDAO

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

### Methods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAO

`bulkUpdate, count, delete, deleteAll, evict, evict, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findIdsByWhere, getDatabaseMetadata, initialize, jdbcUpdate, jdbcUpdate, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, queryForString, setSessionFactory, store`

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

### deleteCurrentNodeSessions

public void deleteCurrentNodeSessions()
Description copied from interface: `SessionDAO`
Removes all the sessions that refers to the current node

Specified by:
  `deleteCurrentNodeSessions` in interface `SessionDAO`

### countSessions

public int countSessions(Long tenantId, SessionStatus status)
Description copied from interface: `SessionDAO`
Counts the number of sessions.

Specified by:
  `countSessions` in interface `SessionDAO`
Parameters:
  `tenantId` - The tenant (optional)
  `status` - The current status (optional)
Returns:
  the number of sessions

### countSessions

public int countSessions(String username, SessionStatus status)
Description copied from interface: `SessionDAO`
Counts the number of sessions.

Specified by:
  `countSessions` in interface `SessionDAO`
Parameters:
  `username` - The username owning the session
  `status` - The current status (optional)
Returns:
  the number of sessions

### findBySid

public Session findBySid(String sid)
Description copied from interface: `SessionDAO`
Retrieves the session of the given SID

Specified by:
  `findBySid` in interface `SessionDAO`
Parameters:
  `sid` - identifier of the session
Returns:
  the session

### findByNode

public List<Session> findByNode(String node)
Description copied from interface: `SessionDAO`
Retrieves the session of the given node

Specified by:
  `findByNode` in interface `SessionDAO`
Parameters:
  `node` - the node
Returns:
  the list of sessions

### cleanOldSessions

public void cleanOldSessions(int ttl)
Description copied from interface: `SessionDAO`
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.

Specified by:
  `cleanOldSessions` in interface `SessionDAO`
Parameters:
  `ttl` - The maximum number of days over which the session is considered old