Adobe-Consulting-Services / acs-aem-samples

AEM Code Samples repository
http://adobe-consulting-services.github.io/acs-aem-samples/
Apache License 2.0
206 stars 196 forks source link

AEM Inbox Notification #31

Open davidjgonzalez opened 9 years ago

davidjgonzalez commented 9 years ago

Sample code using TaskManager and Tasks

@sachinmali has example codes

SachinMali commented 6 years ago

Here is pseudo code

  1. In your OSGi Service class, inject instance of 'InboxNotificationSender'(com.adobe.acs.commons.notifications.InboxNotificationSender)

  2. Invoke 'buildInboxNotification()' method on above injected class to get 'InboxNotification' instance InboxNotification inboxNotification = inboxNotificationSender.buildInboxNotification()

  3. Populate the 'InboxNotification' instance with your details inboxNotification.setTitle("Hello World"); inboxNotification.setContentPath("/my/sample/path"); inboxNotification.setAssignee("AEM-USER-PRINCIPAL-NAME"); inboxNotification.setMessage("Greetings of the day!"); inboxNotification.setNotificationActions("Approve");

  4. Invoke 'sendInboxNotification()' method on Step-1 injected object, like

    inboxNotificationSender.sendInboxNotification(resourceResolver,inboxNotification);