public class UserDevice extends BasicItem implements Registered, Nameable
Modifier and Type | Field and Description |
---|---|
static Item |
TYPE
The type of item represented by this class.
|
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
Constructor and Description |
---|
UserDevice(UserDeviceData deviceData) |
Modifier and Type | Method and Description |
---|---|
static UserDevice |
getById(DbControl dc,
int id)
Get a
UserDevice item when you know the ID. |
Client |
getClient()
Get the client application the user was using with this device.
|
(package private) UserDeviceData |
getData()
Get the
BasicData object that holds all data for this item. |
java.lang.String |
getDescription()
Get the description for the item.
|
java.util.Date |
getEntryDate()
Get the date that the item was registered in the database.
|
java.lang.String |
getLastRemoteId()
Get the remote ID of the host the user used for this device the last time.
|
java.util.Date |
getLastUsed()
Get the date and time the user last used this device.
|
java.lang.String |
getLocation()
Get the last known location of the device.
|
java.lang.Float |
getLocationLatitude()
Get the last known location latitude of the device.
|
java.lang.Float |
getLocationLongitude()
Get the last known location longitude of the device.
|
java.lang.String |
getName()
Get the name of the item.
|
static ItemQuery<UserDevice> |
getQuery(User user)
Get a query configured to retrieve devices for the specified user.
|
Item |
getType()
Get the type of item represented by the object.
|
User |
getUser()
Get the user that owns this device.
|
java.lang.String |
getUserAgent()
Get the user agent string of this device.
|
(package private) void |
initPermissions(int granted,
int denied)
DELETE permission is granted if the logged in user is the owner of this
device.
|
void |
setDescription(java.lang.String description)
Set the description for the item.
|
void |
setEntryDate(java.util.Date entryDate)
Set the date the entry was registered in the database.
|
void |
setName(java.lang.String name)
Set the name of the item.
|
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
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getId, getVersion
checkPermission, getPermissions, hasPermission
public static final Item TYPE
Item.USERDEVICE
,
getType()
UserDevice(UserDeviceData deviceData)
public static UserDevice getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
UserDevice
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 loadUserDevice
itemItemNotFoundException
PermissionDeniedException
BaseException
public static ItemQuery<UserDevice> getQuery(User user)
user
- The user to retreive devices for, null is allowed if
the logged in user has generic READ permission for devices in which
case all devices will be returnedItemQuery
objectUserDeviceData getData()
BasicItem
BasicData
object that holds all data for this item.public Item getType()
Identifiable
Item
enumeration.getType
in interface Identifiable
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 java.util.Date getEntryDate()
Registered
getEntryDate
in interface Registered
public void setEntryDate(java.util.Date entryDate)
Registered
setEntryDate
in interface Registered
entryDate
- A date or null to use today's datepublic java.lang.String getName()
Nameable
public void setName(java.lang.String name) throws PermissionDeniedException, InvalidDataException
Nameable
Nameable.MAX_NAME_LENGTH
constant.setName
in interface Nameable
name
- The new name for the itemPermissionDeniedException
- If the logged in user doesn't
have write permissionInvalidDataException
- If the name is null or longer
than specified by the Nameable.MAX_NAME_LENGTH
constantpublic java.lang.String getDescription()
Nameable
getDescription
in interface Nameable
String
with a description of the itempublic void setDescription(java.lang.String description) throws PermissionDeniedException, InvalidDataException
Nameable
Nameable.MAX_DESCRIPTION_LENGTH
constant.setDescription
in interface Nameable
description
- The new description for the itemPermissionDeniedException
- If the logged in user doesn't
have write permissionInvalidDataException
- If the description longer
than specified by the Nameable.MAX_DESCRIPTION_LENGTH
constantpublic 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 java.util.Date getLastUsed()
Date
object with the date and timepublic java.lang.String getUserAgent()
public java.lang.String getLastRemoteId()
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 known