Class NotificationRepository
java.lang.Object
com.example.skeddly.business.database.repository.GenericRepository<Notification>
com.example.skeddly.business.database.repository.NotificationRepository
A class to handle retrieving notifications from Firestore. This class is (typically) associated
with a particular user, which is relevant when performing aggregate retrievals.
-
Field Summary
FieldsFields inherited from class com.example.skeddly.business.database.repository.GenericRepository
clazz -
Constructor Summary
ConstructorsConstructorDescriptionNotificationRepository(com.google.firebase.firestore.FirebaseFirestore firestore) Create a new NotificationRepository that is not tied to a specific user.NotificationRepository(com.google.firebase.firestore.FirebaseFirestore firestore, String userId) Create a new NotificationRepository.NotificationRepository(com.google.firebase.firestore.FirebaseFirestore firestore, String userId, NotificationType notificationType) Create a new NotificationRepository. -
Method Summary
Modifier and TypeMethodDescriptionprotected com.google.firebase.firestore.CollectionReferenceThis method retrieves the reference to the collection of documents it handlesprotected com.google.firebase.firestore.QuerygetQuery()This method retrieves a query for getting all the documents handled by this repository.Methods inherited from class com.example.skeddly.business.database.repository.GenericRepository
count, delete, get, getAll, getAllByQuery, listen, listenAll, set
-
Field Details
-
COLLECTION_PATH
- See Also:
-
-
Constructor Details
-
NotificationRepository
public NotificationRepository(com.google.firebase.firestore.FirebaseFirestore firestore, @Nullable String userId, @Nullable NotificationType notificationType) Create a new NotificationRepository. The repository is associated with a particular user, and type of notification unless the userId or type is null. If the userId is null, the repository shall retrieve notifications for all users. If the type is null, the repository shall retrieve notifications of any type.- Parameters:
firestore- The FirebaseFirestore instance to use.userId- The user id that this repository is associated with.notificationType- The notification type that this repository is associated with.
-
NotificationRepository
public NotificationRepository(com.google.firebase.firestore.FirebaseFirestore firestore, @Nullable String userId) Create a new NotificationRepository. The repository is associated with a particular user, and type of notification unless the userId is null. If it is, the repository shall retrieve notifications for all users.- Parameters:
firestore- The FirebaseFirestore instance to use.userId- The user id that this repository is associated with.
-
NotificationRepository
public NotificationRepository(com.google.firebase.firestore.FirebaseFirestore firestore) Create a new NotificationRepository that is not tied to a specific user.- Parameters:
firestore- The FirebaseFirestore instance to use.
-
-
Method Details
-
getCollectionPath
protected com.google.firebase.firestore.CollectionReference getCollectionPath()Description copied from class:GenericRepositoryThis method retrieves the reference to the collection of documents it handles- Specified by:
getCollectionPathin classGenericRepository<Notification>- Returns:
- A CollectionReference to the collection of documents it handles.
-
getQuery
protected com.google.firebase.firestore.Query getQuery()Description copied from class:GenericRepositoryThis method retrieves a query for getting all the documents handled by this repository. This is commonly overridden in repositories that filter out documents by fields.- Overrides:
getQueryin classGenericRepository<Notification>- Returns:
- A query that can retrieve multiple documents.
-