Hi
I would like to implement an operation to allow me to subscribe a user to an alert.
So i am looking for the same behavior than if a go in Document Management - click on a file
- select Alerts and click on Subscribe Modification.
In Java Doc i found the NotificationManager with the method;
addSubscription(String username, String notification, DocumentModel doc, Boolean sendConfirmationEmail, NuxeoPrincipal principal, String notificationName)
But i am not sure what the two Strings "notification" and "notificationName" represents and how they are linked with the actual DocumentEventTypes.
I tried the following with no success;
@Param(name = "username")
protected String username;
@Param(name = "DocumentEventType")
protected String DocumentEventType;
@OperationMethod
public run(DocumentModel doc) throws Exception{
NotificationManager notificationManager = Framework.getService(NotificationManager.class);
notificationManager.addSubscription(username, DocumentEventType, doc, true, null, DocumentEventType);
If i get;
notificationManager.getSubscriptionsForUserOnDocument(username, doc.getId())
i can see a notification "documentModified" but i don't see it selected if i look in Document Management.
Does anyone have an idea on how to do this? ...examples?... links to source code ?
tx
Michel