Class User

  • All Implemented Interfaces:
    java.io.Serializable, java.security.Principal

    public class User
    extends java.lang.Object
    implements java.security.Principal, java.io.Serializable
    Default user profile object.
    Author:
    muzquiano, kevinr
    See Also:
    Serialized Form
    • Field Detail

      • PROP_ID

        public static java.lang.String PROP_ID
      • PROP_FIRST_NAME

        public static java.lang.String PROP_FIRST_NAME
      • PROP_MIDDLE_NAME

        public static java.lang.String PROP_MIDDLE_NAME
      • PROP_LAST_NAME

        public static java.lang.String PROP_LAST_NAME
      • PROP_EMAIL

        public static java.lang.String PROP_EMAIL
      • PROP_ORGANIZATION

        public static java.lang.String PROP_ORGANIZATION
      • PROP_JOB_TITLE

        public static java.lang.String PROP_JOB_TITLE
      • PROP_LOCATION

        public static java.lang.String PROP_LOCATION
      • PROP_BIOGRAPHY

        public static java.lang.String PROP_BIOGRAPHY
      • PROP_TELEPHONE

        public static java.lang.String PROP_TELEPHONE
      • PROP_MOBILE_PHONE

        public static java.lang.String PROP_MOBILE_PHONE
      • PROP_SKYPE

        public static java.lang.String PROP_SKYPE
      • PROP_INSTANTMSG

        public static java.lang.String PROP_INSTANTMSG
      • PROP_GOOGLEUSERNAME

        public static java.lang.String PROP_GOOGLEUSERNAME
      • PROP_COMPANY_ADDRESS1

        public static java.lang.String PROP_COMPANY_ADDRESS1
      • PROP_COMPANY_ADDRESS2

        public static java.lang.String PROP_COMPANY_ADDRESS2
      • PROP_COMPANY_ADDRESS3

        public static java.lang.String PROP_COMPANY_ADDRESS3
      • PROP_COMPANY_POSTCODE

        public static java.lang.String PROP_COMPANY_POSTCODE
      • PROP_COMPANY_TELEPHONE

        public static java.lang.String PROP_COMPANY_TELEPHONE
      • PROP_COMPANY_FAX

        public static java.lang.String PROP_COMPANY_FAX
      • PROP_COMPANY_EMAIL

        public static java.lang.String PROP_COMPANY_EMAIL
      • CAPABILITY_ADMIN

        public static final java.lang.String CAPABILITY_ADMIN
        See Also:
        Constant Field Values
      • CAPABILITY_GUEST

        public static final java.lang.String CAPABILITY_GUEST
        See Also:
        Constant Field Values
      • CAPABILITY_MUTABLE

        public static final java.lang.String CAPABILITY_MUTABLE
        See Also:
        Constant Field Values
      • fullName

        protected java.lang.String fullName
      • capabilities

        protected final java.util.Map<java.lang.String,​java.lang.Boolean> capabilities
      • map

        protected final java.util.Map<java.lang.String,​java.io.Serializable> map
    • Constructor Detail

      • User

        public User​(java.lang.String id,
                    java.util.Map<java.lang.String,​java.lang.Boolean> capabilities)
        Instantiates a new user.
        Parameters:
        id - the user id
        capabilities - map of string keyed boolean capabilities given to the user
    • Method Detail

      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface java.security.Principal
      • getId

        public java.lang.String getId()
        Gets the id - this is usually the username.
        Returns:
        the id
      • getFirstName

        public java.lang.String getFirstName()
        Gets the first name.
        Returns:
        the first name
      • setFirstName

        public void setFirstName​(java.lang.String value)
        Sets the first name.
        Parameters:
        value - the new first name
      • getLastName

        public java.lang.String getLastName()
        Gets the last name.
        Returns:
        the last name
      • setLastName

        public void setLastName​(java.lang.String value)
        Sets the last name.
        Parameters:
        value - the new last name
      • getMiddleName

        public java.lang.String getMiddleName()
        Gets the middle name.
        Returns:
        the middle name
      • setMiddleName

        public void setMiddleName​(java.lang.String value)
        Sets the middle name.
        Parameters:
        value - the new middle name
      • getEmail

        public java.lang.String getEmail()
        Gets the email.
        Returns:
        the email
      • setEmail

        public void setEmail​(java.lang.String value)
        Sets the email.
        Parameters:
        value - the new email
      • getOrganization

        public java.lang.String getOrganization()
        Gets the organization.
        Returns:
        the organization
      • setOrganization

        public void setOrganization​(java.lang.String value)
        Sets the organization.
        Parameters:
        value - the new organization
      • getJobTitle

        public java.lang.String getJobTitle()
        Gets the job title.
        Returns:
        the job title
      • setJobTitle

        public void setJobTitle​(java.lang.String value)
        Sets the job title.
        Parameters:
        value - the new job title
      • getLocation

        public java.lang.String getLocation()
        Get the location
        Returns:
        the location
      • setLocation

        public void setLocation​(java.lang.String value)
        Set the location
        Parameters:
        value - the new location
      • getBiography

        public java.lang.String getBiography()
        Get the biography
        Returns:
        the biography
      • setBiography

        public void setBiography​(java.lang.String value)
        Set the biography
        Parameters:
        value - the new biography
      • getTelephone

        public java.lang.String getTelephone()
        Gets the home phone.
        Returns:
        the home phone
      • setTelephone

        public void setTelephone​(java.lang.String value)
        Sets the home phone.
        Parameters:
        value - the new home phone
      • getMobilePhone

        public java.lang.String getMobilePhone()
        Gets the mobile phone.
        Returns:
        the mobile phone
      • setMobilePhone

        public void setMobilePhone​(java.lang.String value)
        Sets the mobile phone.
        Parameters:
        value - the new mobile phone
      • getSkype

        public java.lang.String getSkype()
        Gets the skype id.
        Returns:
        the skype id
      • setSkype

        public void setSkype​(java.lang.String value)
        Sets the skype id
        Parameters:
        value - the new skype id
      • getInstantMsg

        public java.lang.String getInstantMsg()
        Gets the instant msg id.
        Returns:
        the instant msg id
      • setInstantMsg

        public void setInstantMsg​(java.lang.String value)
        Sets the instant msg id
        Parameters:
        value - the new instant msg id
      • getGoogleUsername

        public java.lang.String getGoogleUsername()
        Gets the google user name.
        Returns:
        the google user name
      • setGoogleUsername

        public void setGoogleUsername​(java.lang.String value)
        Sets the google user name
        Parameters:
        value - the new google user name
      • getCompanyAddress1

        public java.lang.String getCompanyAddress1()
        Gets Company Address1
        Returns:
        the Company Address1
      • setCompanyAddress1

        public void setCompanyAddress1​(java.lang.String value)
        Sets the Company Address1
        Parameters:
        value - the new Company Address1
      • getCompanyAddress2

        public java.lang.String getCompanyAddress2()
        Gets Company Address2
        Returns:
        the Company Address2
      • setCompanyAddress2

        public void setCompanyAddress2​(java.lang.String value)
        Sets the Company Address2
        Parameters:
        value - the new Company Address2
      • getCompanyAddress3

        public java.lang.String getCompanyAddress3()
        Gets Company Address3
        Returns:
        the Company Address3
      • setCompanyAddress3

        public void setCompanyAddress3​(java.lang.String value)
        Sets the Company Address3
        Parameters:
        value - the new Company Address3
      • getCompanyPostcode

        public java.lang.String getCompanyPostcode()
        Gets Company Postcode
        Returns:
        the Company Postcode
      • setCompanyPostcode

        public void setCompanyPostcode​(java.lang.String value)
        Sets the Company Postcode
        Parameters:
        value - the new Company Postcode
      • getCompanyTelephone

        public java.lang.String getCompanyTelephone()
        Gets Company Telephone
        Returns:
        the Company Telephone
      • setCompanyTelephone

        public void setCompanyTelephone​(java.lang.String value)
        Sets the Company Telephone
        Parameters:
        value - the new Company Telephone
      • getCompanyFax

        public java.lang.String getCompanyFax()
        Gets Company Fax
        Returns:
        the Company Fax
      • setCompanyFax

        public void setCompanyFax​(java.lang.String value)
        Sets the Company Fax
        Parameters:
        value - the new Company Fax
      • getCompanyEmail

        public java.lang.String getCompanyEmail()
        Gets Company Email
        Returns:
        the Company Email
      • setCompanyEmail

        public void setCompanyEmail​(java.lang.String value)
        Sets the Company Email
        Parameters:
        value - the new Company Email
      • getProperty

        public java.lang.Object getProperty​(java.lang.String key)
        Gets the property.
        Parameters:
        key - the key
        Returns:
        the property
      • getStringProperty

        public java.lang.String getStringProperty​(java.lang.String key)
        Gets the string property.
        Parameters:
        key - the key
        Returns:
        the string property
      • setProperty

        public void setProperty​(java.lang.String key,
                                java.io.Serializable value)
        Sets the property.
        Parameters:
        key - the key
        value - the value
      • getProperties

        public java.util.Map<java.lang.String,​java.io.Serializable> getProperties()
        Gets the properties.
        Returns:
        the properties
      • isAdmin

        public boolean isAdmin()
        Checks if is admin.
        Returns:
        the isAdmin
      • isGuest

        public boolean isGuest()
        Returns true if this user is a guest user
        Returns:
        true if this user is a guest user
      • getCapabilities

        public java.util.Map<java.lang.String,​java.lang.Boolean> getCapabilities()
        Gets a map of capabilities (boolean assertions) for the user.
        Returns:
        the capability map
      • toString

        public java.lang.String toString()
        Specified by:
        toString in interface java.security.Principal
        Overrides:
        toString in class java.lang.Object
      • getFullName

        public java.lang.String getFullName()
        Provides the full name for the user. This makes a best attempt at building the full name based on what it knows about the user. If a first name is not known, the returned name will be the user id of the user. If a first name is known, then the first name will be returned. If a first and middle name are known, then the first and middle name will be returned. Valid full names are therefore: jsmith Joe Joe D Joe Smith Joe D Smith
        Returns:
        A valid full name
      • save

        public void save()
        Persist this user