Class Event

java.lang.Object
com.example.breeze_seas.Event

public class Event extends Object
Event stores the organizer-facing and entrant-facing metadata for a single event document.
  • Constructor Details

    • Event

      public Event(String eventId, boolean isPrivate, String organizerId, ArrayList<String> coOrganizerId, String name, String description, Image image, com.google.firebase.Timestamp createdTimestamp, com.google.firebase.Timestamp modifiedTimestamp, com.google.firebase.Timestamp registrationStartTimestamp, com.google.firebase.Timestamp registrationEndTimestamp, com.google.firebase.Timestamp eventStartTimestamp, com.google.firebase.Timestamp eventEndTimestamp, boolean geolocationEnforced, int eventCapacity, int waitingListCapacity, int drawARound, WaitingList waitingList, PendingList pendingList, AcceptedList acceptedList, DeclinedList declinedList)
      Creates an event using the full field set expected when hydrating from EventDB.
      Parameters:
      eventId - Unique event identifier.
      isPrivate - Whether event is private.
      organizerId - Organizer identifier that owns the event.
      coOrganizerId - Other organizers that manages the event.
      name - Display name of the event.
      description - Organizer-provided description.
      image - Image object.
      createdTimestamp - Timestamp when the event was created.
      modifiedTimestamp - Timestamp when the event was last modified.
      registrationStartTimestamp - Registration opening timestamp.
      registrationEndTimestamp - Registration closing timestamp.
      eventStartTimestamp - Event start timestamp.
      eventEndTimestamp - Event end timestamp.
      geolocationEnforced - Whether registration requires geolocation.
      eventCapacity - Maximum accepted entrants.
      waitingListCapacity - Maximum waiting-list entrants.
      drawARound - Current draw round counter.
      waitingList - Waiting-list helper associated with the event.
      pendingList - Pending-list helper associated with the event.
      acceptedList - Accepted-list helper associated with the event.
      declinedList - Declined-list helper associated with the event.
    • Event

      public Event(Map<String,Object> map)
      Creates an event from Firebase using a map object.
      Parameters:
      map - Map object to retrieve and initialize values from.
    • Event

      public Event(boolean isPrivate, String organizerId, String name, String description, Image image, com.google.firebase.Timestamp registrationStartTimestamp, com.google.firebase.Timestamp registrationEndTimestamp, com.google.firebase.Timestamp eventStartTimestamp, com.google.firebase.Timestamp eventEndTimestamp, boolean geolocationEnforced, int eventCapacity, int waitingListCapacity)
      Creates a new event for organizer-side event creation before it is persisted.
      Parameters:
      isPrivate - Whether event is private.
      organizerId - Organizer identifier that owns the new event.
      name - Display name of the event.
      description - Organizer-provided description.
      image - Image object.
      registrationStartTimestamp - Registration opening timestamp.
      registrationEndTimestamp - Registration closing timestamp.
      eventStartTimestamp - Event start timestamp.
      eventEndTimestamp - Event end timestamp.
      geolocationEnforced - Whether registration requires geolocation.
      eventCapacity - Maximum accepted entrants.
      waitingListCapacity - Maximum waiting-list entrants.
    • Event

      public Event(String organizerId, int eventCapacity)
      Creates a minimal event instance for temporary or test organizer flows.
      Parameters:
      organizerId - Organizer identifier that owns the event.
      eventCapacity - Maximum accepted entrants.
  • Method Details

    • toMap

      public Map<String,Object> toMap()
      Serializes the current event into the Firestore map shape expected by EventDB.
      Returns:
      Firestore field map for this event.
    • loadMap

      public void loadMap(Map<String,Object> map)
      Loads the map object from Firestore and updates the event details accordingly. DOES NOT LOAD COMPLEX OBJECTS LIKE participants (the lists classes) and image
      Parameters:
      map - Map object to populate attribute from.
    • getEventId

      public String getEventId()
      Returns the unique identifier for this event.
      Returns:
      Event identifier.
    • setEventId

      public void setEventId(String eventId)
      Updates the unique identifier for this event.
      Parameters:
      eventId - Event identifier to store.
    • isPrivate

      public boolean isPrivate()
      Returns the private state for this event.
      Returns:
      Private state.
    • setPrivate

      public void setPrivate(boolean isPrivate)
      Sets the private state for this event.
      Parameters:
      isPrivate - Private state.
    • getOrganizerId

      public String getOrganizerId()
      Returns the organizer identifier that owns this event.
      Returns:
      Organizer identifier.
    • setOrganizerId

      public void setOrganizerId(String organizerId)
      Updates the organizer identifier associated with this event.
      Parameters:
      organizerId - Organizer identifier to store.
    • getCoOrganizerId

      public ArrayList<String> getCoOrganizerId()
      Returns a list of user IDs that are co-organizers.
      Returns:
      Arraylist of IDs.
    • setCoOrganizerId

      public void setCoOrganizerId(ArrayList<String> coOrganizerId)
      Set the list of user IDs that are co-organizers.
      Parameters:
      coOrganizerId - Arraylist of IDs.
    • getAllOrganizerId

      public ArrayList<String> getAllOrganizerId()
      Returns a list of all user IDs that are any kind of organizers.
    • userIsOrganizer

      public boolean userIsOrganizer(User user)
      Method to check if a user is the ORIGINAL organizer of the event
      Parameters:
      user - User object
      Returns:
      true is user is the ORIGINAL organizer of event, otherwise false
    • userIsCoOrganizer

      public boolean userIsCoOrganizer(User user)
      Method to check if a user is a co-organizer of the event
      Parameters:
      user - User object
      Returns:
      true is user is a co-organizer of event, otherwise false
    • userIsAnOrganizer

      public boolean userIsAnOrganizer(User user)
      Method to check if a user is any kind of organizer of the event
      Parameters:
      user - User object
      Returns:
      true is user is any kind of organizer of event, otherwise false
    • getName

      public String getName()
      Returns the display name of the event.
      Returns:
      Event name.
    • setName

      public void setName(String name)
      Updates the display name of the event.
      Parameters:
      name - Event name to store.
    • getDescription

      public String getDescription()
      Returns the organizer-provided description for this event.
      Returns:
      Event description.
    • setDescription

      public void setDescription(String description)
      Updates the description for this event.
      Parameters:
      description - Event description to store.
    • getImage

      public Image getImage()
      Returns the image object associated with the event.
      Returns:
      Image object.
    • setImage

      public void setImage(Image image)
      Updates the image object associated with the event.
      Parameters:
      image - Image object to hold a reference to.
    • getImageData

      public androidx.lifecycle.MutableLiveData<Image> getImageData()
      Returns the image object wrapped in a MutableLiveData. Suitable for use when fragments need to observe when images get updated.
      Returns:
      MutableLiveData that encloses an image object.
    • getPosterBitmap

      public android.graphics.Bitmap getPosterBitmap()
      Synonym of getImageBitmap()
      Returns:
      Bitmap of event poster. Null if image object does not exist.
    • getImageBitmap

      public android.graphics.Bitmap getImageBitmap()
      Returns bitmap of event poster to caller.
      Returns:
      Bitmap of event poster. Null if image object does not exist.
    • getCreatedTimestamp

      public com.google.firebase.Timestamp getCreatedTimestamp()
      Returns the timestamp when the event was created.
      Returns:
      Event creation timestamp.
    • created

      public com.google.firebase.Timestamp created()
      Returns:
      Event creation timestamp.
    • setCreatedTimestamp

      public void setCreatedTimestamp(com.google.firebase.Timestamp createdTimestamp)
      Updates the event creation timestamp.
      Parameters:
      createdTimestamp - Creation timestamp to store.
    • getModifiedTimestamp

      public com.google.firebase.Timestamp getModifiedTimestamp()
      Returns the timestamp when the event was last modified.
      Returns:
      Last-modified timestamp.
    • modified

      public com.google.firebase.Timestamp modified()
      Returns:
      Last-modified timestamp.
    • setModifiedTimestamp

      public void setModifiedTimestamp(com.google.firebase.Timestamp modifiedTimestamp)
      Updates the last-modified timestamp.
      Parameters:
      modifiedTimestamp - Last-modified timestamp to store.
    • getRegistrationStartTimestamp

      public com.google.firebase.Timestamp getRegistrationStartTimestamp()
      Returns the timestamp when registration opens.
      Returns:
      Registration opening timestamp.
    • regStart

      public com.google.firebase.Timestamp regStart()
      Returns:
      Registration opening timestamp.
    • getRegFromMillis

      public long getRegFromMillis()
      (DEPRECATED) Returns the registration-start timestamp as epoch milliseconds.
      Returns:
      Registration start timestamp in milliseconds, or 0L if unavailable.
    • setRegistrationStartTimestamp

      public void setRegistrationStartTimestamp(com.google.firebase.Timestamp registrationStartTimestamp)
      Updates the registration opening timestamp.
      Parameters:
      registrationStartTimestamp - Registration opening timestamp to store.
    • getRegistrationEndTimestamp

      public com.google.firebase.Timestamp getRegistrationEndTimestamp()
      Returns the timestamp when registration closes.
      Returns:
      Registration closing timestamp.
    • regEnd

      public com.google.firebase.Timestamp regEnd()
      Returns:
      Registration closing timestamp
    • getRegToMillis

      public long getRegToMillis()
      (DEPRECATED) Returns the registration-end timestamp as epoch milliseconds.
      Returns:
      Registration end timestamp in milliseconds, or 0L if unavailable.
    • setRegistrationEndTimestamp

      public void setRegistrationEndTimestamp(com.google.firebase.Timestamp registrationEndTimestamp)
      Updates the registration closing timestamp.
      Parameters:
      registrationEndTimestamp - Registration closing timestamp to store.
    • getEventStartTimestamp

      public com.google.firebase.Timestamp getEventStartTimestamp()
      Returns the event start timestamp.
      Returns:
      Event start timestamp.
    • eventStart

      public com.google.firebase.Timestamp eventStart()
      Returns:
      Event start timestamp.
    • setEventStartTimestamp

      public void setEventStartTimestamp(com.google.firebase.Timestamp eventStartTimestamp)
      Updates the event start timestamp.
      Parameters:
      eventStartTimestamp - Event start timestamp to store.
    • getEventEndTimestamp

      public com.google.firebase.Timestamp getEventEndTimestamp()
      Returns the event end timestamp.
      Returns:
      Event end timestamp.
    • eventEnd

      public com.google.firebase.Timestamp eventEnd()
      Returns:
      Event end timestamp.
    • setEventEndTimestamp

      public void setEventEndTimestamp(com.google.firebase.Timestamp eventEndTimestamp)
      Updates the event end timestamp.
      Parameters:
      eventEndTimestamp - Event end timestamp to store.
    • isGeolocationEnforced

      public boolean isGeolocationEnforced()
      Returns whether registration for this event enforces geolocation.
      Returns:
      true if geolocation checks are required.
    • getEventCapacity

      public int getEventCapacity()
      Returns the event-capacity limit for accepted entrants.
      Returns:
      Event-capacity limit.
    • setEventCapacity

      public void setEventCapacity(int eventCapacity)
      Updates the event-capacity limit for accepted entrants.
      Parameters:
      eventCapacity - Event-capacity limit to store.
    • getWaitingListCapacity

      public int getWaitingListCapacity()
      Returns the maximum waiting-list capacity for the event.
      Returns:
      Waiting-list capacity, or a negative value when effectively unlimited.
    • getWaitingListCap

      public Integer getWaitingListCap()
      (DEPRECATED) Returns the waiting-list capacity using the older nullable helper style.
      Returns:
      Waiting-list capacity, or null if the event is effectively unlimited.
    • setWaitingListCapacity

      public void setWaitingListCapacity(int waitingListCapacity)
      Updates the maximum waiting-list capacity for the event.
      Parameters:
      waitingListCapacity - Waiting-list capacity to store.
    • getDrawARound

      public int getDrawARound()
      Returns the current draw-round counter for this event.
      Returns:
      Draw-round counter.
    • setDrawARound

      public void setDrawARound(int drawARound)
      Updates the draw-round counter for this event.
      Parameters:
      drawARound - Draw-round counter to store.
    • getWaitingList

      public WaitingList getWaitingList()
      Returns the waiting-list helper associated with this event.
      Returns:
      Waiting-list helper.
    • setWaitingList

      public void setWaitingList(WaitingList waitingList)
      Updates the waiting-list helper associated with this event.
      Parameters:
      waitingList - Waiting-list helper to store.
    • getPendingList

      public PendingList getPendingList()
      Returns the pending-list helper associated with this event.
      Returns:
      Pending-list helper.
    • setPendingList

      public void setPendingList(PendingList pendingList)
      Updates the pending-list helper associated with this event.
      Parameters:
      pendingList - Pending-list helper to store.
    • getAcceptedList

      public AcceptedList getAcceptedList()
      Returns the accepted-list helper associated with this event.
      Returns:
      Accepted-list helper.
    • setAcceptedList

      public void setAcceptedList(AcceptedList acceptedList)
      Updates the accepted-list helper associated with this event.
      Parameters:
      acceptedList - Accepted-list helper to store.
    • getDeclinedList

      public DeclinedList getDeclinedList()
      Returns the declined-list helper associated with this event.
      Returns:
      Declined-list helper.
    • setDeclinedList

      public void setDeclinedList(DeclinedList declinedList)
      Updates the declined-list helper associated with this event.
      Parameters:
      declinedList - Declined-list helper to store.
    • startEventListen

      public void startEventListen(Event.EventUpdatedCallback callback)
      Method to get realtime updates of event.
    • stopEventListen

      public void stopEventListen()
      Stop fetching realtime updates of event.
    • startListenAllLists

      public void startListenAllLists(StatusList.ListUpdateListener listener)
      Start realtime listeners on all list classes.
      Parameters:
      listener - The callback function to be called when a list class detects an update.
    • stopListenAllLists

      public void stopListenAllLists()
      Stop realtime listeners on all list classes.
    • startImageListen

      public void startImageListen(String imageDocId)
      Activates an image listener for the given event.
      Parameters:
      imageDocId - Image Document Id to listen at.
    • stopImageListen

      public void stopImageListen()
      Stop fetching realtime updates of image pertaining to this event.
    • fetchLists

      public void fetchLists(Event.ListsLoadedCallback callback)
      Helper method to query and generate and populate lists with user objects.
      Parameters:
      callback - Callback method after firebase transaction.
    • refreshListsFromDB

      public void refreshListsFromDB()
      Resyncs the list objects with information from the db
    • fetchOrganizerNames

      public void fetchOrganizerNames(Event.fetchOrganizerNamesCallback callback)
      Obtains the names of the organizer tied to this event.
    • toString

      public String toString()
      Generates a string representation of the event object. Useful when filtering for specific keywords.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the event object.