List of usage examples for com.liferay.portal.kernel.portlet LiferayPortletURL setPlid
public void setPlid(long plid);
From source file:org.opencps.notification.utils.NotificationUtils.java
License:Open Source License
public static String getLink(UserNotificationEvent userNotificationEvent, ServiceContext serviceContext, RenderRequest renderRequest) throws JSONException, WindowStateException { String pattern = StringPool.BLANK; long processOrderId = 0; long dossierId = 0; long paymentFileId = 0; LiferayPortletResponse liferayPortletResponse = null; LiferayPortletURL viewURL = null; try {// w ww .ja v a 2s . c om if (Validator.isNotNull(renderRequest) && Validator.isNull(serviceContext)) { try { serviceContext = ServiceContextFactory.getInstance(renderRequest); } catch (PortalException e) { _log.error(e); } } liferayPortletResponse = serviceContext.getLiferayPortletResponse(); JSONObject jsonObject = JSONFactoryUtil.createJSONObject(userNotificationEvent.getPayload()); dossierId = jsonObject.getLong("dossierId"); paymentFileId = jsonObject.getLong("paymentFileId"); processOrderId = jsonObject.getLong("processOrderId"); pattern = jsonObject.getString("patternConfig"); long plId = jsonObject.getString("plId").trim().length() > 0 ? Long.parseLong(jsonObject.getString("plId")) : 0; if (pattern.toUpperCase().contains(PortletKeys.EMPLOYEE) && paymentFileId <= 0 && processOrderId > 0) { if (Validator.isNull(viewURL)) { viewURL = liferayPortletResponse.createRenderURL(WebKeys.PROCESS_ORDER_PORTLET); } viewURL.setParameter("mvcPath", "/html/portlets/processmgt/processorder/process_order_detail.jsp"); viewURL.setParameter("processOrderId", String.valueOf(processOrderId)); viewURL.setPlid(plId); viewURL.setWindowState(WindowState.NORMAL); } else if (pattern.toUpperCase().contains(PortletKeys.CITIZEN) && paymentFileId <= 0 && dossierId > 0) { if (Validator.isNull(viewURL)) { viewURL = liferayPortletResponse.createRenderURL(WebKeys.DOSSIER_MGT_PORTLET); } viewURL.setParameter("mvcPath", "/html/portlets/dossiermgt/frontoffice/edit_dossier.jsp"); viewURL.setParameter("dossierId", String.valueOf(dossierId)); viewURL.setParameter("isEditDossier", String.valueOf(false)); viewURL.setPlid(plId); viewURL.setWindowState(WindowState.NORMAL); } else if (pattern.toUpperCase().contains(PortletKeys.EMPLOYEE) && paymentFileId > 0) { if (Validator.isNull(viewURL)) { viewURL = liferayPortletResponse.createRenderURL(WebKeys.PAYMENT_MANAGER_PORTLET); } viewURL.setParameter("mvcPath", "/html/portlets/paymentmgt/backoffice/backofficepaymentdetail.jsp"); viewURL.setParameter("paymentFileId", String.valueOf(paymentFileId)); viewURL.setPlid(plId); viewURL.setWindowState(WindowState.NORMAL); } else if (pattern.toUpperCase().contains(PortletKeys.CITIZEN) && paymentFileId > 0) { if (Validator.isNull(viewURL)) { viewURL = liferayPortletResponse.createRenderURL(WebKeys.PAYMENT_MGT_PORTLET); } viewURL.setParameter("mvcPath", "/html/portlets/paymentmgt/frontoffice/frontofficepaymentdetail.jsp"); viewURL.setParameter("paymentFileId", String.valueOf(paymentFileId)); viewURL.setPlid(plId); viewURL.setWindowState(WindowState.NORMAL); } } catch (Exception e) { _log.error(e); } return Validator.isNotNull(viewURL) ? viewURL.toString() : StringPool.BLANK; }
From source file:org.opencps.notificationmgt.engine.UserNotificationHandler.java
License:Open Source License
@Override protected String getLink(UserNotificationEvent userNotificationEvent, ServiceContext serviceContext) throws Exception { String group = StringPool.BLANK; String processOrderId = StringPool.BLANK; String dossierId = StringPool.BLANK; String paymentFileId = StringPool.BLANK; LiferayPortletResponse liferayPortletResponse = serviceContext.getLiferayPortletResponse(); JSONObject jsonObject = JSONFactoryUtil.createJSONObject(userNotificationEvent.getPayload()); group = jsonObject.getString("friendlyUrl"); dossierId = jsonObject.getString("dossierId"); paymentFileId = jsonObject.getString("paymentFileId"); processOrderId = jsonObject.getString("processOrderId"); long plId = jsonObject.getString("plId").trim().length() > 0 ? Long.parseLong(jsonObject.getString("plId")) : 0;//from w ww. j a v a 2s . c o m long groupId = jsonObject.getString("groupId").trim().length() > 0 ? Long.parseLong(jsonObject.getString("plId")) : 0; ; LiferayPortletURL viewURL = null; Layout layOut = null; if (group.equals(NotificationEventKeys.GROUP1)) { if (plId <= 0) { layOut = LayoutLocalServiceUtil.getFriendlyURLLayout(groupId, true, group); if (Validator.isNotNull(layOut)) { plId = layOut.getPlid(); } } viewURL = liferayPortletResponse.createRenderURL(WebKeys.PROCESS_ORDER_PORTLET); viewURL.setParameter("mvcPath", "/html/portlets/processmgt/processorder/process_order_detail.jsp"); viewURL.setParameter(ProcessOrderDisplayTerms.PROCESS_ORDER_ID, processOrderId); viewURL.setParameter(WebKeys.BACK_URL, "/group/guest" + group); viewURL.setParameter("isEditDossier", String.valueOf(true)); viewURL.setPlid(plId); viewURL.setWindowState(WindowState.NORMAL); } else if (group.equals(NotificationEventKeys.GROUP2)) { if (plId <= 0) { layOut = LayoutLocalServiceUtil.getFriendlyURLLayout(groupId, true, group); if (Validator.isNotNull(layOut)) { plId = layOut.getPlid(); } } viewURL = liferayPortletResponse.createRenderURL(WebKeys.DOSSIER_MGT_PORTLET); viewURL.setParameter("mvcPath", "/html/portlets/dossiermgt/frontoffice/edit_dossier.jsp"); viewURL.setParameter(DossierDisplayTerms.DOSSIER_ID, dossierId); viewURL.setParameter(Constants.CMD, Constants.VIEW); viewURL.setParameter(WebKeys.BACK_URL, "/group/guest/"); viewURL.setParameter(WebKeys.REDIRECT_URL, "/group/guest/"); viewURL.setParameter("isEditDossier", String.valueOf(false)); viewURL.setPlid(plId); viewURL.setWindowState(WindowState.NORMAL); } else if (group.equals(NotificationEventKeys.GROUP3)) { if (plId <= 0) { layOut = LayoutLocalServiceUtil.getFriendlyURLLayout(groupId, true, group); if (Validator.isNotNull(layOut)) { plId = layOut.getPlid(); } } viewURL = liferayPortletResponse.createRenderURL(WebKeys.PAYMENT_MGT_PORTLET); viewURL.setParameter("mvcPath", "/html/portlets/paymentmgt/frontoffice/frontofficepaymentdetail.jsp"); viewURL.setParameter(PaymentFileDisplayTerms.PAYMENT_FILE_ID, paymentFileId); viewURL.setParameter(Constants.CMD, Constants.VIEW); viewURL.setParameter(WebKeys.BACK_URL, "/group/guest" + group); viewURL.setParameter(WebKeys.REDIRECT_URL, "/group/guest" + group); viewURL.setPlid(plId); viewURL.setWindowState(WindowState.NORMAL); } else if (group.equals(NotificationEventKeys.GROUP4)) { if (plId <= 0) { layOut = LayoutLocalServiceUtil.getFriendlyURLLayout(groupId, true, group); if (Validator.isNotNull(layOut)) { plId = layOut.getPlid(); } } viewURL = liferayPortletResponse.createRenderURL(WebKeys.PAYMENT_MANAGER_PORTLET); viewURL.setParameter("mvcPath", "/html/portlets/paymentmgt/backoffice/backofficepaymentdetail.jsp"); viewURL.setParameter(PaymentFileDisplayTerms.PAYMENT_FILE_ID, paymentFileId); viewURL.setParameter(Constants.CMD, Constants.VIEW); viewURL.setParameter(WebKeys.REDIRECT_URL, "/group/guest"); viewURL.setPlid(plId); viewURL.setWindowState(WindowState.NORMAL); } return Validator.isNotNull(viewURL) ? viewURL.toString() : ""; }