Example usage for com.liferay.portal.kernel.notifications UserNotificationManagerUtil addUserNotificationHandler

List of usage examples for com.liferay.portal.kernel.notifications UserNotificationManagerUtil addUserNotificationHandler

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.notifications UserNotificationManagerUtil addUserNotificationHandler.

Prototype

public static void addUserNotificationHandler(UserNotificationHandler userNotificationHandler) 

Source Link

Usage

From source file:com.liferay.notifications.hook.events.StartupAction.java

License:Open Source License

protected void initUserNotificationHandlers() {
    String[] portletIds = PortletPropsValues.USER_NOTIFICATIONS_PORTLET_IDS;

    for (String portletId : portletIds) {
        Filter filter = new Filter(portletId);

        String userNotificationHandlerClassName = PortletProps.get(PortletPropsKeys.USER_NOTIFICATIONS_HANDLER,
                filter);/*  www  . jav  a2 s  . c  o  m*/

        try {
            UserNotificationHandler userNotificationHandler = (UserNotificationHandler) InstanceFactory
                    .newInstance(userNotificationHandlerClassName);

            UserNotificationManagerUtil.deleteUserNotificationHandler(userNotificationHandler);

            UserNotificationManagerUtil.addUserNotificationHandler(userNotificationHandler);
        } catch (Exception e) {
            if (_log.isWarnEnabled()) {
                _log.warn("Unable to add user notification handler " + userNotificationHandlerClassName);
            }
        }
    }
}

From source file:se.vgregion.hook.StartupEvent.java

License:Open Source License

@Override
public void run(String[] ids) throws ActionException {

    UserNotificationManagerUtil.addUserNotificationHandler(HANDLER);
    System.out.println("Add custom User Notification Handler");
}