Package com.logicaldoc.core.security

# Class Session

java.lang.Object
com.logicaldoc.core.PersistentObject
com.logicaldoc.core.security.Session

All Implemented Interfaces:
  `Serializable`, `Comparable<Session>`

@Entity public class Session extends PersistentObject implements Comparable<Session>
A single user session with it's unique identifier and the reference to the user

Since:
  4.6.0
Author:
  Marco Meschieri - LogicalDOC
See Also:
  - Serialized Form

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`class`
`Session.Log`

## Field Summary

### Fields inherited from class com.logicaldoc.core.PersistentObject

`DELETED_CODE_DEFAULT, DELETED_CODE_STRONG, id`

## Method Summary

Modifier and Type
Method
Description
`int`
`compareTo(Session other)`
`boolean`
`equals(Object obj)`
`Client`
`getClient()`
`String`
`getDecodedKey()`
`Map<String,Object>`
`getDictionary()`
`long`
`getDuration()`
Retrieves the total duration of the session
`Date`
`getFinished()`
`String`
`getImpersonator()`
`String`
`getKey()`
`String`
`getKeyLabel()`
`Session.Log`
`getLastError()`
`Date`
`getLastRenew()`
`List<Session.Log>`
`getLogs()`
`String`
`getNode()`
`String`
`getSid()`
`SessionStatus`
`getStatus()`
`long`
`getTenantId()`
`String`
`getTenantName()`
`Map<Long,String>`
`getUnprotectedDocs()`
`User`
`getUser()`
`long`
`getUserId()`
`String`
`getUsername()`
`int`
`hashCode()`
`boolean`
`isEmpty()`
`boolean`
`isOpen()`
`void`
`logError(String message)`
`void`
`logInfo(String message)`
`void`
`logWarn(String message)`
`void`
`setClosed()`
`void`
`setDecodedKey(String decodedKey)`
Sets the key and encode it
`void`
`setFinished(Date finished)`
`void`
`setKey(String key)`
`void`
`setKeyLabel(String keyLabel)`
`void`
`setLastRenew(Date lastRenew)`
`void`
`setNode(String node)`
`void`
`setStatus(SessionStatus status)`
`void`
`setTenantId(long tenantId)`
`void`
`setTenantName(String tenantName)`
`void`
`setUsername(String username)`
`String`
`toString()`

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

`getCreation, getDeleted, getId, getLastModified, getRecordVersion, setCreation, setDeleted, setId, setLastModified, setRecordVersion`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

## Method Details

### getDictionary

public Map<String,Object> getDictionary()

### getSid

public String getSid()

### getLastRenew

public Date getLastRenew()

### isOpen

public boolean isOpen()

### setClosed

public void setClosed()

### getDecodedKey

public String getDecodedKey()

### setDecodedKey

public void setDecodedKey(String decodedKey) throws NoSuchAlgorithmException
Sets the key and encode it

Parameters:
  `decodedKey` - The key in readable format
Throws:
  `NoSuchAlgorithmException` - Crypting error

### getUsername

public String getUsername()

### toString

public String toString()

Overrides:
  `toString` in class `PersistentObject`

### getUserId

public long getUserId()

### getTenantId

public long getTenantId()

Overrides:
  `getTenantId` in class `PersistentObject`

### getTenantName

public String getTenantName()

### logError

public void logError(String message)

### logWarn

public void logWarn(String message)

### logInfo

public void logInfo(String message)

### getLogs

public List<Session.Log> getLogs()

### getLastError

public Session.Log getLastError()

### isEmpty

public boolean isEmpty()

### getDuration

public long getDuration()
Retrieves the total duration of the session

Returns:
  the duration in milliseconds

### getKey

public String getKey()

### setKey

public void setKey(String key)

### getClient

public Client getClient()

### getUser

public User getUser()

### setUsername

public void setUsername(String username)

### getImpersonator

public String getImpersonator()

### setTenantId

public void setTenantId(long tenantId)

Overrides:
  `setTenantId` in class `PersistentObject`

### setTenantName

public void setTenantName(String tenantName)

### getUnprotectedDocs

public Map<Long,String> getUnprotectedDocs()

### getNode

public String getNode()

### setNode

public void setNode(String node)

### setLastRenew

public void setLastRenew(Date lastRenew)

### getFinished

public Date getFinished()

### setFinished

public void setFinished(Date finished)

### getKeyLabel

public String getKeyLabel()

### setKeyLabel

public void setKeyLabel(String keyLabel)

### getStatus

public SessionStatus getStatus()

### setStatus

public void setStatus(SessionStatus status)

### compareTo

public int compareTo(Session other)

Specified by:
  `compareTo` in interface `Comparable<Session>`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `PersistentObject`

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `PersistentObject`