Class Event
java.lang.Object
com.example.skeddly.business.database.DatabaseObject
com.example.skeddly.business.event.Event
This class represents an event.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA public callback interface to return the result of an asynchronous search. -
Constructor Summary
ConstructorsConstructorDescriptionEvent()No arg Constructor for an Event.Event(EventDetail eventDetails, EventSchedule eventSchedule, com.google.android.gms.maps.model.LatLng location, String organizer, int participantListLimit, boolean logLocation, byte[] image) Constructor for the Event without bounds on waiting listEvent(EventDetail eventDetails, EventSchedule eventSchedule, com.google.android.gms.maps.model.LatLng location, String organizer, int waitingListLimit, int participantListLimit, boolean logLocation, byte[] image) Constructor for the Event -
Method Summary
Modifier and TypeMethodDescriptionvoidclearImage(DatabaseHandler dbHandler) voiddraw(int numToDraw) Draws a number of participants into the Participant List.voidfindUserTicketId(String userId, DatabaseHandler dbHandler, Event.FindTicketCallback callback) Finds the ticket ID of a user in the event's waiting list.Gets details of the eventsGets the schedule of the eventGets the image of the event as a base64 stringGets the location of the eventbooleanGets whether location logging is required to join the waiting listGets the organizer id of the eventGets the participant list of the eventGets the waiting list of the eventbooleanQueries whether the event is joinable or not.voidjoin(DatabaseHandler dbHandler, PersonalInformation userPersonalInfo, String userId, CustomLocation location) Handles the logic for a user joining the event's waitlist.voidleave(DatabaseHandler dbHandler, String ticketId) Handles the logic for a user leaving the event's waitlist.voidsetEventDetails(EventDetail eventDetails) Sets the details of the eventsvoidsetEventSchedule(EventSchedule eventSchedule) Sets the schedule of the eventvoidsetImageb64(String imageb64) Sets the image of the eventvoidsetLocation(CustomLocation location) Sets the location of the eventvoidsetLogLocation(boolean logLocation) Sets the location logging requirement for the event.voidsetOrganizer(String organizer) Sets the organizer of the event by their IDvoidsetParticipantList(ParticipantList participantList) Sets the participant list of the eventvoidsetWaitingList(WaitingList waitingList) Sets the waiting list of the eventMethods inherited from class com.example.skeddly.business.database.DatabaseObject
fetchDatabaseObjectRelatedMethods, getId, setId
-
Constructor Details
-
Event
public Event()No arg Constructor for an Event. Required by Firestore. -
Event
public Event(EventDetail eventDetails, EventSchedule eventSchedule, com.google.android.gms.maps.model.LatLng location, String organizer, int waitingListLimit, int participantListLimit, boolean logLocation, byte[] image) Constructor for the Event- Parameters:
eventDetails- The details of the eventeventSchedule- The schedule of the eventlocation- The location of the eventorganizer- The ID of the organizer of the eventwaitingListLimit- The limit of the waiting listparticipantListLimit- The limit of the participant listlogLocation- Whether your location is required to be logged when joining the waiting list.image- The image of the event as base64
-
Event
public Event(EventDetail eventDetails, EventSchedule eventSchedule, com.google.android.gms.maps.model.LatLng location, String organizer, int participantListLimit, boolean logLocation, byte[] image) Constructor for the Event without bounds on waiting list- Parameters:
eventDetails- The details of the eventeventSchedule- The schedule of the eventlocation- The location of the eventorganizer- The organizer of the eventparticipantListLimit- The limit of the participant listlogLocation- Whether your location is required to be logged when joining the waiting list.image- The image of the event as base64
-
-
Method Details
-
getEventDetails
Gets details of the events- Returns:
- The details of the events
-
setEventDetails
Sets the details of the events- Parameters:
eventDetails- The details of the events
-
getEventSchedule
Gets the schedule of the event- Returns:
- The schedule of the event
-
setEventSchedule
Sets the schedule of the event- Parameters:
eventSchedule- The schedule of the event
-
getLocation
Gets the location of the event- Returns:
- The location of the event
-
setLocation
Sets the location of the event- Parameters:
location- The location of the event
-
getOrganizer
Gets the organizer id of the event- Returns:
- The organizer id of the event
-
setOrganizer
Sets the organizer of the event by their ID- Parameters:
organizer- The organizer id to set it to
-
getWaitingList
Gets the waiting list of the event- Returns:
- The waiting list of the event
-
setWaitingList
Sets the waiting list of the event- Parameters:
waitingList- The waiting list of the event
-
getParticipantList
Gets the participant list of the event- Returns:
- The participant list of the event
-
setParticipantList
Sets the participant list of the event- Parameters:
participantList- The participant list of the event
-
getLogLocation
public boolean getLogLocation()Gets whether location logging is required to join the waiting list- Returns:
- True if it is required. False otherwise.
-
setLogLocation
public void setLogLocation(boolean logLocation) Sets the location logging requirement for the event.- Parameters:
logLocation- The new boolean value for the requirement.
-
getImageb64
Gets the image of the event as a base64 string- Returns:
- The image of the event as base64
-
setImageb64
Sets the image of the event- Parameters:
imageb64- The image of the event as base64
-
isJoinable
public boolean isJoinable()Queries whether the event is joinable or not. An event is joinable if the waiting list is not full and the registration period has not ended yet.- Returns:
- True if the event can be joined. False otherwise.
-
draw
public void draw(int numToDraw) Draws a number of participants into the Participant List.- Parameters:
numToDraw- The number of participants to draw.
-
join
public void join(DatabaseHandler dbHandler, PersonalInformation userPersonalInfo, String userId, CustomLocation location) Handles the logic for a user joining the event's waitlist.- Parameters:
dbHandler- The database handler to interact with Firebase.userId- The ID of the user who is joining.
-
leave
Handles the logic for a user leaving the event's waitlist.- Parameters:
dbHandler- The database handler to interact with Firebase.ticketId- The ID of the ticket to be removed.
-
clearImage
-
findUserTicketId
public void findUserTicketId(String userId, DatabaseHandler dbHandler, Event.FindTicketCallback callback) Finds the ticket ID of a user in the event's waiting list.- Parameters:
userId- The ID of the user to search for.dbHandler- The database handler to interact with Firebase.callback- The callback to be invoked when the search is complete.
-