public class UserController
extends java.lang.Object
| Constructor and Description |
|---|
UserController() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.Boolean |
canDrive()
Tells us if the user is also a driver or just a rider
|
static Mode |
checkMode()
returns the current mode
|
static java.lang.String |
getEmail()
Gets email for curr user session
|
static java.lang.String |
getName()
Gets username for curr user session
|
static java.lang.String |
getPhoneNumber()
Gets phone number for curr user session
|
static User |
getUser()
gets the user for the current session
|
static User |
getUserFromId(java.lang.String id)
Calls the elastic search to get the user object
|
static User |
getUserFromName(java.lang.String username)
Gets user object from user name by querying elasticsearch server
|
static java.util.ArrayList<User> |
getUsersFromIds(java.util.ArrayList<java.lang.String> userIds) |
static java.lang.Boolean |
loadFromFile(android.app.Activity activity)
Loads user data from file if still logged in
|
static void |
logOut(android.content.Context context)
logs the user out of their current session
|
static void |
saveInFile(android.app.Activity activity)
Method to save the static user variable
Stores it in internal storage as JSON in user.sav file\
|
static void |
setEmail(java.lang.String email)
Sets the current email
|
static void |
setMode(Mode newMode)
sets the mode for the current session
|
static void |
setName(java.lang.String name)
Sets the current username
|
static void |
setPhoneNumber(java.lang.String phoneNumber)
Sets the curr phone number
|
static void |
setUser(User newUser)
Sets the user for the current session
|
static void |
updateRating(int r,
java.lang.String driverName)
Method to update rating of a driver upon ride completion.
|
static void |
updateUserInDb()
Updates a user value in elasticsearchserver
|
static void |
updateUserInDbOffline()
Updates a user value in elasticsearchserver using offline -> online elasticsearch query
|
public static void setUser(User newUser)
newUser - the user obj for curr sessionpublic static void setMode(Mode newMode)
newMode - the mode to setModepublic static Mode checkMode()
Modepublic static java.lang.Boolean canDrive()
public static void updateRating(int r,
java.lang.String driverName)
r - the rating out of 5 given to the driverdriverName - Username of the driver being ratedpublic static User getUser()
Userpublic static void updateUserInDb()
ElasticsearchUserControllerpublic static void updateUserInDbOffline()
ElasticsearchUserControllerpublic static java.lang.String getName()
public static java.lang.String getEmail()
public static java.lang.String getPhoneNumber()
public static void setName(java.lang.String name)
name - the curr usernamepublic static void setEmail(java.lang.String email)
email - the curr emailpublic static void setPhoneNumber(java.lang.String phoneNumber)
phoneNumber - the curr phone numberpublic static void saveInFile(android.app.Activity activity)
public static java.lang.Boolean loadFromFile(android.app.Activity activity)
activity - curr applciation contextpublic static void logOut(android.content.Context context)
context - current application contextpublic static User getUserFromName(java.lang.String username)
username - username of userElasticsearchUserControllerpublic static User getUserFromId(java.lang.String id)
id - id of the user you want to get the user object frompublic static java.util.ArrayList<User> getUsersFromIds(java.util.ArrayList<java.lang.String> userIds)