Example usage for com.liferay.portal.kernel.portlet PortalPreferences getValue

List of usage examples for com.liferay.portal.kernel.portlet PortalPreferences getValue

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.portlet PortalPreferences getValue.

Prototype

public String getValue(String namespace, String key);

Source Link

Usage

From source file:com.liferay.user.notification.event.service.UserNotificationEventCustomServiceWrapper.java

License:Open Source License

protected void storeUserNotificationEventsCount(long userId, int deliveryType) {

    if (deliveryType != UserNotificationDeliveryConstants.TYPE_WEBSITE) {
        return;//  ww w  . java2 s.  c om
    }

    PortalPreferences portalPreferences = PortletPreferencesFactoryUtil.getPortalPreferences(userId, true);

    long userNotificationEventsCount = GetterUtil.getLong(
            portalPreferences.getValue(UserNotificationEvent.class.getName(), "userNotificationEventsCount"));

    portalPreferences.setValue(UserNotificationEvent.class.getName(), "userNotificationEventsCount",
            String.valueOf(++userNotificationEventsCount));

    PortalPreferencesLocalServiceUtil.updatePreferences(userId, PortletKeys.PREFS_OWNER_TYPE_USER,
            PortletPreferencesFactoryUtil.toXML(portalPreferences));
}