Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.platform.ec.notification.ejb.bean
Class NotificationServiceBean

java.lang.Object
  extended by org.nuxeo.ecm.platform.ec.notification.ejb.bean.NotificationServiceBean
All Implemented Interfaces:
NotificationServiceLocal, NotificationManager

public class NotificationServiceBean
extends java.lang.Object
implements NotificationServiceLocal

Author:
Narcis Paslaru, Thierry Martins

Constructor Summary
NotificationServiceBean()
           
 
Method Summary
 void addSubscription(java.lang.String username, java.lang.String notification, DocumentModel doc, java.lang.Boolean sendConfirmationEmail, NuxeoPrincipal principal, java.lang.String notificationName)
          Called when a user subscribes to a notification.
 Notification getNotificationByName(java.lang.String selectedNotification)
          Returns a notification with all data loaded (label, etc).
 NotificationRegistry getNotificationRegistry()
          Deprecated. should not have to use the registry
 java.util.List<Notification> getNotificationsForEvents(java.lang.String eventId)
           
 java.util.List<Notification> getNotificationsForSubscriptions(java.lang.String parentType)
           
 java.util.List<java.lang.String> getSubscribers(java.lang.String notification, java.lang.String docId)
          Gets the users that subscribed to a notification on a certain document.
 java.util.List<java.lang.String> getSubscriptionsForUserOnDocument(java.lang.String username, java.lang.String docId)
          Gets the notifications for which a user subscribed for a certain document.
 java.util.List<java.lang.String> getUsersSubscribedToNotificationOnDocument(java.lang.String notification, java.lang.String docId)
          Gets all users and groups that subscribed to a notification on a document This is used in management of subscritptions.
 void initialize()
           
 void removeSubscription(java.lang.String username, java.lang.String notification, java.lang.String docId)
          Called when a user cancels his notification.
 void sendDocumentByMail(DocumentModel doc, java.lang.String freemarkerTemplateName, java.lang.String subject, java.lang.String comment, NuxeoPrincipal sender, java.util.List<java.lang.String> sendTo)
          Sends an e-mail directly.
 void sendNotification(java.lang.String notificationName, java.util.Map<java.lang.String,java.lang.Object> infoMap, java.lang.String userPrincipal)
          Directly sends a notification to the principal, using the data provided in the map The map should contain at least the userName of the user calling the method stored under the key "author".
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NotificationServiceBean

public NotificationServiceBean()
Method Detail

initialize

@PostConstruct
public void initialize()

addSubscription

public void addSubscription(java.lang.String username,
                            java.lang.String notification,
                            DocumentModel doc,
                            java.lang.Boolean sendConfirmationEmail,
                            NuxeoPrincipal principal,
                            java.lang.String notificationName)
                     throws ClientException
Description copied from interface: NotificationManager
Called when a user subscribes to a notification.

Specified by:
addSubscription in interface NotificationManager
Throws:
ClientException

getSubscribers

public java.util.List<java.lang.String> getSubscribers(java.lang.String notification,
                                                       java.lang.String docId)
                                                throws ClientException
Description copied from interface: NotificationManager
Gets the users that subscribed to a notification on a certain document.

Specified by:
getSubscribers in interface NotificationManager
Throws:
ClientException

getSubscriptionsForUserOnDocument

public java.util.List<java.lang.String> getSubscriptionsForUserOnDocument(java.lang.String username,
                                                                          java.lang.String docId)
                                                                   throws java.lang.ClassNotFoundException,
                                                                          ClientException
Description copied from interface: NotificationManager
Gets the notifications for which a user subscribed for a certain document.

Specified by:
getSubscriptionsForUserOnDocument in interface NotificationManager
Throws:
java.lang.ClassNotFoundException
ClientException

getUsersSubscribedToNotificationOnDocument

public java.util.List<java.lang.String> getUsersSubscribedToNotificationOnDocument(java.lang.String notification,
                                                                                   java.lang.String docId)
                                                                            throws ClientException
Description copied from interface: NotificationManager
Gets all users and groups that subscribed to a notification on a document This is used in management of subscritptions.

Specified by:
getUsersSubscribedToNotificationOnDocument in interface NotificationManager
Throws:
ClientException

removeSubscription

public void removeSubscription(java.lang.String username,
                               java.lang.String notification,
                               java.lang.String docId)
                        throws ClientException
Description copied from interface: NotificationManager
Called when a user cancels his notification.

Specified by:
removeSubscription in interface NotificationManager
Throws:
ClientException

getNotificationRegistry

@Deprecated
public NotificationRegistry getNotificationRegistry()
Deprecated. should not have to use the registry

Description copied from interface: NotificationManager
Returns the notification manager.

Specified by:
getNotificationRegistry in interface NotificationManager

getNotificationByName

public Notification getNotificationByName(java.lang.String selectedNotification)
Description copied from interface: NotificationManager
Returns a notification with all data loaded (label, etc).

Specified by:
getNotificationByName in interface NotificationManager

getNotificationsForSubscriptions

public java.util.List<Notification> getNotificationsForSubscriptions(java.lang.String parentType)
Specified by:
getNotificationsForSubscriptions in interface NotificationManager

sendDocumentByMail

public void sendDocumentByMail(DocumentModel doc,
                               java.lang.String freemarkerTemplateName,
                               java.lang.String subject,
                               java.lang.String comment,
                               NuxeoPrincipal sender,
                               java.util.List<java.lang.String> sendTo)
Description copied from interface: NotificationManager
Sends an e-mail directly.

Specified by:
sendDocumentByMail in interface NotificationManager

sendNotification

public void sendNotification(java.lang.String notificationName,
                             java.util.Map<java.lang.String,java.lang.Object> infoMap,
                             java.lang.String userPrincipal)
                      throws ClientException
Description copied from interface: NotificationManager
Directly sends a notification to the principal, using the data provided in the map

The map should contain at least the userName of the user calling the method stored under the key "author".

infoMap should also contain all the variables that should be used to make-up the body of the notifications message.

Specified by:
sendNotification in interface NotificationManager
Parameters:
notificationName - name of notification
infoMap - data used to compose the notification body
userPrincipal - recipient used to get the adress(es) to send emails
Throws:
ClientException

getNotificationsForEvents

public java.util.List<Notification> getNotificationsForEvents(java.lang.String eventId)
Specified by:
getNotificationsForEvents in interface NotificationManager

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.