Package io.meeds.pwa.service
Class PwaSubscriptionService
java.lang.Object
io.meeds.pwa.service.PwaSubscriptionService
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PatternGrammar of a direct-notification kind, enforced both when a device stores a setting for it and when a caller schedules one: it namespaces the settings map and prefixes the action token's object id, so a kind carrying the separator would make that prefix ambiguous.static final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateSubscription(UserPushSubscription subscription, String username) voiddeleteAllSubscriptions(String username) voiddeleteSubscription(String id, String username) voiddeleteSubscription(String id, String username, boolean userAction) getNotificationSetting(String username, String subscriptionId, String notificationKind) getSubscription(String username, String id) getSubscriptions(String username) voidsaveNotificationSetting(String username, String subscriptionId, String notificationKind, DeviceNotificationSetting setting) Saves one direct-notification kind's setting on one device subscription.
-
Field Details
-
PWA_INSTALLED
- See Also:
-
NOTIFICATION_KIND_PATTERN
Grammar of a direct-notification kind, enforced both when a device stores a setting for it and when a caller schedules one: it namespaces the settings map and prefixes the action token's object id, so a kind carrying the separator would make that prefix ambiguous. -
PWA_UNINSTALLED
- See Also:
-
-
Constructor Details
-
PwaSubscriptionService
public PwaSubscriptionService()
-
-
Method Details
-
getSubscriptions
-
getSubscription
-
createSubscription
-
getNotificationSetting
public DeviceNotificationSetting getNotificationSetting(String username, String subscriptionId, String notificationKind) throws org.exoplatform.commons.exception.ObjectNotFoundException - Parameters:
username- subscription ownersubscriptionId- the device subscription idnotificationKind- the direct-notification kind (e.g. "chat")- Returns:
- the device's stored setting for that kind, or null when the device follows the defaults (enabled, caller-chosen delay)
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when no such subscription exists
-
saveNotificationSetting
public void saveNotificationSetting(String username, String subscriptionId, String notificationKind, DeviceNotificationSetting setting) throws org.exoplatform.commons.exception.ObjectNotFoundException Saves one direct-notification kind's setting on one device subscription. The write replaces the whole subscription document, so two concurrent saves of different kinds are last-write-win.- Parameters:
username- subscription ownersubscriptionId- the device subscription idnotificationKind- the direct-notification kind (e.g. "chat")setting- the {enabled, delayMinutes} pair to store- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when no such subscription exists
-
deleteSubscription
-
deleteSubscription
-
deleteAllSubscriptions
-