Class PwaSubscriptionService

java.lang.Object
io.meeds.pwa.service.PwaSubscriptionService

@Service public class PwaSubscriptionService extends Object
  • Field Details

    • PWA_INSTALLED

      public static final String PWA_INSTALLED
      See Also:
    • NOTIFICATION_KIND_PATTERN

      public static final Pattern 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

      public static final String PWA_UNINSTALLED
      See Also:
  • Constructor Details

    • PwaSubscriptionService

      public PwaSubscriptionService()
  • Method Details

    • getSubscriptions

      public List<UserPushSubscription> getSubscriptions(String username)
    • getSubscription

      public UserPushSubscription getSubscription(String username, String id)
    • createSubscription

      public void createSubscription(UserPushSubscription subscription, String username)
    • getNotificationSetting

      public DeviceNotificationSetting getNotificationSetting(String username, String subscriptionId, String notificationKind) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Parameters:
      username - subscription owner
      subscriptionId - the device subscription id
      notificationKind - 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 owner
      subscriptionId - the device subscription id
      notificationKind - 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

      public void deleteSubscription(String id, String username)
    • deleteSubscription

      public void deleteSubscription(String id, String username, boolean userAction)
    • deleteAllSubscriptions

      public void deleteAllSubscriptions(String username)