Configuration to Turn On Events
Use the 'NotificationLifecycleController.doEvents' preference to turn on event processing for a portlet definition. This needs to be done in both Notifications Portlet and Notifications Icon.
Adding Support to A Portlet
The follow changes will need to be performed on the portlet that wishes to publish Notifications entries into the Notifications system.
Add dependency for the Notifications API
First off, the portlet will need to have access to the Notifications API artifacts. Include these in pom.xml
Code Block | ||||
---|---|---|---|---|
| ||||
...
<dependency>
<groupId>org.jasig.portlet.notification</groupId>
<artifactId>notification-portlet-api</artifactId>
<version>3.0.0</version>
</dependency>
...
<dependency>
<groupId>org.jasig.portlet.notification</groupId>
<artifactId>notification-portlet-api</artifactId>
</dependency> |
Listen for Notification Events and Respond
Next, configure portlet.xml with the inter-portlet events to process and publish for each portlet.
Code Block | ||||
---|---|---|---|---|
| ||||
... </portlet-preferences> <supported-processing-event> <qname xmlns:x="https://source.jasig.org/schemas/portlet/notification">x:NotificationQuery</qname> </supported-processing-event> <supported-publishing-event> <qname xmlns:x="https://source.jasig.org/schemas/portlet/notification">x:NotificationResult</qname> </supported-publishing-event> </portlet> |
And at the end of the file, add the event definitions.
Code Block | ||
---|---|---|
| ||
...
<event-definition>
<qname xmlns:x="https://source.jasig.org/schemas/portlet/notification">x:NotificationQuery</qname>
<value-type>org.jasig.portlet.notice.NotificationQuery</value-type>
</event-definition>
<event-definition>
<qname xmlns:x="https://source.jasig.org/schemas/portlet/notification">x:NotificationResult</qname>
<value-type>org.jasig.portlet.notice.NotificationResult</value-type>
</event-definition>
</portlet-app> |
Example NotificationResult
Response Code
Use code like the following -- within another portlet -- to in a @Controller to respond to NotificationQuery
events and feed items to the NotificationPortlet.
...