Class SubscriptionAdapter


  • public class SubscriptionAdapter
    extends Object
    Encapsulates all notification storage logic in the Notifiable facet.
    Since:
    7.3
    • Constructor Detail

      • SubscriptionAdapter

        public SubscriptionAdapter​(DocumentModel doc)
    • Method Detail

      • getNotificationMap

        protected Map<String,​Set<String>> getNotificationMap()
        Take the document storage propery and put it in a map.
        key
        notificationName
        value
        list of subscribers
        After having modified the map, update the doc with setNotificationMap(Map)
      • setNotificationMap

        protected void setNotificationMap​(Map<String,​Set<String>> map)
        Take a map and store it in the document's notification property. To get the original map, use getNotificationMap()
      • clearNotification

        protected void clearNotification()
        Clears the notification in the document's property.
        Since:
        10.2
      • getNotificationSubscribers

        public List<String> getNotificationSubscribers​(String notification)
        Return the list of subscribers name for a given notification.
      • getUserSubscriptions

        public List<String> getUserSubscriptions​(String username)
        Return the list of of subscriptions for a given user
      • addSubscription

        public void addSubscription​(String username,
                                    String notification)
        Add a subscription to a notification for a given user.
      • addSubscriptionsToAll

        public void addSubscriptionsToAll​(String username)
        Add a subscription to all notification for a given user
      • removeUserNotificationSubscription

        public void removeUserNotificationSubscription​(String username,
                                                       String notification)
        Remove a subscription to a notification for a given user.
      • copySubscriptionsTo

        public void copySubscriptionsTo​(DocumentModel targetDoc)
        Copy the subscriptions of the current doc to the targetted document.