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

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

Introduction

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

Prototype

public static void deleteUserNotificationDefinitions(String portletId) 

Source Link

Usage

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

License:Open Source License

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

    for (String portletId : portletIds) {
        UserNotificationManagerUtil.deleteUserNotificationDefinitions(portletId);

        Filter filter = new Filter(portletId);

        String userNotificationDefinitionsLocation = PortletProps
                .get(PortletPropsKeys.USER_NOTIFICATIONS_DEFINITIONS, filter);

        try {//from  w w w. j a  v a  2s  .  c o  m
            String xml = ContentUtil.get(userNotificationDefinitionsLocation);

            addUserNotificationDefinitions(xml, portletId);
        } catch (Exception e) {
            if (_log.isWarnEnabled()) {
                _log.warn("Unable to add user notification definitions " + userNotificationDefinitionsLocation);
            }
        }
    }
}