Package com.ehealthsystem.tools
Class Session
java.lang.Object
com.ehealthsystem.tools.Session
Class to manage a Session of a logged-in user/admin.
-
Field Summary
Modifier and TypeFieldDescriptionstatic Admin
static AppointmentInCreation
An appointment that is currently createdstatic final DateTimeFormatter
date pattern used in the UIstatic final DateTimeFormatter
time pattern used in the UIstatic final DateTimeFormatter
time pattern used for the schedule grid panestatic User
User that is currently logged inprivate static com.google.maps.model.GeocodingResult
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.maps.model.GeocodingResult
return the user´s geolocation, determined using Google Mapsstatic void
Delete cached information of user's geolocation.static void
loginAdmin
(String name) Called when the admin logs-in.static void
To be called on login to load user object for the user to be called by further methodsstatic void
logout()
Logout the session's user by setting the attribute to null and showing the main view (login, register)
-
Field Details
-
user
User that is currently logged in -
admin
-
appointment
An appointment that is currently created -
userGeo
private static com.google.maps.model.GeocodingResult userGeo -
dateFormatter
date pattern used in the UI -
timeFormatter
time pattern used in the UI -
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
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.ApiExceptionreturn 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 toIOException
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
Logout the session's user by setting the attribute to null and showing the main view (login, register)- Throws:
IOException
-