Package com.example.oblong
Class Database
java.lang.Object
com.example.oblong.Database
Database
This class handles sending and fetching data from the Firebase-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Called when data is successfully received. -
Constructor Summary
ConstructorDescriptionDatabase()
TheDatabase
method assigns the variables to the Firebase collections -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEntrant
(String id, boolean locationEnabled, boolean notificationsEnabled, String user) TheaddEntrant
method adds an entrant to Firebasevoid
addEvent
(String id, String capacity, String dateAndTime, String description, com.google.firebase.firestore.GeoPoint location, String poster) TheaddEvent
method adds an event to Firebasevoid
TheaddFacility
method adds a facility to Firebasevoid
addNotification
(String id, String event, String text, String title) TheaddNotification
method adds a notification to Firebasevoid
addOrganizer
(String id, String facility, String user) TheaddOrganizer
method adds an organizer to Firebasevoid
addParticipant
(String id, String entrant, String event, com.google.firebase.firestore.GeoPoint location, String status) TheaddParticipant
method adds a participant to Firebasevoid
TheaddUser
method adds a user to Firebasestatic void
getCurrentUser
(Database.OnDataReceivedListener<String> listener) ThegetCurrentUser
method retrieves the user ID from Firebasevoid
getEntrant
(String id, Database.OnDataReceivedListener<HashMap<String, Object>> listener) ThegetEntrant
method retrieves an entrant data from Firebasevoid
ThegetEvent
method retrieves an event data from Firebasevoid
getFacility
(String id, Database.OnDataReceivedListener<HashMap<String, Object>> listener) ThegetFacility
method retrieves a facility data from Firebasevoid
getNotification
(String id, Database.OnDataReceivedListener<HashMap<String, Object>> listener) getNotification
method retrieves a notification data from Firebase}void
getOrganizer
(String id, Database.OnDataReceivedListener<HashMap<String, Object>> listener) ThegetOrganizer
method retrieves an organizer data from Firebasevoid
getParticipants
(String id, Database.OnDataReceivedListener<HashMap<String, Object>> listener) ThegetParticipant
method retrieves a participant data from Firebasevoid
ThegetUser
method retrieves a user data from Firebasevoid
query
(String collectionName, HashMap<String, Object> conditions, Database.OnDataReceivedListener<List<HashMap<String, Object>>> listener) Thequery
method queries a collection in Firebasevoid
updateDocument
(String collection, String document_id, HashMap<String, Object> updates, Database.OnDataReceivedListener<Boolean> listener) TheupdateDocument
method updates a document in Firebase
-
Constructor Details
-
Database
public Database()TheDatabase
method assigns the variables to the Firebase collections
-
-
Method Details
-
getCurrentUser
ThegetCurrentUser
method retrieves the user ID from Firebase- Parameters:
listener
-
-
updateDocument
public void updateDocument(String collection, String document_id, HashMap<String, Object> updates, Database.OnDataReceivedListener<Boolean> listener) TheupdateDocument
method updates a document in Firebase- Parameters:
collection
-document_id
-updates
-listener
-
-
getParticipants
public void getParticipants(String id, Database.OnDataReceivedListener<HashMap<String, Object>> listener) ThegetParticipant
method retrieves a participant data from Firebase- Parameters:
id
-listener
-
-
getOrganizer
public void getOrganizer(String id, Database.OnDataReceivedListener<HashMap<String, Object>> listener) ThegetOrganizer
method retrieves an organizer data from Firebase- Parameters:
id
-listener
-
-
getNotification
public void getNotification(String id, Database.OnDataReceivedListener<HashMap<String, Object>> listener) getNotification
method retrieves a notification data from Firebase}- Parameters:
id
-listener
-
-
getFacility
public void getFacility(String id, Database.OnDataReceivedListener<HashMap<String, Object>> listener) ThegetFacility
method retrieves a facility data from Firebase- Parameters:
id
-listener
-
-
getEntrant
ThegetEntrant
method retrieves an entrant data from Firebase- Parameters:
id
-listener
-
-
getEvent
ThegetEvent
method retrieves an event data from Firebase- Parameters:
id
-listener
-
-
getUser
ThegetUser
method retrieves a user data from Firebase- Parameters:
id
-listener
-
-
query
public void query(String collectionName, HashMap<String, Object> conditions, Database.OnDataReceivedListener<List<HashMap<String, Object>>> listener) Thequery
method queries a collection in Firebase- Parameters:
collectionName
-conditions
-listener
-
-
addParticipant
public void addParticipant(String id, String entrant, String event, com.google.firebase.firestore.GeoPoint location, String status) TheaddParticipant
method adds a participant to Firebase- Parameters:
id
-entrant
-event
-location
-status
-
-
addOrganizer
TheaddOrganizer
method adds an organizer to Firebase- Parameters:
id
-facility
-user
-
-
addNotification
TheaddNotification
method adds a notification to Firebase- Parameters:
id
-event
-text
-title
-
-
addFacility
TheaddFacility
method adds a facility to Firebase- Parameters:
id
-email
-name
-phone
-photo
-
-
addEntrant
public void addEntrant(String id, boolean locationEnabled, boolean notificationsEnabled, String user) TheaddEntrant
method adds an entrant to Firebase- Parameters:
id
-locationEnabled
-notificationsEnabled
-user
-
-
addUser
public void addUser(String id, String name, String email, String type, String phone, String profilePhoto) TheaddUser
method adds a user to Firebase- Parameters:
id
-name
-email
-type
-phone
-profilePhoto
-
-
addEvent
public void addEvent(String id, String capacity, String dateAndTime, String description, com.google.firebase.firestore.GeoPoint location, String poster) TheaddEvent
method adds an event to Firebase- Parameters:
id
-capacity
-dateAndTime
-description
-location
-poster
-
-