2.17.2: 2011-06-17

net.sf.basedb.core.data
Class UserData

java.lang.Object
  extended by net.sf.basedb.core.data.BasicData
      extended by 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:
User, Authentication overview
Last modified
$Date: 2010-10-07 08:48:16 +0200 (Thu, 07 Oct 2010) $
Hibernate: class
table="`Users`" lazy="false"

Field Summary
private  String address
           
private  Set<UserClientSettingData> clientSettings
           
private  Map<ContextIndex,ContextData> contexts
           
private  Set<UserDefaultSettingData> defaultSettings
           
private  String description
           
private  boolean disabled
           
private  String email
           
private  Date entryDate
           
private  Date expirationDate
           
private  Map<String,Object> extendedProperties
           
private  String externalId
           
private  String fax
           
private  Set<GroupData> groups
           
private  DirectoryData homeDirectory
           
private  Set<ItemKeyData> itemKeys
           
private  String login
           
static int MAX_ADDRESS_LENGTH
          The maximum length of the address that can be stored in the database.
static int MAX_EMAIL_LENGTH
          The maximum length of the email address that can be stored in the database.
static int MAX_EXTERNAL_ID_LENGTH
          The maximum length of the external ID that can be stored in the database.
static int MAX_FAX_LENGTH
          The maximum length of the fax that can be stored in the database.
static int MAX_LOGIN_LENGTH
          The maximum length of the login that can be stored in the database.
static int MAX_ORGANISATION_LENGTH
          The maximum length of the organisation that can be stored in the database.
static int MAX_PHONE_LENGTH
          The maximum length of the phone that can be stored in the database.
static int MAX_URL_LENGTH
          The maximum length of the url that can be stored in the database.
private  Set<MessageData> messages
           
private  boolean multiuserAccount
           
private  String name
           
private  String organisation
           
private  PasswordData password
           
private  String phone
           
private  Set<ProjectData> projects
           
private  QuotaData quota
           
private  GroupData quotaGroup
           
private  boolean removed
           
private  Set<RoleData> roles
           
private  boolean sendMessagesAsEmail
           
private  Set<SessionData> sessions
           
private  String systemId
           
private  String url
           
 
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
UserData()
           
 
Method Summary
 String getAddress()
          Get the address for the user, or null if unknown.
(package private)  Set<UserClientSettingData> getClientSettings()
          This is the inverse end.
 Map<ContextIndex,ContextData> getContexts()
          The saved contexts for the user.
(package private)  Set<UserDefaultSettingData> getDefaultSettings()
          This is the inverse end.
 String getDescription()
          Get the description for the item.
 String getEmail()
          Get the email address to the user, or null if unknown.
 Date getEntryDate()
          Get the date this item was added to the database.
 Date getExpirationDate()
          Get the expiration date for this user account, or null if no expiration date is set.
 Object getExtended(String name)
          Get the value of an extended property.
 String getExternalId()
          Get the external ID for the user account.
 String getFax()
          Get the fax number to the user, or null if unknown.
(package private)  Set<GroupData> getGroups()
          This is the inverse end.
 DirectoryData getHomeDirectory()
          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> getItemKeys()
          This is the inverse end.
 String getLogin()
          Get the login for the user account.
(package private)  Set<MessageData> getMessages()
          This is the inverse end.
 String getName()
          Get the name of the item.
 String getOrganisation()
          Get the organisation this user works for, or null if unknown.
 PasswordData getPassword()
          Get the PasswordData object which allows you to change the password for the user.
 String getPhone()
          Get the phone number to the user, or null if unknown.
(package private)  Set<ProjectData> getProjects()
          This is the inverse end.
 QuotaData getQuota()
          Get the quota object which holds quota information for this user.
 GroupData getQuotaGroup()
          Get the group this user is sharing quota with, or null if this user only has it's own quota.
(package private)  Set<RoleData> getRoles()
          This is the inverse end.
 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.
(package private)  Set<SessionData> getSessions()
          This is the inverse end.
 String getSystemId()
          Get the system id for the item.
 String getUrl()
          Get the URL to the user's homepage, or null if unknown.
 boolean isDisabled()
          Check if this account is disabled or enabled.
 boolean isMultiuserAccount()
          Check if this account has enabled the multiuser feature.
 boolean isRemoved()
          Check if the removed flag is set for this item.
 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.
 void setDisabled(boolean disabled)
           
 void setEmail(String email)
           
 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 setFax(String fax)
           
(package private)  void setGroups(Set<GroupData> groups)
           
 void setHomeDirectory(DirectoryData homeDirectory)
           
(package private)  void setItemKeys(Set<ItemKeyData> itemKeys)
           
 void setLogin(String login)
           
(package private)  void setMessages(Set<MessageData> messages)
           
 void setMultiuserAccount(boolean multiuserAccount)
           
 void setName(String name)
          Set the name of the item.
 void setOrganisation(String organisation)
           
