List of usage examples for com.liferay.portal.kernel.theme ThemeDisplay getPpid
public String getPpid()
From source file:com.liferay.dynamic.data.mapping.web.internal.portlet.action.CopyTemplateMVCActionCommand.java
License:Open Source License
@Override protected String getSaveAndContinueRedirect(ActionRequest actionRequest, DDMTemplate template, String redirect) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, themeDisplay.getPpid(), PortletRequest.RENDER_PHASE); portletURL.setParameter("mvcPath", "/copy_template"); portletURL.setParameter("templateId", String.valueOf(template.getTemplateId()), false); portletURL.setWindowState(actionRequest.getWindowState()); return portletURL.toString(); }
From source file:com.liferay.dynamic.data.mapping.web.internal.portlet.action.DDMBaseMVCActionCommand.java
License:Open Source License
protected String getSaveAndContinueRedirect(ActionRequest actionRequest, DDMStructure structure, String redirect) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); String availableFields = ParamUtil.getString(actionRequest, "availableFields"); String eventName = ParamUtil.getString(actionRequest, "eventName"); LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, themeDisplay.getPpid(), PortletRequest.RENDER_PHASE); portletURL.setParameter("mvcPath", "/edit_structure.jsp"); portletURL.setParameter("redirect", redirect, false); portletURL.setParameter("groupId", String.valueOf(structure.getGroupId()), false); long classNameId = PortalUtil.getClassNameId(DDMStructure.class); portletURL.setParameter("classNameId", String.valueOf(classNameId), false); portletURL.setParameter("classPK", String.valueOf(structure.getStructureId()), false); portletURL.setParameter("availableFields", availableFields, false); portletURL.setParameter("eventName", eventName, false); portletURL.setWindowState(actionRequest.getWindowState()); return portletURL.toString(); }
From source file:com.liferay.dynamic.data.mapping.web.internal.portlet.action.DDMBaseMVCActionCommand.java
License:Open Source License
protected String getSaveAndContinueRedirect(ActionRequest actionRequest, DDMTemplate template, String redirect) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); String portletResourceNamespace = ParamUtil.getString(actionRequest, "portletResourceNamespace"); long classNameId = ParamUtil.getLong(actionRequest, "classNameId"); long classPK = ParamUtil.getLong(actionRequest, "classPK"); String structureAvailableFields = ParamUtil.getString(actionRequest, "structureAvailableFields"); LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, themeDisplay.getPpid(), PortletRequest.RENDER_PHASE); portletURL.setParameter("mvcPath", "/edit_template.jsp"); portletURL.setParameter("redirect", redirect, false); portletURL.setParameter("portletResourceNamespace", portletResourceNamespace, false); portletURL.setParameter("templateId", String.valueOf(template.getTemplateId()), false); portletURL.setParameter("groupId", String.valueOf(template.getGroupId()), false); portletURL.setParameter("classNameId", String.valueOf(classNameId), false); portletURL.setParameter("classPK", String.valueOf(classPK), false); portletURL.setParameter("type", template.getType(), false); portletURL.setParameter("structureAvailableFields", structureAvailableFields, false); portletURL.setWindowState(actionRequest.getWindowState()); return portletURL.toString(); }
From source file:com.liferay.journal.web.internal.portlet.JournalPortlet.java
License:Open Source License
protected void sendEditArticleRedirect(ActionRequest actionRequest, ActionResponse actionResponse, JournalArticle article, String oldUrlTitle) throws Exception { String actionName = ParamUtil.getString(actionRequest, ActionRequest.ACTION_NAME); String redirect = ParamUtil.getString(actionRequest, "redirect"); int workflowAction = ParamUtil.getInteger(actionRequest, "workflowAction", WorkflowConstants.ACTION_PUBLISH); String portletId = HttpUtil.getParameter(redirect, "p_p_id", false); String namespace = _portal.getPortletNamespace(portletId); if (Validator.isNotNull(oldUrlTitle)) { String oldRedirectParam = namespace + "redirect"; String oldRedirect = HttpUtil.getParameter(redirect, oldRedirectParam, false); if (Validator.isNotNull(oldRedirect)) { String newRedirect = HttpUtil.decodeURL(oldRedirect); newRedirect = StringUtil.replace(newRedirect, oldUrlTitle, article.getUrlTitle()); newRedirect = StringUtil.replace(newRedirect, oldRedirectParam, "redirect"); redirect = StringUtil.replace(redirect, oldRedirect, newRedirect); }//from www .j a v a 2s . co m } if ((actionName.equals("deleteArticle") || actionName.equals("deleteArticles")) && !ActionUtil.hasArticle(actionRequest)) { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, themeDisplay.getPpid(), PortletRequest.RENDER_PHASE); redirect = portletURL.toString(); } if ((article != null) && (workflowAction == WorkflowConstants.ACTION_SAVE_DRAFT)) { redirect = getSaveAndContinueRedirect(actionRequest, article, redirect); if (actionName.equals("previewArticle")) { SessionMessages.add(actionRequest, "previewRequested"); hideDefaultSuccessMessage(actionRequest); } } else { WindowState windowState = actionRequest.getWindowState(); if (windowState.equals(LiferayWindowState.POP_UP)) { redirect = _portal.escapeRedirect(redirect); if (Validator.isNotNull(redirect)) { if (actionName.equals("addArticle") && (article != null)) { redirect = HttpUtil.addParameter(redirect, namespace + "className", JournalArticle.class.getName()); redirect = HttpUtil.addParameter(redirect, namespace + "classPK", JournalArticleAssetRenderer.getClassPK(article)); } } } } actionRequest.setAttribute(WebKeys.REDIRECT, redirect); }
From source file:com.liferay.polls.web.internal.portlet.action.EditQuestionMVCActionCommand.java
License:Open Source License
protected void addAndStoreSelection(PortletRequest portletRequest, PollsQuestion question) throws Exception { String referringPortletResource = ParamUtil.getString(portletRequest, "referringPortletResource"); if (Validator.isNull(referringPortletResource)) { return;/*www . j ava2 s . co m*/ } ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletPreferences portletPreferences = PortletPreferencesFactoryUtil .getStrictPortletSetup(themeDisplay.getLayout(), themeDisplay.getPpid()); portletPreferences.setValue("questionId", String.valueOf(question.getQuestionId())); portletPreferences.store(); SessionMessages.add(portletRequest, portal.getPortletId(portletRequest) + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET, referringPortletResource); }
From source file:com.liferay.quick.note.web.internal.portlet.action.SaveMVCActionCommand.java
License:Open Source License
@Override public boolean processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); try {/* w w w . j a v a 2s . c o m*/ PortletPermissionUtil.check(themeDisplay.getPermissionChecker(), themeDisplay.getLayout(), themeDisplay.getPpid(), ActionKeys.CONFIGURATION); PortletPreferences portletPreferences = PortletPreferencesFactoryUtil .getStrictPortletSetup(themeDisplay.getLayout(), themeDisplay.getPpid()); if (portletPreferences instanceof StrictPortletPreferencesImpl) { throw new PortletPreferencesException.MustBeStrict(themeDisplay.getPpid()); } String color = ParamUtil.getString(actionRequest, "color"); String data = ParamUtil.getString(actionRequest, "data"); if (Validator.isNotNull(color)) { portletPreferences.setValue("color", color); } if (Validator.isNotNull(data)) { portletPreferences.setValue("data", data); } portletPreferences.store(); } catch (Exception e) { throw new PortletException(e); } return true; }