Package dev.getelements.elements.sdk.dao
Interface FCMRegistrationDao
- All Known Implementing Classes:
MongoFCMRegistrationDao
public interface FCMRegistrationDao
Manipulates instances of
FCMRegistration
in the underlying database.-
Method Summary
Modifier and TypeMethodDescriptioncreateRegistration
(FCMRegistration fcmRegistration) Creates an instance ofFCMRegistration
and stores it in the database.void
deleteRegistration
(String fcmRegistrationId) Deletes an instance ofFCMRegistration
based on the supplied id.void
deleteRegistrationWithRequestingProfile
(Profile profile, String fcmRegistrationId) Deletes an instance ofFCMRegistration
based on the supplied id.default Stream
<FCMRegistration> getDistinctRegistrationsForRecipient
(String recipientId) Ensures that theStream
returned will only contain eachFCMRegistration
once, and only once.getRegistrationsForRecipient
(String recipientId) Gets aStream<FCMRegistration>
containing all currently registeredFCMRegistration
instances associated witht he suppliedProfile
id of the recipient.updateRegistration
(FCMRegistration fcmRegistration) Updates an instance ofFCMRegistration
in the database.
-
Method Details
-
createRegistration
Creates an instance ofFCMRegistration
and stores it in the database.- Parameters:
fcmRegistration
- theFCMRegistration
- Returns:
- the
FCMRegistration
instance as it was created in the database
-
updateRegistration
Updates an instance ofFCMRegistration
in the database. Reassigning the values ofFCMRegistration.getProfile()
orFCMRegistration.getRegistrationToken()
as necessary- Parameters:
fcmRegistration
- theFCMRegistration
instance- Returns:
- the
FCMRegistration
isntance as it was written to the database
-
deleteRegistration
Deletes an instance ofFCMRegistration
based on the supplied id. The id value corresponds to the value returned byFCMRegistration.getId()
.- Parameters:
fcmRegistrationId
- the id of theFCMRegistration
as supplied byFCMRegistration.getId()
-
deleteRegistrationWithRequestingProfile
Deletes an instance ofFCMRegistration
based on the supplied id. The id value corresponds to the value returned byFCMRegistration.getId()
. Additionally, this must refuse the if the suppliedProfile
does not match the owner of the correspendongFCMRegistration
.- Parameters:
fcmRegistrationId
- the id of theFCMRegistration
as supplied byFCMRegistration.getId()
-
getRegistrationsForRecipient
Gets aStream<FCMRegistration>
containing all currently registeredFCMRegistration
instances associated witht he suppliedProfile
id of the recipient.- Parameters:
recipientId
- theProfile
id of the recipient, as returned byProfile.getId()
- Returns:
- a
Stream<FCMRegistration>
containing all matchingFCMRegistration
instances
-
getDistinctRegistrationsForRecipient
Ensures that theStream
returned will only contain eachFCMRegistration
once, and only once. The default implementation of this method uses a technique similar toStream.distinct()
, but implementations may opt to use the underlying database to optimize this operation.- Parameters:
recipientId
- theProfile
id of the recipient, as returned byProfile.getId()
- Returns:
- a
Stream<FCMRegistration>
containing all matchingFCMRegistration
instances
-