Class SubscriptionAdapter
- java.lang.Object
-
- org.nuxeo.ecm.platform.ec.notification.SubscriptionAdapter
-
public class SubscriptionAdapter extends Object
Encapsulates all notification storage logic in the Notifiable facet.- Since:
- 7.3
-
-
Field Summary
Fields Modifier and Type Field Description protected DocumentModel
doc
protected static String
NOTIF_NAMEKEY
protected static String
NOTIF_PROPERTY
protected static String
NOTIF_SUBSCRIBERSKEY
static String
NOTIFIABLE_FACET
-
Constructor Summary
Constructors Constructor Description SubscriptionAdapter(DocumentModel doc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSubscription(String username, String notification)
Add a subscription to a notification for a given user.void
addSubscriptionsToAll(String username)
Add a subscription to all notification for a given userprotected void
clearNotification()
Clears the notification in the document's property.void
copySubscriptionsTo(DocumentModel targetDoc)
Copy the subscriptions of the current doc to the targetted document.protected Map<String,Set<String>>
getNotificationMap()
Take the document storage propery and put it in a map.List<String>
getNotificationSubscribers(String notification)
Return the list of subscribers name for a given notification.List<String>
getUserSubscriptions(String username)
Return the list of of subscriptions for a given uservoid
removeUserNotificationSubscription(String username, String notification)
Remove a subscription to a notification for a given user.protected void
setNotificationMap(Map<String,Set<String>> map)
Take a map and store it in the document's notification property.
-
-
-
Field Detail
-
NOTIFIABLE_FACET
public static final String NOTIFIABLE_FACET
- See Also:
- Constant Field Values
-
NOTIF_PROPERTY
protected static final String NOTIF_PROPERTY
- See Also:
- Constant Field Values
-
NOTIF_SUBSCRIBERSKEY
protected static final String NOTIF_SUBSCRIBERSKEY
- See Also:
- Constant Field Values
-
NOTIF_NAMEKEY
protected static final String NOTIF_NAMEKEY
- See Also:
- Constant Field Values
-
doc
protected DocumentModel doc
-
-
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
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, usegetNotificationMap()
-
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.
-
-