Class Session

java.lang.Object
com.ehealthsystem.tools.Session

public class Session extends Object
Class to manage a Session of a logged-in user/admin.
  • Field Details

    • user

      public static User user
      User that is currently logged in
    • admin

      public static Admin admin
    • appointment

      public static AppointmentInCreation appointment
      An appointment that is currently created
    • userGeo

      private static com.google.maps.model.GeocodingResult userGeo
    • dateFormatter

      public static final DateTimeFormatter dateFormatter
      date pattern used in the UI
    • timeFormatter

      public static final DateTimeFormatter timeFormatter
      time pattern used in the UI
    • timeFormatterForSchedule

      public static final DateTimeFormatter timeFormatterForSchedule
      time pattern used for the schedule grid pane
  • Constructor Details

    • Session

      public Session()
  • Method Details

    • loginUser

      public static void loginUser(String email) throws SQLException, javax.activation.UnsupportedDataTypeException
      To be called on login to load user object for the user to be called by further methods
      Parameters:
      email - the email of the user to log in
      Throws:
      SQLException - Throws Exception during connection issues.
      javax.activation.UnsupportedDataTypeException
    • loginAdmin

      public static void loginAdmin(String name)
      Called when the admin logs-in. A new object of the type admin is created,that represents the logged in admin.
      Parameters:
      name - Name of the admin.
    • getUserGeo

      public static com.google.maps.model.GeocodingResult getUserGeo() throws IOException, InterruptedException, com.google.maps.errors.ApiException
      return the user´s geolocation, determined using Google Maps
      Returns:
      GeoCodingResult of user
      Throws:
      com.google.maps.errors.ApiException - if the Google Maps API couldn't be connected to
      IOException
      InterruptedException
    • invalidateUserGeo

      public static void invalidateUserGeo()
      Delete cached information of user's geolocation. Called for example when they change their address in their personal information section.
    • logout

      public static void logout() throws IOException
      Logout the session's user by setting the attribute to null and showing the main view (login, register)
      Throws:
      IOException