Package MySTARS

Class LoginView

java.lang.Object
MySTARS.View
MySTARS.LoginView

public final class LoginView
extends View
Initial View seen by User. Used to log in the User to the System.
Since:
2020-11-1
Version:
1.0
Author:
Bhargav, Kah Ee
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private static org.joda.time.DateTime loginEnd  
    private static org.joda.time.DateTime loginStart  
  • Constructor Summary

    Constructors 
    Constructor Description
    LoginView()
    Constructor method that checks if the Student login period has been set.
  • Method Summary

    Modifier and Type Method Description
    org.joda.time.DateTime getEndTime()
    Getter method for the currently set log in end time.
    org.joda.time.DateTime getStartTime()
    Getter method for the currently set log in start time.
    private boolean isValidLoginDate()
    Checks if the current time is within the allocated time for Students to log in.
    void print()
    Displays Login view for User, checks the credentials and then logs in the User if the credentials are valid.
    static void setLoginTime​(org.joda.time.DateTime start, org.joda.time.DateTime end)
    Assigns the period of time that the Student can log in.

    Methods inherited from class MySTARS.View

    clearScreen

    Methods inherited from class java.lang.Object

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

    • loginStart

      private static org.joda.time.DateTime loginStart
    • loginEnd

      private static org.joda.time.DateTime loginEnd
  • Constructor Details

    • LoginView

      public LoginView()
      Constructor method that checks if the Student login period has been set. Defaults to the whole of 2020.
  • Method Details

    • getStartTime

      public org.joda.time.DateTime getStartTime()
      Getter method for the currently set log in start time.
      Returns:
      date in dd/MM/yyyy, time in HH:mm:ss.
    • getEndTime

      public org.joda.time.DateTime getEndTime()
      Getter method for the currently set log in end time.
      Returns:
      date in dd/MM/yyyy, time in hh:mm:ss.
    • print

      public void print()
      Displays Login view for User, checks the credentials and then logs in the User if the credentials are valid. Required method from View.
      Specified by:
      print in class View
    • setLoginTime

      public static void setLoginTime​(org.joda.time.DateTime start, org.joda.time.DateTime end) throws java.lang.Exception
      Assigns the period of time that the Student can log in.
      Parameters:
      start - login time in DateTime format.
      end - logout time in DateTime format.
      Throws:
      java.lang.Exception - Exception if Start time is after end time.
    • isValidLoginDate

      private boolean isValidLoginDate()
      Checks if the current time is within the allocated time for Students to log in.
      Returns:
      true if current time is within allocated time.