List of usage examples for com.liferay.portal.kernel.model MembershipRequestConstants STATUS_DENIED
int STATUS_DENIED
To view the source code for com.liferay.portal.kernel.model MembershipRequestConstants STATUS_DENIED.
Click Source Link
From source file:com.liferay.invitation.invite.members.web.internal.notifications.InviteMembersUserNotificationHandler.java
License:Open Source License
@Override protected String getBody(UserNotificationEvent userNotificationEvent, ServiceContext serviceContext) throws Exception { JSONObject jsonObject = JSONFactoryUtil.createJSONObject(userNotificationEvent.getPayload()); long memberRequestId = jsonObject.getLong("classPK"); MemberRequest memberRequest = _memberRequestLocalService.fetchMemberRequest(memberRequestId); if (memberRequest.getStatus() != MembershipRequestConstants.STATUS_PENDING) { return StringPool.BLANK; }//from www .ja v a2 s. c om Group group = null; if (memberRequest != null) { group = _groupLocalService.fetchGroup(memberRequest.getGroupId()); } if ((group == null) || (memberRequest == null)) { _userNotificationEventLocalService .deleteUserNotificationEvent(userNotificationEvent.getUserNotificationEventId()); return null; } ResourceBundle resourceBundle = _resourceBundleLoader.loadResourceBundle(serviceContext.getLocale()); String title = ResourceBundleUtil.getString(resourceBundle, "x-invited-you-to-join-x", getUserNameLink(memberRequest.getUserId(), serviceContext), getSiteDescriptiveName(memberRequest.getGroupId(), serviceContext)); LiferayPortletResponse liferayPortletResponse = serviceContext.getLiferayPortletResponse(); PortletURL confirmURL = liferayPortletResponse.createActionURL(InviteMembersPortletKeys.INVITE_MEMBERS); confirmURL.setParameter(ActionRequest.ACTION_NAME, "updateMemberRequest"); confirmURL.setParameter("memberRequestId", String.valueOf(memberRequestId)); confirmURL.setParameter("status", String.valueOf(MembershipRequestConstants.STATUS_APPROVED)); confirmURL.setParameter("userNotificationEventId", String.valueOf(userNotificationEvent.getUserNotificationEventId())); confirmURL.setWindowState(WindowState.NORMAL); PortletURL ignoreURL = liferayPortletResponse.createActionURL(InviteMembersPortletKeys.INVITE_MEMBERS); ignoreURL.setParameter(ActionRequest.ACTION_NAME, "updateMemberRequest"); ignoreURL.setParameter("memberRequestId", String.valueOf(memberRequestId)); ignoreURL.setParameter("status", String.valueOf(MembershipRequestConstants.STATUS_DENIED)); ignoreURL.setParameter("userNotificationEventId", String.valueOf(userNotificationEvent.getUserNotificationEventId())); ignoreURL.setWindowState(WindowState.NORMAL); return StringUtil.replace(getBodyTemplate(), new String[] { "[$CONFIRM$]", "[$CONFIRM_URL$]", "[$IGNORE$]", "[$IGNORE_URL$]", "[$TITLE$]" }, new String[] { serviceContext.translate("confirm"), confirmURL.toString(), serviceContext.translate("ignore"), ignoreURL.toString(), title }); }