Example usage for com.liferay.portal.kernel.service UserNotificationEventLocalServiceUtil getDeliveredUserNotificationEvents

List of usage examples for com.liferay.portal.kernel.service UserNotificationEventLocalServiceUtil getDeliveredUserNotificationEvents

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.service UserNotificationEventLocalServiceUtil getDeliveredUserNotificationEvents.

Prototype

public static java.util.List<com.liferay.portal.kernel.model.UserNotificationEvent> getDeliveredUserNotificationEvents(
            long userId, int deliveryType, boolean delivered, boolean actionRequired, int start, int end,
            com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.kernel.model.UserNotificationEvent> obc) 

Source Link

Usage

From source file:com.liferay.notifications.web.internal.util.NotificationsUtil.java

License:Open Source License

public static void populateResults(long userId, boolean actionRequired, String navigation, String orderByType,
        SearchContainer<UserNotificationEvent> searchContainer) throws PortalException {

    OrderByComparator<UserNotificationEvent> obc = new UserNotificationEventTimestampComparator(
            orderByType.equals("asc"));

    if (navigation.equals("all")) {
        searchContainer.setTotal(UserNotificationEventLocalServiceUtil
                .getDeliveredUserNotificationEventsCount(userId, _DELIVERY_TYPE, true, actionRequired));

        searchContainer.setResults(/*from  www . j a  va  2s  . co  m*/
                UserNotificationEventLocalServiceUtil.getDeliveredUserNotificationEvents(userId, _DELIVERY_TYPE,
                        true, actionRequired, searchContainer.getStart(), searchContainer.getEnd(), obc));
    } else {
        boolean archived = false;

        if (navigation.equals("read")) {
            archived = true;
        }

        searchContainer.setTotal(UserNotificationEventLocalServiceUtil
                .getArchivedUserNotificationEventsCount(userId, _DELIVERY_TYPE, actionRequired, archived));

        searchContainer.setResults(
                UserNotificationEventLocalServiceUtil.getArchivedUserNotificationEvents(userId, _DELIVERY_TYPE,
                        actionRequired, archived, searchContainer.getStart(), searchContainer.getEnd(), obc));
    }
}