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:
User, Developer documentation: User authentication
Last modified
$Date: 2017-10-04 12:59:03 +0200 (on, 04 okt 2017) $
Hibernate: class
table="`Users`" lazy="false"
  • Field Details

  • 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 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
    • getRemovedBy

      public Integer getRemovedBy()
      Description copied from interface: RemovableData
      Get the ID of the user that removed this item.
      Specified by:
      getRemovedBy in interface RemovableData
      Returns:
      The ID of a user or null if the item is not removed
    • setRemovedBy

      public void setRemovedBy​(Integer removedBy)
      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 interface RemovableData
    • 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

      @PropertyPathProtected 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)
    • 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

      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)
    • getDevices

      Set<UserDeviceData> getDevices()
      This is the inverse end.
      Since:
      3.12
      See Also:
      UserDeviceData.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.UserDeviceData"
    • setDevices

      void setDevices​(Set<UserDeviceData> devices)
    • 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)