public class NotificationService extends DefaultComponent implements NotificationManager
Modifier and Type | Field and Description |
---|---|
protected DocumentViewCodecManager |
docLocator |
protected EmailHelper |
emailHelper |
protected static String |
GENERAL_SETTINGS_EP |
protected GeneralSettingsDescriptor |
generalSettings |
protected Map<String,NotificationListenerHook> |
hookListeners |
static ComponentName |
NAME |
protected static String |
NOTIFICATION_HOOK_EP |
protected static String |
NOTIFICATION_VETO_EP |
protected NotificationRegistry |
notificationRegistry |
protected static String |
NOTIFICATIONS_EP |
protected NotificationListenerVetoRegistry |
notificationVetoRegistry |
protected EventProducer |
producer |
static String |
SUBSCRIPTION_NAME |
protected static String |
TEMPLATES_EP |
protected static Map<String,URL> |
TEMPLATES_MAP |
lastModified
Constructor and Description |
---|
NotificationService() |
Modifier and Type | Method and Description |
---|---|
void |
activate(ComponentContext context)
Activates the component.
|
void |
addSubscription(String username,
String notification,
DocumentModel doc,
Boolean sendConfirmationEmail,
NuxeoPrincipal principal,
String notificationName)
Called when a user subscribes to a notification.
|
void |
addSubscriptions(String username,
DocumentModel doc,
Boolean sendConfirmationEmail,
NuxeoPrincipal principal) |
void |
deactivate(ComponentContext context)
Deactivates the component.
|
protected void |
doFireEvent(Event event) |
<T> T |
getAdapter(Class<T> adapter)
Returns an object which is an instance of the given class associated with this object.
|
EmailHelper |
getEmailHelper() |
String |
getEMailSubjectPrefix() |
Collection<NotificationListenerHook> |
getListenerHooks() |
String |
getMailSessionJndiName() |
Notification |
getNotificationByName(String selectedNotification)
Returns a notification with all data loaded (label, etc).
|
Set<String> |
getNotificationEventNames()
Gets the list of event names used by notifications.
|
NotificationListenerVetoRegistry |
getNotificationListenerVetoRegistry() |
NotificationRegistry |
getNotificationRegistry()
Returns the notification manager.
|
List<Notification> |
getNotificationsForEvents(String eventId) |
List<Notification> |
getNotificationsForSubscriptions(String parentType) |
Collection<NotificationListenerVeto> |
getNotificationVetos() |
String |
getServerUrlPrefix() |
List<DocumentModel> |
getSubscribedDocuments(String prefixedPrincipalName)
Returns the list of live docs the user is subscribed to.
|
List<String> |
getSubscribers(String notification,
DocumentModel doc)
Gets the users that subscribed to a notification on a certain document.
|
List<String> |
getSubscribers(String notification,
String docId)
Deprecated.
since 7.3
|
List<String> |
getSubscriptionsForUserOnDocument(String username,
DocumentModel doc)
Gets the notifications for which a user subscribed for a certain document.
|
List<String> |
getSubscriptionsForUserOnDocument(String username,
String docId)
Deprecated.
since 7.3
|
static URL |
getTemplateURL(String name) |
List<String> |
getUsersSubscribedToNotificationOnDocument(String notification,
DocumentModel doc)
Gets all users and groups that subscribed to a notification on a document This is used in management of
subscritptions.
|
List<String> |
getUsersSubscribedToNotificationOnDocument(String notification,
String docId)
Deprecated.
|
void |
registerExtension(Extension extension)
Registers the given extension.
|
protected void |
registerGeneralSettings(GeneralSettingsDescriptor desc) |
void |
removeSubscription(String username,
String notification,
DocumentModel doc)
Called when a user cancels his notification.
|
void |
removeSubscription(String username,
String notification,
String docId)
Called when a user cancels his notification.
|
void |
removeSubscriptions(String username,
List<String> notifications,
DocumentModel doc) |
void |
removeSubscriptions(String username,
List<String> notifications,
String docId) |
void |
sendDocumentByMail(DocumentModel doc,
String freemarkerTemplateName,
String subject,
String comment,
NuxeoPrincipal sender,
List<String> sendTo)
Sends an e-mail directly.
|
void |
sendNotification(String notificationName,
Map<String,Object> infoMap,
String userPrincipal)
Directly sends a notification to the principal, using the data provided in the map
|
void |
setEmailHelper(EmailHelper emailHelper) |
void |
unregisterExtension(Extension extension)
Unregisters the given extension.
|
applicationStarted, getApplicationStartedOrder, getLastModified, registerContribution, setLastModified, setModifiedNow, unregisterContribution
public static final ComponentName NAME
public static final String SUBSCRIPTION_NAME
protected static final String NOTIFICATIONS_EP
protected static final String TEMPLATES_EP
protected static final String GENERAL_SETTINGS_EP
protected static final String NOTIFICATION_HOOK_EP
protected static final String NOTIFICATION_VETO_EP
protected static final Map<String,URL> TEMPLATES_MAP
protected EmailHelper emailHelper
protected GeneralSettingsDescriptor generalSettings
protected NotificationRegistry notificationRegistry
protected DocumentViewCodecManager docLocator
protected final Map<String,NotificationListenerHook> hookListeners
protected NotificationListenerVetoRegistry notificationVetoRegistry
protected EventProducer producer
public NotificationService()
public <T> T getAdapter(Class<T> adapter)
Adaptable
null
if no such object can be found.getAdapter
in interface Adaptable
getAdapter
in class DefaultComponent
adapter
- the adapter class to look upnull
if this object does not have an adapter for
the given classpublic void activate(ComponentContext context)
Component
This method is called by the runtime when a component is activated.
activate
in interface Component
activate
in class DefaultComponent
context
- the runtime contextpublic void deactivate(ComponentContext context)
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
deactivate
in class DefaultComponent
context
- the runtime contextpublic void registerExtension(Extension extension)
Extensible
registerExtension
in interface Extensible
registerExtension
in class DefaultComponent
extension
- the extension to registerprotected void registerGeneralSettings(GeneralSettingsDescriptor desc)
public void unregisterExtension(Extension extension)
Extensible
unregisterExtension
in interface Extensible
unregisterExtension
in class DefaultComponent
extension
- the extension to unregisterpublic NotificationRegistry getNotificationRegistry()
NotificationManager
getNotificationRegistry
in interface NotificationManager
public NotificationListenerVetoRegistry getNotificationListenerVetoRegistry()
public List<String> getSubscribers(String notification, String docId)
NotificationManager
getSubscribers
in interface NotificationManager
getSubscribers(String, DocumentModel)
public List<String> getSubscribers(String notification, DocumentModel doc)
NotificationManager
getSubscribers
in interface NotificationManager
public List<String> getSubscriptionsForUserOnDocument(String username, String docId)
NotificationManager
getSubscriptionsForUserOnDocument
in interface NotificationManager
getSubscriptionsForUserOnDocument(String, DocumentModel)
public List<String> getSubscriptionsForUserOnDocument(String username, DocumentModel doc)
NotificationManager
getSubscriptionsForUserOnDocument
in interface NotificationManager
public void addSubscription(String username, String notification, DocumentModel doc, Boolean sendConfirmationEmail, NuxeoPrincipal principal, String notificationName)
NotificationManager
addSubscription
in interface NotificationManager
public void addSubscriptions(String username, DocumentModel doc, Boolean sendConfirmationEmail, NuxeoPrincipal principal)
addSubscriptions
in interface NotificationManager
public void removeSubscriptions(String username, List<String> notifications, String docId)
removeSubscriptions
in interface NotificationManager
public void removeSubscriptions(String username, List<String> notifications, DocumentModel doc)
removeSubscriptions
in interface NotificationManager
protected void doFireEvent(Event event)
public void removeSubscription(String username, String notification, String docId)
NotificationManager
removeSubscription
in interface NotificationManager
public void removeSubscription(String username, String notification, DocumentModel doc)
NotificationManager
removeSubscription
in interface NotificationManager
public List<String> getUsersSubscribedToNotificationOnDocument(String notification, String docId)
getUsersSubscribedToNotificationOnDocument
in interface NotificationManager
notification
- docId
- getSubscribers(String, DocumentModel)
public static URL getTemplateURL(String name)
public String getServerUrlPrefix()
public String getEMailSubjectPrefix()
public String getMailSessionJndiName()
public Notification getNotificationByName(String selectedNotification)
NotificationManager
getNotificationByName
in interface NotificationManager
public void sendNotification(String notificationName, Map<String,Object> infoMap, String userPrincipal)
NotificationManager
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.
sendNotification
in interface NotificationManager
notificationName
- name of notificationinfoMap
- data used to compose the notification bodyuserPrincipal
- recipient used to get the adress(es) to send emailspublic void sendDocumentByMail(DocumentModel doc, String freemarkerTemplateName, String subject, String comment, NuxeoPrincipal sender, List<String> sendTo)
NotificationManager
sendDocumentByMail
in interface NotificationManager
public List<Notification> getNotificationsForSubscriptions(String parentType)
getNotificationsForSubscriptions
in interface NotificationManager
public List<Notification> getNotificationsForEvents(String eventId)
getNotificationsForEvents
in interface NotificationManager
public EmailHelper getEmailHelper()
public void setEmailHelper(EmailHelper emailHelper)
public Set<String> getNotificationEventNames()
NotificationManager
getNotificationEventNames
in interface NotificationManager
public Collection<NotificationListenerHook> getListenerHooks()
public Collection<NotificationListenerVeto> getNotificationVetos()
public List<String> getUsersSubscribedToNotificationOnDocument(String notification, DocumentModel doc)
NotificationManager
getUsersSubscribedToNotificationOnDocument
in interface NotificationManager
public List<DocumentModel> getSubscribedDocuments(String prefixedPrincipalName)
NotificationManager
getSubscribedDocuments
in interface NotificationManager
Copyright © 2015 Nuxeo SA. All rights reserved.