Example usage for com.liferay.portal.kernel.notifications NotificationEvent setDeliveryType

List of usage examples for com.liferay.portal.kernel.notifications NotificationEvent setDeliveryType

Introduction

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

Prototype

public void setDeliveryType(int deliveryType) 

Source Link

Usage

From source file:com.liferay.invitation.invite.members.service.impl.MemberRequestLocalServiceImpl.java

License:Open Source License

protected void sendNotificationEvent(MemberRequest memberRequest) throws PortalException {

    String portletId = PortletProviderUtil.getPortletId(MemberRequest.class.getName(),
            PortletProvider.Action.EDIT);

    if (UserNotificationManagerUtil.isDeliver(memberRequest.getReceiverUserId(), portletId, 0,
            MembershipRequestConstants.STATUS_PENDING, UserNotificationDeliveryConstants.TYPE_WEBSITE)) {

        JSONObject notificationEventJSONObject = JSONFactoryUtil.createJSONObject();

        notificationEventJSONObject.put("classPK", memberRequest.getMemberRequestId());
        notificationEventJSONObject.put("userId", memberRequest.getUserId());

        NotificationEvent notificationEvent = NotificationEventFactoryUtil
                .createNotificationEvent(System.currentTimeMillis(), portletId, notificationEventJSONObject);

        notificationEvent.setDeliveryRequired(0);
        notificationEvent.setDeliveryType(UserNotificationDeliveryConstants.TYPE_WEBSITE);

        userNotificationEventLocalService.addUserNotificationEvent(memberRequest.getReceiverUserId(), true,
                notificationEvent);//from   w  ww.  j a  v  a  2 s .  c o  m
    }
}