Class NotificationService
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.ecm.platform.ec.notification.service.NotificationService
- All Implemented Interfaces:
NotificationManager,Adaptable,Component,Extensible,TimestampedService
- Author:
- Narcis Paslaru
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DocumentViewCodecManagerprotected EmailHelperprotected static final Stringprotected GeneralSettingsDescriptorprotected final Map<String,NotificationListenerHook> static final ComponentNameprotected static final Stringprotected static final Stringprotected NotificationRegistryprotected static final Stringprotected NotificationListenerVetoRegistryprotected EventProducerprotected Stringstatic final StringDeprecated.since 10.2, seems unusedprotected static final StringFields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(ComponentContext context) Activates the component.voidaddSubscription(String username, String notification, DocumentModel doc, Boolean sendConfirmationEmail, NuxeoPrincipal principal, String notificationName) Called when a user subscribes to a notification.voidaddSubscriptions(String username, DocumentModel doc, Boolean sendConfirmationEmail, NuxeoPrincipal principal) voiddeactivate(ComponentContext context) Deactivates the component.protected static DocumentModelprotected voidprotected voiddoFireEvent(Event event) <T> TgetAdapter(Class<T> adapter) Returns an object which is an instance of the given class associated with this object.Returns the name of theMailSenderthat will handle notificationMailMessagesDeprecated.since 2023.4 usegetMailSenderName()instead.getNotificationByName(String selectedNotification) Returns a notification with all data loaded (label, etc).Gets the list of event names used by notifications.getNotificationsForEvents(String eventId) getNotificationsForSubscriptions(String parentType) getSubscribedDocuments(String prefixedPrincipalName, String repositoryName) Returns the list of live docs the user is subscribed to in the given repository .getSubscribers(String notification, DocumentModel doc) Gets the users that subscribed to a notification on a certain document.getSubscriptionsForUserOnDocument(String username, DocumentModel doc) Gets the notifications for which a user subscribed for a certain document.static URLgetTemplateURL(String name) 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.voidregisterExtension(Extension extension) Registers the given extension.protected voidvoidremoveSubscription(String username, String notification, DocumentModel doc) Called when a user cancels his notification.voidremoveSubscriptions(String username, List<String> notifications, DocumentModel doc) protected voidvoidsendDocumentByMail(DocumentModel doc, String freemarkerTemplateName, String subject, String comment, NuxeoPrincipal sender, List<String> sendTo) Sends an e-mail directly.voidDirectly sends a notification to the principal, using the data provided in the mapvoidsetEmailHelper(EmailHelper emailHelper) voidstart(ComponentContext context) Start the component.voidunregisterExtension(Extension extension) Unregisters the given extension.Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, setLastModified, setModifiedNow, setName, stop, unregister, unregisterContributionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Field Details
-
NAME
-
SUBSCRIPTION_NAME
Deprecated.since 10.2, seems unused- See Also:
-
NOTIFICATIONS_EP
- See Also:
-
TEMPLATES_EP
- See Also:
-
GENERAL_SETTINGS_EP
- See Also:
-
NOTIFICATION_HOOK_EP
- See Also:
-
NOTIFICATION_VETO_EP
- See Also:
-
TEMPLATES_MAP
-
emailHelper
-
generalSettings
-
notificationRegistry
-
docLocator
-
hookListeners
-
notificationVetoRegistry
-
senderName
-
producer
-
-
Constructor Details
-
NotificationService
public NotificationService()
-
-
Method Details
-
getAdapter
Description copied from interface:AdaptableReturns an object which is an instance of the given class associated with this object. Returnsnullif no such object can be found.- Specified by:
getAdapterin interfaceAdaptable- Overrides:
getAdapterin classDefaultComponent- Parameters:
adapter- the adapter class to look up- Returns:
- a object castable to the given class, or
nullif this object does not have an adapter for the given class
-
activate
Description copied from interface:ComponentActivates the component.This method is called by the runtime when a component is activated.
- Specified by:
activatein interfaceComponent- Overrides:
activatein classDefaultComponent- Parameters:
context- the runtime context
-
deactivate
Description copied from interface:ComponentDeactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivatein interfaceComponent- Overrides:
deactivatein classDefaultComponent- Parameters:
context- the runtime context
-
start
Description copied from interface:ComponentStart the component. This method is called after all the components were resolved and activated- Specified by:
startin interfaceComponent- Overrides:
startin classDefaultComponent
-
registerExtension
Description copied from interface:ExtensibleRegisters the given extension.- Specified by:
registerExtensionin interfaceExtensible- Overrides:
registerExtensionin classDefaultComponent- Parameters:
extension- the extension to register
-
registerGeneralSettings
-
unregisterExtension
Description copied from interface:ExtensibleUnregisters the given extension.- Specified by:
unregisterExtensionin interfaceExtensible- Overrides:
unregisterExtensionin classDefaultComponent- Parameters:
extension- the extension to unregister
-
getNotificationListenerVetoRegistry
-
getSubscribers
Description copied from interface:NotificationManagerGets the users that subscribed to a notification on a certain document.- Specified by:
getSubscribersin interfaceNotificationManager
-
getSubscriptionsForUserOnDocument
Description copied from interface:NotificationManagerGets the notifications for which a user subscribed for a certain document.- Specified by:
getSubscriptionsForUserOnDocumentin interfaceNotificationManager
-
disableEvents
-
restoreEvents
-
addSubscription
public void addSubscription(String username, String notification, DocumentModel doc, Boolean sendConfirmationEmail, NuxeoPrincipal principal, String notificationName) Description copied from interface:NotificationManagerCalled when a user subscribes to a notification.- Specified by:
addSubscriptionin interfaceNotificationManager
-
addSubscriptions
public void addSubscriptions(String username, DocumentModel doc, Boolean sendConfirmationEmail, NuxeoPrincipal principal) - Specified by:
addSubscriptionsin interfaceNotificationManager
-
removeSubscriptions
- Specified by:
removeSubscriptionsin interfaceNotificationManager
-
doFireEvent
-
removeSubscription
Description copied from interface:NotificationManagerCalled when a user cancels his notification.- Specified by:
removeSubscriptionin interfaceNotificationManager
-
getTemplateURL
-
getServerUrlPrefix
-
getEMailSubjectPrefix
-
getMailSessionJndiName
Deprecated.since 2023.4 usegetMailSenderName()instead. -
getMailSenderName
Description copied from interface:NotificationManagerReturns the name of theMailSenderthat will handle notificationMailMessages- Specified by:
getMailSenderNamein interfaceNotificationManager
-
getNotificationByName
Description copied from interface:NotificationManagerReturns a notification with all data loaded (label, etc).- Specified by:
getNotificationByNamein interfaceNotificationManager
-
sendNotification
public void sendNotification(String notificationName, Map<String, Object> infoMap, String userPrincipal) Description copied from interface:NotificationManagerDirectly sends a notification to the principal, using the data provided in the mapThe 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:
sendNotificationin interfaceNotificationManager- Parameters:
notificationName- name of notificationinfoMap- data used to compose the notification bodyuserPrincipal- recipient used to get the adress(es) to send emails
-
sendDocumentByMail
public void sendDocumentByMail(DocumentModel doc, String freemarkerTemplateName, String subject, String comment, NuxeoPrincipal sender, List<String> sendTo) Description copied from interface:NotificationManagerSends an e-mail directly.- Specified by:
sendDocumentByMailin interfaceNotificationManager
-
getNotificationsForSubscriptions
- Specified by:
getNotificationsForSubscriptionsin interfaceNotificationManager
-
getNotificationsForEvents
- Specified by:
getNotificationsForEventsin interfaceNotificationManager
-
getEmailHelper
-
setEmailHelper
-
getNotificationEventNames
Description copied from interface:NotificationManagerGets the list of event names used by notifications.- Specified by:
getNotificationEventNamesin interfaceNotificationManager
-
getListenerHooks
-
getNotificationVetos
-
getUsersSubscribedToNotificationOnDocument
public List<String> getUsersSubscribedToNotificationOnDocument(String notification, DocumentModel doc) Description copied from interface:NotificationManagerGets all users and groups that subscribed to a notification on a document This is used in management of subscritptions.- Specified by:
getUsersSubscribedToNotificationOnDocumentin interfaceNotificationManager
-
getSubscribedDocuments
public List<DocumentModel> getSubscribedDocuments(String prefixedPrincipalName, String repositoryName) Description copied from interface:NotificationManagerReturns the list of live docs the user is subscribed to in the given repository .- Specified by:
getSubscribedDocumentsin interfaceNotificationManager
-
detachDocumentModel
-