Package model.user

Class User

  • Direct Known Subclasses:
    Staff, Student

    public class User
    extends java.lang.Object
    Represents a user using the system
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String email
      Variable to check for first login
      private Schools faculty
      Faculty information.
      private boolean firstLogin
      Boolean to check if it is user's first login
      private java.lang.String name
      Name of user.
      private java.lang.String password
      Password of the user.
      private UserRole type
      UserRole of the user.
      private java.lang.String userID
      Unique NTU ID of the user.
    • Constructor Summary

      Constructors 
      Constructor Description
      User​(java.lang.String name, java.lang.String password, java.lang.String userID, java.lang.String email, Schools faculty, UserRole type, boolean firstLogin)
      Create an object of the User class
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getEmail()
      Gets the email of the user
      Schools getFaculty()
      Gets the user's faculty info
      java.lang.String getID()
      Gets the user's ID
      java.lang.String getName()
      Gets the user's name
      java.lang.String getPassword()
      Gets the user's password
      UserRole getType()
      Gets the user's role
      boolean isFirstLogin()
      Check's if it's user's first login
      void removeDefault()
      Change firstLogin boolean to false after removing the default password
      boolean setPassword​(java.lang.String newPassword)
      Set password
      void setType​(UserRole type)
      Sets the usertype
      • Methods inherited from class java.lang.Object

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

      • userID

        private java.lang.String userID
        Unique NTU ID of the user.
      • password

        private java.lang.String password
        Password of the user.
      • faculty

        private Schools faculty
        Faculty information.
      • name

        private java.lang.String name
        Name of user.
      • email

        private java.lang.String email
        Variable to check for first login
      • firstLogin

        private boolean firstLogin
        Boolean to check if it is user's first login
    • Constructor Detail

      • User

        public User​(java.lang.String name,
                    java.lang.String password,
                    java.lang.String userID,
                    java.lang.String email,
                    Schools faculty,
                    UserRole type,
                    boolean firstLogin)
        Create an object of the User class
        Parameters:
        name - user's name
        password - user's password
        userID - user's ID
        email - user's email
        faculty - user's faculty info
        type - user's role
        firstLogin - Check if it's user's first login
    • Method Detail

      • getName

        public java.lang.String getName()
        Gets the user's name
        Returns:
        name
      • getID

        public java.lang.String getID()
        Gets the user's ID
        Returns:
        userID
      • getPassword

        public java.lang.String getPassword()
        Gets the user's password
        Returns:
        password
      • setPassword

        public boolean setPassword​(java.lang.String newPassword)
        Set password
        Parameters:
        newPassword - The new password set by the user
        Returns:
        boolean that show password set success
      • getEmail

        public java.lang.String getEmail()
        Gets the email of the user
        Returns:
        the email
      • getFaculty

        public Schools getFaculty()
        Gets the user's faculty info
        Returns:
        faculty
      • getType

        public UserRole getType()
        Gets the user's role
        Returns:
        type of user's role
      • setType

        public void setType​(UserRole type)
        Sets the usertype
        Parameters:
        type - the type to set
      • isFirstLogin

        public boolean isFirstLogin()
        Check's if it's user's first login
        Returns:
        firstLogin
      • removeDefault

        public void removeDefault()
        Change firstLogin boolean to false after removing the default password