public class Session extends BasicItem
A session said to be active when the user is logged in.
Modifier and Type | Field and Description |
---|---|
static Item |
TYPE
The type of item represented by this class.
|
Constructor and Description |
---|
Session(SessionData sessionData) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAuthenticationMethod()
Get the authentication method that was used to login to
this session.
|
static Session |
getById(DbControl dc,
int id)
Get a
Session item when you know the ID. |
Client |
getClient()
Get the client application the user was using in this session.
|
(package private) SessionData |
getData()
Get the
BasicData object that holds all data for this item. |
UserDevice |
getDevice()
Get the device the user was using in this session.
|
boolean |
getImpersonated()
Check if another user was acting as the user of this session.
|
java.lang.String |
getLocation()
Get the location of the host the user used for this session.
|
java.lang.Float |
getLocationLatitude()
Get the location latitude of the host the user used for this session.
|
java.lang.Float |
getLocationLongitude()
Get the location longitude of the host the user used for this session.
|
java.lang.String |
getLoginComment()
Get the login comment.
|
java.util.Date |
getLoginTime()
Get the date and time the user logged in.
|
java.util.Date |
getLogoutTime()
Get the date and time the user logged out.
|
static ItemQuery<Session> |
getQuery(User user)
Get a query configured to retrieve sessions for the specified user.
|
java.lang.String |
getRemoteId()
Get the remote ID of the host the user used for this session.
|
Item |
getType()
Get the type of item represented by the object.
|
User |
getUser()
Get the user that logged in with this session.
|
(package private) void |
initPermissions(int granted,
int denied)
READ permission is granted if the logged in user is the owner of this
session.
|
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, toString, validate
public static final Item TYPE
Item.SESSION
,
getType()
Session(SessionData sessionData)
public static Session getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
Session
item when you know the ID.dc
- The DbControl
which will be used for
permission checking and database access.id
- The ID of the item to loadSession
itemItemNotFoundException
- If an item with the specified
ID is not foundPermissionDeniedException
- If the logged in user doesn't
have Permission.READ
permission to the itemBaseException
- If there is another errorpublic static ItemQuery<Session> getQuery(User user)
user
- The user to retreive sessions for, null is allowed if
the logged in user has generic READ permission for sessions in which case
all sessions will be returnedItemQuery
objectSessionData getData()
BasicItem
BasicData
object that holds all data for this item.public Item getType()
Identifiable
Item
enumeration.void initPermissions(int granted, int denied) throws BaseException
initPermissions
in class BasicItem
granted
- Permissions that have been granted by the subclassdenied
- Permissions that have been denied by the subclassBaseException
- If the permissions couldn't be initialisedpublic User getUser() throws PermissionDeniedException, BaseException
User
itemPermissionDeniedException
- If the logged in user doesn't have
Permission.READ
permissionBaseException
- If there is another errorpublic Client getClient() throws PermissionDeniedException, BaseException
Client
item, or null if not knownPermissionDeniedException
- If the logged in user doesn't
have Permission.READ
permissionBaseException
- If there is another errorpublic UserDevice getDevice() throws PermissionDeniedException, BaseException
UserDevice
item, or null if not knownPermissionDeniedException
- If the logged in user doesn't
have Permission.READ
permissionBaseException
- If there is another errorpublic java.util.Date getLoginTime()
Date
object with the login timepublic java.util.Date getLogoutTime()
Date
object with the logout timepublic java.lang.String getLoginComment()
String
object with the login commentpublic boolean getImpersonated()
public java.lang.String getRemoteId()
String
object with remote IDpublic java.lang.String getLocation()
String
object with location or null if not knownpublic java.lang.Float getLocationLatitude()
Float
object with latitude or null if not knownpublic java.lang.Float getLocationLongitude()
Float
object with longitude or null if not knownpublic java.lang.String getAuthenticationMethod()