(package private)  void setPassword(PasswordData password)
           
 void setPhone(String phone)
           
(package private)  void setProjects(Set<ProjectData> projects)
           
 void setQuota(QuotaData quota)
           
 void setQuotaGroup(GroupData quotaGroup)
           
 void setRemoved(boolean removed)
          Set the removed flag for this item.
(package private)  void setRoles(Set<RoleData> roles)
           
 void setSendMessagesAsEmail(boolean sendMessagesAsEmail)
           
(package private)  void setSessions(Set<SessionData> sessions)
           
 void setSystemId(String systemId)
           
 void setUrl(String url)
           
 
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 Detail

name

private String name

description

private String description

removed

private boolean removed

systemId

private String systemId

extendedProperties

private Map<String,Object> extendedProperties

entryDate

private Date entryDate

password

private PasswordData password

multiuserAccount

private boolean multiuserAccount

expirationDate

private Date expirationDate

disabled

private boolean disabled

MAX_EXTERNAL_ID_LENGTH

public static final int MAX_EXTERNAL_ID_LENGTH
The maximum length of the external ID that can be stored in the database.

See Also:
setExternalId(String), Constant Field Values

externalId

private String externalId

MAX_LOGIN_LENGTH

public static final int MAX_LOGIN_LENGTH
The maximum length of the login that can be stored in the database.

See Also:
setExternalId(String), Constant Field Values

login

private String login

MAX_ORGANISATION_LENGTH

public static final int MAX_ORGANISATION_LENGTH
The maximum length of the organisation that can be stored in the database.

See Also:
setOrganisation(String), Constant Field Values

organisation

private String organisation

MAX_ADDRESS_LENGTH

public static final int MAX_ADDRESS_LENGTH
The maximum length of the address that can be stored in the database.

See Also:
setAddress(String), Constant Field Values

address

private String address

MAX_PHONE_LENGTH

public static final int MAX_PHONE_LENGTH
The maximum length of the phone that can be stored in the database.

See Also:
setPhone(String), Constant Field Values

phone

private String phone

MAX_FAX_LENGTH

public static final int MAX_FAX_LENGTH
The maximum length of the fax that can be stored in the database.

See Also:
setFax(String), Constant Field Values

fax

private String fax

MAX_EMAIL_LENGTH

public static final int MAX_EMAIL_LENGTH
The maximum length of the email address that can be stored in the database.

See Also:
setEmail(String), Constant Field Values

email

private String email

sendMessagesAsEmail

private boolean sendMessagesAsEmail

MAX_URL_LENGTH

public static final int MAX_URL_LENGTH
The maximum length of the url that can be stored in the database.

See Also:
setUrl(String), Constant Field Values

url

private String url

quotaGroup

private GroupData quotaGroup

quota

private QuotaData quota

homeDirectory

private DirectoryData homeDirectory

groups

private Set<GroupData> groups

roles

private Set<RoleData> roles

projects

private Set<ProjectData> projects

itemKeys

private Set<ItemKeyData> itemKeys

sessions

private Set<SessionData> sessions

clientSettings

private Set<UserClientSettingData> clientSettings

defaultSettings

private Set<UserDefaultSettingData> defaultSettings

messages

private Set<MessageData> messages

contexts

private Map<ContextIndex,ContextData> contexts
Constructor Detail

UserData

public UserData()
Method Detail

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 interface IdentifiableData
Overrides:
getId in class BasicData
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

public String getName()
Description copied from interface: NameableData
Get the name of the item.

Specified by:
getName in interface NameableData
Returns:
A String with the name of the item

setName

public void setName(String name)
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 the MAX_NAME_LENGTH constant.

Specified by:
setName in interface NameableData
Parameters:
name - The new name for the item

getDescription

public String getDescription()
Description copied from interface: NameableData
Get the description for the item.

Specified by:
getDescription in interface NameableData
Returns:
A String with a description of the item

setDescription

public void setDescription(String description)
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 the MAX_DESCRIPTION_LENGTH constant.

Specified by:
setDescription in interface NameableData
Parameters:
description - The new description for the item

isRemoved

public boolean isRemoved()
Description copied from interface: RemovableData
Check if the removed flag is set for this item.

Specified by:
isRemoved in interface RemovableData
Returns:
TRUE if the item is flagged as removed, FALSE otherwise

setRemoved

public void setRemoved(boolean removed)
Description copied from interface: RemovableData
Set the removed flag for this item.

Specified by:
setRemoved in interface RemovableData
Parameters:
removed - TRUE if the item should be flagged as removed, FALSE otherwise

getSystemId

public String getSystemId()
Description copied from interface: SystemData
Get the system id for the item.

Specified by:
getSystemId in interface SystemData
Returns:
The id of the item or null

setSystemId

public void setSystemId(String systemId)

getExtended

