Package net.sf.basedb.core.data
Class UserDeviceData
java.lang.Object
net.sf.basedb.core.data.BasicData
net.sf.basedb.core.data.UserDeviceData
- All Implemented Interfaces:
IdentifiableData
,NameableData
,RegisteredData
This class holds information about a verified user device.
The
getToken()
is randomly generated token that
each device is supposed to keep track of and submit together
with the login info.- Since:
- 3.12
- Author:
- Nicklas
- Hibernate: class
- table="`UserDevices`" lazy="false"
-
Field Summary
Modifier and TypeFieldDescriptionprivate ClientData
private String
private Date
private boolean
private Date
private String
private Float
private Float
static final int
The maximum length of the location that can be stored in the database.static final int
The maximum length of the remote ID that can be stored in the database.static final int
The maximum length of the device token that can be stored in the database.static final int
The maximum length of the user agent that can be stored in the database.private String
private String
private Set<SessionData>
private String
private UserData
private String
Fields inherited from interface net.sf.basedb.core.data.NameableData
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet the client application this device is associated with.Get the description for the item.Get the date this item was added to the database.Get the remote id (=ip address) of the last login from this device.Get the date and time the user last logged in from this device.Get the location of the user (if known).Get the location latitude of the user (if known).Get the location longitude of the user (if known).getName()
Get the name of the item.(package private) Set<SessionData>
This is the inverse end but we do not map with inverse="true" cascade="delete" since we want Hibernate to set SessionData.device_id = null instead of deleting sessions.getToken()
Get the device token.getUser()
The user that this device is associated with.Get a string with more information about the device (eg.boolean
This flag is TRUE if the device has been verified (by sending a code via email).void
setClient
(ClientData client) void
setDescription
(String description) Set the description for the item.void
setEntryDate
(Date entryDate) void
setLastRemoteId
(String remoteId) void
setLastUsed
(Date lastUsed) void
setLocation
(String location) void
setLocationLatitude
(Float locationLat) void
setLocationLongitude
(Float locationLong) void
Set the name of the item.(package private) void
setSessions
(Set<SessionData> sessions) void
void
void
setUserAgent
(String userAgent) void
setVerified
(boolean isVerified) Methods inherited from class net.sf.basedb.core.data.BasicData
equals, getId, getVersion, hashCode, setId, setVersion, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.sf.basedb.core.data.IdentifiableData
getId, getVersion
-
Field Details
-
user
-
client
-
entryDate
-
name
-
description
-
MAX_TOKEN_LENGTH
public static final int MAX_TOKEN_LENGTHThe maximum length of the device token that can be stored in the database.- See Also:
-
token
-
MAX_USER_AGENT_LENGTH
public static final int MAX_USER_AGENT_LENGTHThe maximum length of the user agent that can be stored in the database.- See Also:
-
userAgent
-
lastUsed
-
MAX_REMOTE_ID_LENGTH
public static final int MAX_REMOTE_ID_LENGTHThe maximum length of the remote ID that can be stored in the database.- See Also:
-
remoteId
-
MAX_LOCATION_LENGTH
public static final int MAX_LOCATION_LENGTHThe maximum length of the location that can be stored in the database.- See Also:
-
location
-
locationLat
-
locationLong
-
isVerified
private boolean isVerified -
sessions
-
-
Constructor Details
-
UserDeviceData
public UserDeviceData()
-
-
Method Details
-
getUser
The user that this device is associated with.- Hibernate: many-to-one
- column="`user_id`" not-null="true" update="false" outer-join="false"
-
setUser
-
getClient
Get the client application this device is associated with.- Hibernate: many-to-one
- column="`client_id`" not-null="true" update="false" outer-join="false"
-
setClient
-
getEntryDate
Description copied from interface:RegisteredData
Get the date this item was added to the database. The value is generated at creation time and can't be modified later.- Specified by:
getEntryDate
in interfaceRegisteredData
-
setEntryDate
-
getName
Description copied from interface:NameableData
Get the name of the item.- Specified by:
getName
in interfaceNameableData
- Returns:
- A
String
with the name of the item
-
setName
Description copied from interface:NameableData
Set the name of the item. The name cannot be null and mustn't be longer than the value specified by theMAX_NAME_LENGTH
constant.- Specified by:
setName
in interfaceNameableData
- Parameters:
name
- The new name for the item
-
getDescription
Description copied from interface:NameableData
Get the description for the item.- Specified by:
getDescription
in interfaceNameableData
- Returns:
- A
String
with a description of the item
-
setDescription
Description copied from interface:NameableData
Set the description for the item. The description can be null but mustn't be longer than the value specified by theMAX_DESCRIPTION_LENGTH
constant.- Specified by:
setDescription
in interfaceNameableData
- Parameters:
description
- The new description for the item
-
getToken
Get the device token.- Hibernate: property
- column="`token`" type="string" length="255" not-null="true" update="false"
-
setToken
-
getUserAgent
Get a string with more information about the device (eg. User-Agent from a web browser).- Hibernate: property
- column="`user_agent`" type="text" not-null="false"
-
setUserAgent
-
getLastUsed
Get the date and time the user last logged in from this device.- Hibernate: property
- column="`last_used`" type="timestamp" not-null="true"
-
setLastUsed
-
getLastRemoteId
Get the remote id (=ip address) of the last login from this device.- Hibernate: property
- column="`lastremote_id`" type="string" length="255" not-null="false"
-
setLastRemoteId
-
getLocation
Get the location of the user (if known).- Hibernate: property
- column="`location`" type="string" length="255" not-null="false"
-
setLocation
-
getLocationLatitude
Get the location latitude of the user (if known).- Hibernate: property
- column="`location_lat`" type="float" not-null="false"
-
setLocationLatitude
-
getLocationLongitude
Get the location longitude of the user (if known).- Hibernate: property
- column="`location_long`" type="float" not-null="false"
-
setLocationLongitude
-
isVerified
public boolean isVerified()This flag is TRUE if the device has been verified (by sending a code via email).- Since:
- 3.17 Mapped in hibernate-properties-UserDeviceData.xml since default is not supported in XDoclet //hibernate.property column="`is_verified`" type="boolean" not-null="true" default="false"
-
setVerified
public void setVerified(boolean isVerified) -
getSessions
Set<SessionData> getSessions()This is the inverse end but we do not map with inverse="true" cascade="delete" since we want Hibernate to set SessionData.device_id = null instead of deleting sessions.- See Also:
- Hibernate: set
- lazy="true"
- Hibernate: collection-key
- column="`device_id`"
- Hibernate: collection-one-to-many
- class="net.sf.basedb.core.data.SessionData"
-
setSessions
-