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

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

Introduction

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

Prototype

public static java.util.List<com.liferay.portal.kernel.model.UserNotificationEvent> getArchivedUserNotificationEvents(
            long userId, int deliveryType, boolean actionRequired, boolean archived, 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(//  w  w  w .j av a2s.  c  o 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));
    }
}