Class User

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class User
    extends java.lang.Object
    implements java.lang.Cloneable
    This is a data class for storing the information on a user. This information is stored in the users.xml file and is manipulated via the "Users, Groups and Views" screen.
    Since:
    1.8.1
    Version:
    1.1.1.1
    Author:
    Jason Johns , OpenNMS , Jason Johns , OpenNMS
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String USER_ID_PROPERTY  
    • Constructor Summary

      Constructors 
      Constructor Description
      User()
      Creates a User.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)
      addPropertyChangeListener
      java.lang.Object clone()
      clone
      boolean comparePasswords​(java.lang.String aPassword)
      This method compares two encrypted strings for equality
      static java.lang.String encryptPassword​(java.lang.String aPassword)
      This method encrypts the password using MD5 hashing.
      java.lang.String getFullName()
      Returns the full name of this user
      NotificationInfo getNotificationInfo()
      Returns the notification information for this user
      java.lang.String getPassword()
      Returns the password for this user
      java.lang.String getUserComments()
      Returns the user comments for this user
      java.lang.String getUserId()
      Returns the user id for this user
      void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)
      removePropertyChangeListener
      void setEncryptedPassword​(java.lang.String aPassword)
      Sets the password for this user, assuming that the value passed in is already encrypted properly
      void setFullName​(java.lang.String aFullName)
      Sets the full name for this user
      void setNotificationInfo​(NotificationInfo someInfo)
      Sets the notificaton information for this user
      void setUnencryptedPassword​(java.lang.String aPassword)
      Sets the password for this user, first encrypting it
      void setUserComments​(java.lang.String someUserComments)
      Sets the user comments for this user
      void setUserId​(java.lang.String aUserId)
      Sets the user id for this user
      java.lang.String toString()
      Returns a String representation of the user info, used primarily for debugging purposes.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • USER_ID_PROPERTY

        public static final java.lang.String USER_ID_PROPERTY
        See Also:
        Constant Field Values
    • Constructor Detail

      • User

        public User()
        Creates a User. Default constructor, intializes the member variables.
    • Method Detail

      • clone

        public java.lang.Object clone()

        clone

        Overrides:
        clone in class java.lang.Object
        Returns:
        a Object object.
      • addPropertyChangeListener

        public void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)

        addPropertyChangeListener

        Parameters:
        listener - a PropertyChangeListener object.
      • removePropertyChangeListener

        public void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)

        removePropertyChangeListener

        Parameters:
        listener - a PropertyChangeListener object.
      • getNotificationInfo

        public NotificationInfo getNotificationInfo()
        Returns the notification information for this user
        Returns:
        the notification info
      • setNotificationInfo

        public void setNotificationInfo​(NotificationInfo someInfo)
        Sets the notificaton information for this user
        Parameters:
        someInfo - the notification info
      • setUserId

        public void setUserId​(java.lang.String aUserId)
        Sets the user id for this user
        Parameters:
        aUserId - the user id
      • getUserId

        public java.lang.String getUserId()
        Returns the user id for this user
        Returns:
        the user id
      • setFullName

        public void setFullName​(java.lang.String aFullName)
        Sets the full name for this user
        Parameters:
        aFullName - the full name
      • getFullName

        public java.lang.String getFullName()
        Returns the full name of this user
        Returns:
        the full name
      • setUserComments

        public void setUserComments​(java.lang.String someUserComments)
        Sets the user comments for this user
        Parameters:
        someUserComments - the user comments
      • getUserComments

        public java.lang.String getUserComments()
        Returns the user comments for this user
        Returns:
        the user comments
      • setEncryptedPassword

        public void setEncryptedPassword​(java.lang.String aPassword)
        Sets the password for this user, assuming that the value passed in is already encrypted properly
        Parameters:
        aPassword - the encrypted password
      • setUnencryptedPassword

        public void setUnencryptedPassword​(java.lang.String aPassword)
                                    throws java.lang.IllegalStateException
        Sets the password for this user, first encrypting it
        Parameters:
        aPassword - the password
        Throws:
        java.lang.IllegalStateException - if any.
      • encryptPassword

        public static java.lang.String encryptPassword​(java.lang.String aPassword)
                                                throws java.lang.IllegalStateException
        This method encrypts the password using MD5 hashing.
        Parameters:
        aPassword - the password to encrypt
        Returns:
        the MD5 hash of the password, or null if the encryption fails
        Throws:
        java.lang.IllegalStateException - if any.
      • comparePasswords

        public boolean comparePasswords​(java.lang.String aPassword)
        This method compares two encrypted strings for equality
        Parameters:
        aPassword - the password to check for equality
        Returns:
        true if the two passwords are equal (after encryption), false otherwise
      • getPassword

        public java.lang.String getPassword()
        Returns the password for this user
        Returns:
        the password for the user
      • toString

        public java.lang.String toString()
        Returns a String representation of the user info, used primarily for debugging purposes.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation