Example usage for com.liferay.portal.kernel.notifications ChannelHubManagerUtil confirmDelivery

List of usage examples for com.liferay.portal.kernel.notifications ChannelHubManagerUtil confirmDelivery

Introduction

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

Prototype

public static void confirmDelivery(long companyId, long userId, String notificationEventUuid, boolean archived)
            throws ChannelException 

Source Link

Usage

From source file:com.liferay.so.notifications.portlet.NotificationsPortlet.java

License:Open Source License

public void dismissUserNotificationEvents(ActionRequest actionRequest, ActionResponse actionResponse)
        throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    String[] userNotificationEventUuids = StringUtil
            .split(ParamUtil.getString(actionRequest, "userNotificationEventUuids"));

    for (String userNotificationEventUuid : userNotificationEventUuids) {
        ChannelHubManagerUtil.confirmDelivery(themeDisplay.getCompanyId(), themeDisplay.getUserId(),
                userNotificationEventUuid, true);
    }/* www .  j a  v a 2s  . c  o m*/
}

From source file:com.liferay.so.notifications.portlet.NotificationsPortlet.java

License:Open Source License

public void updateMemberRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    long memberRequestId = ParamUtil.getLong(actionRequest, "memberRequestId");
    int status = ParamUtil.getInteger(actionRequest, "status");

    try {//w  ww  . ja v a 2  s. co  m
        MemberRequestLocalServiceUtil.updateMemberRequest(themeDisplay.getUserId(), memberRequestId, status);
    } catch (Exception e) {
        if ((e instanceof MemberRequestAlreadyUsedException)
                || (e instanceof MemberRequestInvalidUserException)) {

            SessionErrors.add(actionRequest, e.getClass().getName(), e);
        } else {
            throw e;
        }
    }

    String notificationEventUuid = ParamUtil.getString(actionRequest, "notificationEventUuid");

    ChannelHubManagerUtil.confirmDelivery(themeDisplay.getCompanyId(), themeDisplay.getUserId(),
            notificationEventUuid, false);
}

From source file:com.liferay.so.notifications.portlet.NotificationsPortlet.java

License:Open Source License

public void updateSocialRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    long requestId = ParamUtil.getLong(actionRequest, "requestId");
    int status = ParamUtil.getInteger(actionRequest, "status");

    SocialRequest socialRequest = SocialRequestLocalServiceUtil.getSocialRequest(requestId);

    if (SocialRelationLocalServiceUtil.hasRelation(socialRequest.getReceiverUserId(), socialRequest.getUserId(),
            SocialRelationConstants.TYPE_UNI_ENEMY)) {

        status = SocialRequestConstants.STATUS_IGNORE;
    }/*from w w  w . jav a 2 s.c  o m*/

    SocialRequestLocalServiceUtil.updateRequest(requestId, status, themeDisplay);

    String notificationEventUuid = ParamUtil.getString(actionRequest, "notificationEventUuid");

    ChannelHubManagerUtil.confirmDelivery(themeDisplay.getCompanyId(), themeDisplay.getUserId(),
            notificationEventUuid, false);
}