public Object getExtended(String name)
Description copied from interface: ExtendableData
Get the value of an extended property.

Specified by:
getExtended in interface ExtendableData
Parameters:
name - The name of the property
Returns:
The value of the property or null if not found
Since:
2.4

setExtended

public void setExtended(String name,
                        Object value)
Description copied from interface: ExtendableData
Set the value of an extended property.

Specified by:
setExtended in interface ExtendableData
Parameters:
name - The name of the property
value - The new value for the property
Since:
2.4

getEntryDate

public Date 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 interface RegisteredData

setEntryDate

public void setEntryDate(Date entryDate)

getPassword

public PasswordData getPassword()
Get the PasswordData 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

void setPassword(PasswordData password)

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

public Date 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

public void setExpirationDate(Date expirationDate)

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

public String getExternalId()
Get the external ID for the user account.

Hibernate: property
column="`external_id`" type="string" length="255" not-null="false" unique="true"

setExternalId

public void setExternalId(String externalId)

getLogin

public String getLogin()
Get the login for the user account.

Hibernate: property
column="`login`" type="string" length="255" not-null="true" unique="true"

setLogin

public void setLogin(String login)

getOrganisation

public String getOrganisation()
Get the organisation this user works for, or null if unknown.

Hibernate: property
column="`organisation`" type="string" length="255"

setOrganisation

public void setOrganisation(String organisation)

getAddress

public String getAddress()
Get the address for the user, or null if unknown.

Hibernate: property
column="`address`" type="string" length="255"

setAddress

public void setAddress(String address)

getPhone

public String getPhone()
Get the phone number to the user, or null if unknown.

Hibernate: property
column="`phone`" type="string" length="255"

setPhone

public void setPhone(String phone)

getFax

public String getFax()
Get the fax number to the user, or null if unknown.

Hibernate: property
column="`fax`" type="string" length="255"

setFax

public void setFax(String fax)

getEmail

public String getEmail()
Get the email address to the user, or null if unknown.

Hibernate: property
column="`email`" type="string" length="255"

setEmail

public void setEmail(String email)

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

public String getUrl()
Get the URL to the user's homepage, or null if unknown.

Hibernate: property
column="`url`" type="string" length="255"

setUrl

public void setUrl(String url)

getQuotaGroup

public GroupData getQuotaGroup()
Get the group this user is sharing quota with, or null if this user only has it's own quota.

See Also:
getQuota()
Hibernate: many-to-one
column="`quotagroup_id`" not-null="false" outer-join="false"

setQuotaGroup

public void setQuotaGroup(GroupData quotaGroup)

getQuota

public QuotaData getQuota()
Get the quota object which holds quota information for this user.

See Also:
getQuotaGroup()
Hibernate: many-to-one
column="`quota_id`" not-null="true" outer-join="false"

setQuota

public void setQuota(QuotaData quota)

getHomeDirectory

public DirectoryData getHomeDirectory()
Get the home directory for this user.

See Also:
getQuota()
Hibernate: many-to-one
column="`homedirectory_id`" not-null="false" outer-join="false"

setHomeDirectory

public void setHomeDirectory(DirectoryData homeDirectory)

getGroups

Set<GroupData> getGroups()
This is the inverse end.

See Also:
GroupData.getUsers()
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

void setGroups(Set<GroupData> groups)

getRoles

Set<RoleData> getRoles()
This is the inverse end.

See Also:
RoleData.getUsers()
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

void setRoles(Set<RoleData> roles)

getProjects

Set<ProjectData> getProjects()
This is the inverse end.

See Also:
ProjectData.getUsers()
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

void setProjects(Set<ProjectData> projects)

getItemKeys

Set<ItemKeyData> getItemKeys()
This is the inverse end.

See Also:
ItemKeyData.getUsers()
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

void setItemKeys(Set<ItemKeyData> itemKeys)

getSessions

Set<SessionData> getSessions()
This is the inverse end.

See Also:
SessionData.getUser()
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

void setSessions(Set<SessionData> sessions)

getClientSettings

Set<UserClientSettingData> getClientSettings()
This is the inverse end.

See Also:
UserClientSettingData.getUser()
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

void setClientSettings(Set<UserClientSettingData> clientSettings)

getDefaultSettings

Set<UserDefaultSettingData> getDefaultSettings()
This is the inverse end.

See Also:
UserDefaultSettingData.getUser()
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

void setDefaultSettings(Set<UserDefaultSettingData> defaultSettings)

getMessages

Set<MessageData> getMessages()
This is the inverse end.

See Also:
MessageData.getTo()
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

void setMessages(Set<MessageData> messages)

getContexts

public Map<ContextIndex,ContextData> getContexts()
The saved contexts for the user. This is the inverse end.

See Also:
ContextData.getUser()
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

void setContexts(Map<ContextIndex,ContextData> contexts)

2.17.2: 2011-06-17