List of usage examples for com.liferay.portal.kernel.portlet DynamicActionRequest setParameter
public void setParameter(String name, String value)
From source file:com.liferay.login.web.internal.portlet.action.CreateAccountMVCActionCommand.java
License:Open Source License
private ActionRequest _wrapActionRequest(ActionRequest actionRequest) throws Exception { DynamicActionRequest dynamicActionRequest = new DynamicActionRequest(actionRequest); long prefixId = getListTypeId(actionRequest, "prefixValue", ListTypeConstants.CONTACT_PREFIX); dynamicActionRequest.setParameter("prefixId", String.valueOf(prefixId)); long suffixId = getListTypeId(actionRequest, "suffixValue", ListTypeConstants.CONTACT_SUFFIX); dynamicActionRequest.setParameter("suffixId", String.valueOf(suffixId)); return dynamicActionRequest; }
From source file:com.liferay.so.hook.action.EditUserAction.java
License:Open Source License
protected void updateUser(StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { updateProjectsEntries(actionRequest, actionResponse); String cmd = ParamUtil.getString(actionRequest, Constants.CMD); if (!cmd.equals(Constants.UPDATE)) { originalStrutsPortletAction.processAction(portletConfig, actionRequest, actionResponse); return;//from w w w .j ava 2 s.co m } DynamicActionRequest dynamicActionRequest = new DynamicActionRequest(actionRequest); User user = PortalUtil.getSelectedUser(actionRequest); Role role = RoleLocalServiceUtil.fetchRole(user.getCompanyId(), RoleConstants.SOCIAL_OFFICE_USER); if (role == null) { originalStrutsPortletAction.processAction(portletConfig, dynamicActionRequest, actionResponse); return; } long[] roleIds = getLongArray(actionRequest, "rolesSearchContainerPrimaryKeys"); boolean newSocialOfficeUser = ArrayUtil.contains(roleIds, role.getRoleId()); List<Role> roles = user.getRoles(); if (newSocialOfficeUser && !roles.contains(role)) { LayoutSetPrototype publicLayoutSetPrototype = LayoutSetPrototypeUtil.fetchLayoutSetPrototype( user.getCompanyId(), SocialOfficeConstants.LAYOUT_SET_PROTOTYPE_KEY_USER_PUBLIC); if (publicLayoutSetPrototype != null) { dynamicActionRequest.setParameter("publicLayoutSetPrototypeId", String.valueOf(publicLayoutSetPrototype.getLayoutSetPrototypeId())); dynamicActionRequest.setParameter("publicLayoutSetPrototypeLinkEnabled", Boolean.TRUE.toString()); } LayoutSetPrototype privateLayoutSetPrototype = LayoutSetPrototypeUtil.fetchLayoutSetPrototype( user.getCompanyId(), SocialOfficeConstants.LAYOUT_SET_PROTOTYPE_KEY_USER_PRIVATE); if (privateLayoutSetPrototype != null) { dynamicActionRequest.setParameter("privateLayoutSetPrototypeId", String.valueOf(privateLayoutSetPrototype.getLayoutSetPrototypeId())); dynamicActionRequest.setParameter("privateLayoutSetPrototypeLinkEnabled", Boolean.TRUE.toString()); } } else if (!newSocialOfficeUser && roles.contains(role)) { dynamicActionRequest.setParameter("publicLayoutSetPrototypeId", StringPool.BLANK); dynamicActionRequest.setParameter("publicLayoutSetPrototypeLinkEnabled", Boolean.FALSE.toString()); dynamicActionRequest.setParameter("privateLayoutSetPrototypeId", StringPool.BLANK); dynamicActionRequest.setParameter("privateLayoutSetPrototypeLinkEnabled", Boolean.FALSE.toString()); } originalStrutsPortletAction.processAction(portletConfig, dynamicActionRequest, actionResponse); }