Liferay Social Office brings many different capabilities to your enterprise. In this posting, we’ll give you a background on the Social Office components, discuss how notifications involve the user, and show you how to extend the notification capability.

Social Office Components

Liferay Social Office is one of the more productive offerings from Liferay.  CE and EE versions of Social Office are available in Marketplace as well as from the Liferay website. Social Office 3.0 is compatible with Liferay 6.2 and the code is available for download from github. Social Office is packaged as a self-contained set of components that initializes the environment (e.g., creating the additional tables necessary for Social Office) when deployed.

The Social Office package (CE edition) consists of the following portlets, hooks, and theme:

  • calendar-portlet
  • chat-portlet
  • contacts-portlet
  • deploy-listener-hook
  • events-display-portlet
  • microblogs-portlet
  • notifications-portlet
  • portal-compat-hook
  • private-messaging-portlet
  • so-activities-hook
  • so-announcements-portlet
  • so-configurations-portlet
  • so-hook
  • so-portlet
  • so-theme
  • tasks-portlet
  • wysiwyg-portlet

The Social Office dashboard shows off the features well. With sites, sync, search, team calendars, shared documents, workflow, collaboration and communications at your disposal, you will find your enterprise social intranet is up to speed quickly.

notification.PNG

Notifications in Social Office

The default Social Office theme places a notification counter on the dockbar in the upper corner. The counter shows the number of unread messages, and when we click on the counter a dropdown box shows us a list of messages.

notification2.PNG

The last link in this dropdown box is “View All Notifications”. This link takes you to the notifications portlet where you can see unread notifications, all notifications, and a configuration or opt-in panel:

notification3.PNG

As you can see, notifications can be sent from one Social Office user to another in a variety of situations. For instance, this can happen when someone sends you a membership request, announcement, message, social relationship request, assigns you a task, sends you a private message, or simply comments on your microblog (a Twitter-like communication mechanism in Social Office). The Notification Delivery panel shown above allows users to change their opt-in preferences.

Even better, the concept of notification (among other features) is not limited to the out-of-the-box use cases in Social Office and can be extended to fit the needs of your situation. Notifications can be generated (using custom code) on events that are not supported in the opt-in panel as shown above. For instance, you can send automated notifications to a targeted set of users about specific web content being published, or you might want to notify people about a new company benefit, sales event, training needs, new employee orientation, lunch menu, holiday calendar or even send more personalized information based on dynamic rule sets. You can use your judgment to determine what events in your organization are candidates for personalized user notification. This can enhance the user experience and productivity of your website significantly.

Extending Notifications

The use case that we will discuss in this blog is how to create and send custom notifications in Liferay Social Office.

Let’s say we have a collection of users we want to notify about an announcement that we have generated on a specified event. Follow these steps as an example, customizing for your needs:

1. Create a JSON payload.

JSONObject notificationEventJSONObject = JSONFactoryUtil .createJSONObject(); notificationEventJSONObject.put(“body”, myObject.getTitle()); notificationEventJSONObject.put(“entryId”, myObject.getEntryId()); notificationEventJSONObject.put(“groupId”, myObject.getClassPK()); notificationEventJSONObject.put(“portletId”, PortletKeys.ANNOUNCEMENTS); notificationEventJSONObject.put(“title”, “x-sent-a-new-announcement”); notificationEventJSONObject .put(“userId”, myObject.getUserId());

2. Send the notification.

             for (User user : users) {

                    NotificationEvent notificationEvent = NotificationEventFactoryUtil
                                  .createNotificationEvent(System.currentTimeMillis(),
                                               "6_WAR_soportlet",                         
                                               notificationEventJSONObject);

                    notificationEvent.setDeliveryRequired(0);

                    ChannelHubManagerUtil.sendNotificationEvent(user.getCompanyId(),
                                 user.getUserId(), notificationEvent);

             }

Summary

Social Office is a useful package that can improve the user experience and increase the productivity of a website quite dramatically. Unfortunately, so far, Liferay has not opened up the code for a specific version of Social Office; instead, what you have is the master copy. Please get in touch with XTIVIA to benefit from our experience in  Liferay and Social Office-based solutions.

Share This