Package net.sf.basedb.core.data
Class UserData
java.lang.Object
net.sf.basedb.core.data.BasicData
net.sf.basedb.core.data.UserData
- All Implemented Interfaces:
ExtendableData
,IdentifiableData
,NameableData
,RegisteredData
,RemovableData
,SystemData
public class UserData
extends BasicData
implements NameableData, RemovableData, SystemData, ExtendableData, RegisteredData
This class holds information about a user.
- Version:
- 2.0
- Author:
- Nicklas
- See Also:
- Last modified
- $Date: 2017-10-04 12:59:03 +0200 (on, 04 okt 2017) $
- Hibernate: class
- table="`Users`" lazy="false"
-
Field Summary
Modifier and TypeFieldDescriptionprivate String
private Set<UserClientSettingData>
private Map<ContextIndex,
ContextData> private Set<UserDefaultSettingData>
private String
private Set<UserDeviceData>
private boolean
private String
private Date
private Date
private String
private String
private DirectoryData
private Set<ItemKeyData>
private String
static final int
The maximum length of the address that can be stored in the database.static final int
The maximum length of the email address that can be stored in the database.static final int
The maximum length of the external ID that can be stored in the database.static final int
The maximum length of the fax that can be stored in the database.static final int
The maximum length of the login that can be stored in the database.static final int
The maximum length of the organisation that can be stored in the database.static final int
The maximum length of the phone that can be stored in the database.static final int
The maximum length of the url that can be stored in the database.private Set<MessageData>
private boolean
private String
private String
private PasswordData
private String
private Set<ProjectData>
private QuotaData
private GroupData
private Integer
private boolean
private Set<SessionData>
private String
private String
private boolean
Fields inherited from interface net.sf.basedb.core.data.NameableData
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
Fields inherited from interface net.sf.basedb.core.data.SystemData
MAX_SYSTEM_ID_LENGTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet the address for the user, or null if unknown.(package private) Set<UserClientSettingData>
This is the inverse end.The saved contexts for the user.(package private) Set<UserDefaultSettingData>
This is the inverse end.Get the description for the item.(package private) Set<UserDeviceData>
This is the inverse end.getEmail()
Get the email address to the user, or null if unknown.Get the date this item was added to the database.Get the expiration date for this user account, or null if no expiration date is set.getExtended
(String name) Get the value of an extended property.Get the external ID for the user account.getFax()
Get the fax number to the user, or null if unknown.This is the inverse end.Get the home directory for this user.int
getId()
We must override this method because the id must be the same as the id for the password.(package private) Set<ItemKeyData>
This is the inverse end.getLogin()
Get the login for the user account.(package private) Set<MessageData>
This is the inverse end.getName()
Get the name of the item.Get the organisation this user works for, or null if unknown.Get thePasswordData
object which allows you to change the password for the user.getPhone()
Get the phone number to the user, or null if unknown.(package private) Set<ProjectData>
This is the inverse end.getQuota()
Get the quota object which holds quota information for this user.Get the group this user is sharing quota with, or null if this user only has it's own quota.Get the ID of the user that removed this item.getRoles()
This is the inverse end.boolean
If this flag is set, all messages to this user are sent as an email also, but only if: the server admin has configured an outgoing smtp server and the user has supplied a valid email address.(package private) Set<SessionData>
This is the inverse end.Get the system id for the item.getUrl()
Get the URL to the user's homepage, or null if unknown.boolean
A flag indicating if this user want to use device verification.boolean
Check if this account is disabled or enabled.boolean
Check if this account has enabled the multiuser feature.void
setAddress
(String address) (package private) void
setClientSettings
(Set<UserClientSettingData> clientSettings) (package private) void
setContexts
(Map<ContextIndex, ContextData> contexts) (package private) void
setDefaultSettings
(Set<UserDefaultSettingData> defaultSettings) void
setDescription
(String description) Set the description for the item.(package private) void
setDevices
(Set<UserDeviceData> devices) void
setDisabled
(boolean disabled) void
void
setEntryDate
(Date entryDate) void
setExpirationDate
(Date expirationDate) void
setExtended
(String name, Object value) Set the value of an extended property.void
setExternalId
(String externalId) void
(package private) void
void
setHomeDirectory
(DirectoryData homeDirectory) (package private) void
setItemKeys
(Set<ItemKeyData> itemKeys) void
(package private) void
setMessages
(Set<MessageData> messages) void
setMultiuserAccount
(boolean multiuserAccount) void
Set the name of the item.void
setOrganisation
(String organisation) (package private) void
setPassword
(PasswordData password) void
(package private) void
setProjects
(Set<ProjectData> projects) void
void
setQuotaGroup
(GroupData quotaGroup) void
setRemovedBy
(Integer removedBy) Set the ID of the user that removed this item or null to restore the item.(package private) void
void
setSendMessagesAsEmail
(boolean sendMessagesAsEmail) (package private) void
setSessions
(Set<SessionData> sessions) void
setSystemId
(String systemId) void
void
setUseDeviceVerification
(boolean useDeviceVerification) Methods inherited from class net.sf.basedb.core.data.BasicData
equals, 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
getVersion
-
Field Details
-
name
-
description
-
removedBy
-
systemId
-
extendedProperties
-
entryDate
-
password
-
useDeviceVerification
private boolean useDeviceVerification -
multiuserAccount
private boolean multiuserAccount -
expirationDate
-
disabled
private boolean disabled -
MAX_EXTERNAL_ID_LENGTH
public static final int MAX_EXTERNAL_ID_LENGTHThe maximum length of the external ID that can be stored in the database.- See Also:
-
externalId
-
MAX_LOGIN_LENGTH
public static final int MAX_LOGIN_LENGTHThe maximum length of the login that can be stored in the database.- See Also:
-
login
-
MAX_ORGANISATION_LENGTH
public static final int MAX_ORGANISATION_LENGTHThe maximum length of the organisation that can be stored in the database.- See Also:
-
organisation
-
MAX_ADDRESS_LENGTH
public static final int MAX_ADDRESS_LENGTHThe maximum length of the address that can be stored in the database.- See Also:
-
address
-
MAX_PHONE_LENGTH
public static final int MAX_PHONE_LENGTHThe maximum length of the phone that can be stored in the database.- See Also:
-
phone
-
MAX_FAX_LENGTH
public static final int MAX_FAX_LENGTHThe maximum length of the fax that can be stored in the database.- See Also:
-
fax
-
MAX_EMAIL_LENGTH
public static final int MAX_EMAIL_LENGTHThe maximum length of the email address that can be stored in the database.- See Also:
-
email
-
sendMessagesAsEmail
private boolean sendMessagesAsEmail -
MAX_URL_LENGTH
public static final int MAX_URL_LENGTHThe maximum length of the url that can be stored in the database.- See Also:
-
url
-
quotaGroup
-
quota
-
homeDirectory
-
groups
-
roles
-
projects
-
itemKeys
-
devices
-
sessions
-
clientSettings
-
defaultSettings
-
messages
-
contexts
-
-
Constructor Details
-
UserData
public UserData()
-
-
Method Details
-
getId
public int getId()We must override this method because the id must be the same as the id for the password.- Specified by:
getId
in interfaceIdentifiableData
- Overrides:
getId
in classBasicData
- Returns:
- The id of the item or 0
- Hibernate: id
- column="`id`" generator-class="foreign" unsaved-value="0"
- Hibernate: generator-param
- name="property" value="password"
-
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
-
getRemovedBy
Description copied from interface:RemovableData
Get the ID of the user that removed this item.- Specified by:
getRemovedBy
in interfaceRemovableData
- Returns:
- The ID of a user or null if the item is not removed
-
setRemovedBy
Description copied from interface:RemovableData
Set the ID of the user that removed this item or null to restore the item.- Specified by:
setRemovedBy
in interfaceRemovableData
-
getSystemId
Description copied from interface:SystemData
Get the system id for the item.- Specified by:
getSystemId
in interfaceSystemData
- Returns:
- The id of the item or null
-
setSystemId
-
getExtended
Description copied from interface:ExtendableData
Get the value of an extended property.- Specified by:
getExtended
in interfaceExtendableData
- Parameters:
name
- The name of the property- Returns:
- The value of the property or null if not found
- Since:
- 2.4
-
setExtended
Description copied from interface:ExtendableData
Set the value of an extended property.- Specified by:
setExtended
in interfaceExtendableData
- Parameters:
name
- The name of the propertyvalue
- The new value for the property- Since:
- 2.4
-
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
-
getPassword
Get thePasswordData
object which allows you to change the password for the user. This is never null and is automatically deleted when the user a user is deleted.- Hibernate: one-to-one
- class="net.sf.basedb.core.data.PasswordData" cascade="all" outer-join="false" constrained="true"
-
setPassword
-
getUseDeviceVerification
public boolean getUseDeviceVerification()A flag indicating if this user want to use device verification.- Since:
- 3.12 NOTE! This property is mapped in hibernate-properties-UserData.xml since 'default' is not supported by XDoclet //hibernate.property type="boolean" //hibernate.column name="`use_device_verification`" not-null="true" default="false"
-
setUseDeviceVerification
public void setUseDeviceVerification(boolean useDeviceVerification) -
isMultiuserAccount
public boolean isMultiuserAccount()Check if this account has enabled the multiuser feature.- Hibernate: property
- column="`multiuser_account`" type="boolean" not-null="true"
-
setMultiuserAccount
public void setMultiuserAccount(boolean multiuserAccount) -
getExpirationDate
Get the expiration date for this user account, or null if no expiration date is set. Since the date object is mutable it must be copied if it is returned to client applications:return new Date(userdata.getExpirationDate());
- Hibernate: property
- column="`expiration_date`" type="date" not-null="false"
-
setExpirationDate
-
isDisabled
public boolean isDisabled()Check if this account is disabled or enabled.- Hibernate: property
- column="`disabled`" type="boolean" not-null="true"
-
setDisabled
public void setDisabled(boolean disabled) -
getExternalId
Get the external ID for the user account.- Hibernate: property
- column="`external_id`" type="string" length="255" not-null="false" unique="true"
-
setExternalId
-
getLogin
Get the login for the user account.- Hibernate: property
- column="`login`" type="string" length="255" not-null="true" unique="true"
-
setLogin
-
getOrganisation
Get the organisation this user works for, or null if unknown.- Hibernate: property
- column="`organisation`" type="string" length="255"
-
setOrganisation
-
getAddress
Get the address for the user, or null if unknown.- Hibernate: property
- column="`address`" type="string" length="255"
-
setAddress
-
getPhone
Get the phone number to the user, or null if unknown.- Hibernate: property
- column="`phone`" type="string" length="255"
-
setPhone
-
getFax
Get the fax number to the user, or null if unknown.- Hibernate: property
- column="`fax`" type="string" length="255"
-
setFax
-
getEmail
Get the email address to the user, or null if unknown.- Hibernate: property
- column="`email`" type="string" length="255"
-
setEmail
-
getSendMessagesAsEmail
public boolean getSendMessagesAsEmail()If this flag is set, all messages to this user are sent as an email also, but only if: the server admin has configured an outgoing smtp server and the user has supplied a valid email address. NOTE! This property is mapped in hibernate-properties-UserData.xml since 'default' is not supported by XDoclet //hibernate.property type="boolean" //hibernate.column name="`send_messages_as_email`" not-null="true" default="false"- Since:
- 2.16
-
setSendMessagesAsEmail
public void setSendMessagesAsEmail(boolean sendMessagesAsEmail) -
getUrl
Get the URL to the user's homepage, or null if unknown.- Hibernate: property
- column="`url`" type="string" length="255"
-
setUrl
-
getQuotaGroup
Get the group this user is sharing quota with, or null if this user only has it's own quota.- See Also:
- Hibernate: many-to-one
- column="`quotagroup_id`" not-null="false" outer-join="false"
-
setQuotaGroup
-
getQuota
Get the quota object which holds quota information for this user.- See Also:
- Hibernate: many-to-one
- column="`quota_id`" not-null="true" outer-join="false"
-
setQuota
-
getHomeDirectory
Get the home directory for this user.- See Also:
- Hibernate: many-to-one
- column="`homedirectory_id`" not-null="false" outer-join="false"
-
setHomeDirectory
-
getGroups
This is the inverse end.- See Also:
- Hibernate: set
- table="`UserGroups`" lazy="true"
- Hibernate: collection-key
- column="`user_id`"
- Hibernate: collection-many-to-many
- column="`group_id`" class="net.sf.basedb.core.data.GroupData"
-
setGroups
-
getRoles
This is the inverse end.- See Also:
- Hibernate: set
- table="`UserRoles`" lazy="true"
- Hibernate: collection-key
- column="`user_id`"
- Hibernate: collection-many-to-many
- column="`role_id`" class="net.sf.basedb.core.data.RoleData"
-
setRoles
-
getProjects
Set<ProjectData> getProjects()This is the inverse end.- See Also:
- Hibernate: set
- table="`UserProjects`" lazy="true"
- Hibernate: collection-key
- column="`user_id`"
- Hibernate: collection-many-to-many
- column="`project_id`" class="net.sf.basedb.core.data.ProjectData"
-
setProjects
-
getItemKeys
Set<ItemKeyData> getItemKeys()This is the inverse end.- See Also:
- Hibernate: set
- table="`UserKeys`" lazy="true"
- Hibernate: collection-key
- column="`user_id`"
- Hibernate: collection-many-to-many
- column="`key_id`" class="net.sf.basedb.core.data.ItemKeyData"
-
setItemKeys
-
getDevices
Set<UserDeviceData> getDevices()This is the inverse end.- Since:
- 3.12
- See Also:
- Hibernate: set
- lazy="true" inverse="true" cascade="delete"
- Hibernate: collection-key
- column="`user_id`"
- Hibernate: collection-one-to-many
- class="net.sf.basedb.core.data.UserDeviceData"
-
setDevices
-
getSessions
Set<SessionData> getSessions()This is the inverse end.- See Also:
- Hibernate: set
- lazy="true" inverse="true" cascade="delete"
- Hibernate: collection-key
- column="`user_id`"
- Hibernate: collection-one-to-many
- class="net.sf.basedb.core.data.SessionData"
-
setSessions
-
getClientSettings
Set<UserClientSettingData> getClientSettings()This is the inverse end.- See Also:
- Hibernate: set
- lazy="true" inverse="true" cascade="delete"
- Hibernate: collection-key
- column="`user_id`"
- Hibernate: collection-one-to-many
- class="net.sf.basedb.core.data.UserClientSettingData"
-
setClientSettings
-
getDefaultSettings
Set<UserDefaultSettingData> getDefaultSettings()This is the inverse end.- See Also:
- Hibernate: set
- lazy="true" inverse="true" cascade="delete"
- Hibernate: collection-key
- column="`user_id`"
- Hibernate: collection-one-to-many
- class="net.sf.basedb.core.data.UserDefaultSettingData"
-
setDefaultSettings
-
getMessages
Set<MessageData> getMessages()This is the inverse end.- See Also:
- Hibernate: set
- lazy="true" inverse="true" cascade="delete"
- Hibernate: collection-key
- column="`to_user_id`"
- Hibernate: collection-one-to-many
- class="net.sf.basedb.core.data.MessageData"
-
setMessages
-
getContexts
The saved contexts for the user. This is the inverse end.- See Also:
- Hibernate: map
- lazy="true" inverse="true" cascade="delete"
- Hibernate: collection-key
- column="`user_id`"
- Hibernate: collection-composite-index
- class="net.sf.basedb.core.data.ContextIndex"
- Hibernate: collection-one-to-many
- class="net.sf.basedb.core.data.ContextData"
-
setContexts
-