Class User
java.lang.Object
com.example.iconic_raffleevent.model.User
Represents a user in the system.
Each user is associated with their device using a unique user ID.
Users can provide optional details like email, phone, and a profile image.
Users can also have multiple roles, such as "entrant" or "organizer."
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRegisteredEvent(String eventId) Adds an event ID to the user's registered events.voidAdds a role to the user.voidaddWaitingListEvent(String eventId) Adds an event ID to the user's waiting list.booleanChecks if the user has the admin role.getEmail()Gets the user's email address.Gets the facility ID associated with the user.getName()Gets the user's name.Gets the user's phone number.Gets the URL of the user's profile image.Gets the list of event IDs the user is registered for.getRoles()Gets the roles associated with the user.Gets the unique user ID.Gets the username.Gets the list of event IDs the user is waiting for.booleanChecks if the user has opted for general notifications.booleanGets the user's location permission status.voidremoveRole(String role) Removes a role from the user.voidSets the user's email address.voidsetFacilityId(String facilityId) Sets the facility ID for the user.voidsetGeneralNotificationPref(boolean generalNotificationPref) Sets the general notifications preference for the user.voidsetLocationPermission(boolean locationPermission) Sets the user's location permission status.voidSets the user's name.voidsetPhoneNo(String phoneNo) Sets the user's phone number.voidsetProfileImageUrl(String profileImageUrl) Sets the URL of the user's profile image.voidsetRegisteredEventIds(List<String> registeredEventIds) Sets the list of event IDs the user is registered for.voidSets the user ID.voidsetUsername(String username) Sets the username.voidsetWaitingListEventIds(List<String> waitingListEventIds) Sets the list of event IDs the user is waiting for.
-
Constructor Details
-
User
public User()Default constructor initializing user with default values. Initializes lists for event IDs and roles, and sets default notification preferences.
-
-
Method Details
-
getUserId
Gets the unique user ID.- Returns:
- The user ID as a String.
-
setUserId
Sets the user ID.- Parameters:
userId- The user ID to set.
-
getUsername
Gets the username.- Returns:
- The username as a String.
-
setUsername
Sets the username.- Parameters:
username- The username to set.
-
getName
Gets the user's name.- Returns:
- The user's name as a String.
-
setName
Sets the user's name.- Parameters:
name- The name to set for the user.
-
getEmail
Gets the user's email address.- Returns:
- The user's email as a String.
-
setEmail
Sets the user's email address.- Parameters:
email- The email to set for the user.
-
getPhoneNo
Gets the user's phone number.- Returns:
- The user's phone number as a String.
-
setPhoneNo
Sets the user's phone number.- Parameters:
phoneNo- The phone number to set for the user.
-
getProfileImageUrl
Gets the URL of the user's profile image.- Returns:
- The profile image URL as a String.
-
setProfileImageUrl
Sets the URL of the user's profile image.- Parameters:
profileImageUrl- The URL to set for the user's profile image.
-
isLocationPermission
public boolean isLocationPermission()Gets the user's location permission status.- Returns:
- True if location permission is granted, false otherwise.
-
setLocationPermission
public void setLocationPermission(boolean locationPermission) Sets the user's location permission status.- Parameters:
locationPermission- The location permission status to set.
-
getWaitingListEventIds
Gets the list of event IDs the user is waiting for.- Returns:
- The list of waiting event IDs.
-
setWaitingListEventIds
Sets the list of event IDs the user is waiting for.- Parameters:
waitingListEventIds- The list of waiting event IDs to set.
-
addWaitingListEvent
Adds an event ID to the user's waiting list.- Parameters:
eventId- The event ID to add to the waiting list.
-
getRegisteredEventIds
Gets the list of event IDs the user is registered for.- Returns:
- The list of registered event IDs.
-
setRegisteredEventIds
Sets the list of event IDs the user is registered for.- Parameters:
registeredEventIds- The list of registered event IDs to set.
-
addRegisteredEvent
Adds an event ID to the user's registered events.- Parameters:
eventId- The event ID to add to the registered events list.
-
isGeneralNotificationPref
public boolean isGeneralNotificationPref()Checks if the user has opted for general notifications.- Returns:
- True if general notifications are enabled, false otherwise.
-
setGeneralNotificationPref
public void setGeneralNotificationPref(boolean generalNotificationPref) Sets the general notifications preference for the user.- Parameters:
generalNotificationPref- The general notification preference to set.
-
getFacilityId
Gets the facility ID associated with the user.- Returns:
- The facility ID as a String.
-
setFacilityId
Sets the facility ID for the user.- Parameters:
facilityId- The facility ID to set.
-
getRoles
Gets the roles associated with the user.- Returns:
- A list of roles the user has.
-
addRole
Adds a role to the user.- Parameters:
role- The role to add.
-
removeRole
Removes a role from the user.- Parameters:
role- The role to remove.
-
checkAdminRole
public boolean checkAdminRole()Checks if the user has the admin role.- Returns:
- True if the user has the "admin" role, false otherwise.
-