List of usage examples for com.liferay.portal.kernel.servlet SessionErrors add
public static void add(PortletRequest portletRequest, String key)
From source file:com.liferay.portlet.sites.action.EditGroupAssignmentsAction.java
License:Open Source License
@Override public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try {/*from w ww. j a va2s . com*/ if (cmd.equals("group_organizations")) { updateGroupOrganizations(actionRequest); } else if (cmd.equals("group_user_groups")) { updateGroupUserGroups(actionRequest); } else if (cmd.equals("group_users")) { updateGroupUsers(actionRequest); } else if (cmd.equals("user_group_group_role")) { updateUserGroupGroupRole(actionRequest); } else if (cmd.equals("user_group_role")) { updateUserGroupRole(actionRequest); } if (Validator.isNotNull(cmd)) { String redirect = ParamUtil.getString(actionRequest, "assignmentsRedirect"); if (Validator.isNull(redirect)) { redirect = ParamUtil.getString(actionRequest, "redirect"); } sendRedirect(actionRequest, actionResponse, redirect); } } catch (Exception e) { if (e instanceof NoSuchGroupException || e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass().getName()); setForward(actionRequest, "portlet.sites_admin.error"); } else { throw e; } } }
From source file:com.liferay.portlet.sites.action.EditGroupAssignmentsAction.java
License:Open Source License
@Override public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { try {//from www . ja v a2 s .c o m ActionUtil.getGroup(renderRequest); } catch (Exception e) { if (e instanceof NoSuchGroupException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass().getName()); return mapping.findForward("portlet.sites_admin.error"); } else { throw e; } } return mapping.findForward(getForward(renderRequest, "portlet.sites_admin.edit_site_assignments")); }
From source file:com.liferay.portlet.sites.action.EditTeamAction.java
License:Open Source License
@Override public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try {/*w w w.jav a 2 s . co m*/ if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { updateTeam(actionRequest); } else if (cmd.equals(Constants.DELETE)) { deleteTeam(actionRequest); } sendRedirect(actionRequest, actionResponse); } catch (Exception e) { if (e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass().getName()); setForward(actionRequest, "portlet.sites_admin.error"); } else if (e instanceof DuplicateTeamException || e instanceof NoSuchTeamException || e instanceof TeamNameException) { SessionErrors.add(actionRequest, e.getClass().getName()); if (cmd.equals(Constants.DELETE)) { String redirect = PortalUtil.escapeRedirect(ParamUtil.getString(actionRequest, "redirect")); if (Validator.isNotNull(redirect)) { actionResponse.sendRedirect(redirect); } } } else { throw e; } } }
From source file:com.liferay.portlet.sites.action.EditTeamAction.java
License:Open Source License
@Override public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { try {/*w w w. j av a 2 s.c om*/ ActionUtil.getTeam(renderRequest); } catch (Exception e) { if (e instanceof NoSuchTeamException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass().getName()); return mapping.findForward("portlet.sites_admin.error"); } else { throw e; } } return mapping.findForward(getForward(renderRequest, "portlet.sites_admin.edit_team")); }
From source file:com.liferay.portlet.sites.action.EditTeamAssignmentsAction.java
License:Open Source License
@Override public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try {/*from www .ja v a 2s . c om*/ if (cmd.equals("team_user_groups")) { updateTeamUserGroups(actionRequest); } else if (cmd.equals("team_users")) { updateTeamUsers(actionRequest); } if (Validator.isNotNull(cmd)) { String redirect = ParamUtil.getString(actionRequest, "assignmentsRedirect"); sendRedirect(actionRequest, actionResponse, redirect); } } catch (Exception e) { if (e instanceof NoSuchTeamException || e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass().getName()); setForward(actionRequest, "portlet.sites_admin.error"); } else { throw e; } } }
From source file:com.liferay.portlet.sites.action.EditTeamAssignmentsAction.java
License:Open Source License
@Override public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { try {/* w ww. ja va 2 s .c om*/ ActionUtil.getTeam(renderRequest); } catch (Exception e) { if (e instanceof NoSuchTeamException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass().getName()); return mapping.findForward("portlet.sites_admin.error"); } else { throw e; } } return mapping.findForward(getForward(renderRequest, "portlet.sites_admin.edit_team_assignments")); }
From source file:com.liferay.portlet.sites.action.EditUserGroupRolesAction.java
License:Open Source License
@Override public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try {//from w w w . ja v a 2 s. c o m if (cmd.equals("user_group_group_role_users")) { updateUserGroupGroupRoleUsers(actionRequest); } sendRedirect(actionRequest, actionResponse); } catch (Exception e) { if (e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass().getName()); setForward(actionRequest, "portlet.sites_admin.error"); } else { throw e; } } }
From source file:com.liferay.portlet.sites.action.EditUserGroupRolesAction.java
License:Open Source License
@Override public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { try {//from w w w . j a v a 2 s . c o m ActionUtil.getGroup(renderRequest); ActionUtil.getRole(renderRequest); Role role = (Role) renderRequest.getAttribute(WebKeys.ROLE); if (role != null) { String name = role.getName(); if (name.equals(RoleConstants.ORGANIZATION_USER) || name.equals(RoleConstants.SITE_MEMBER)) { throw new NoSuchRoleException(); } } } catch (Exception e) { if (e instanceof NoSuchGroupException || e instanceof NoSuchRoleException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass().getName()); return mapping.findForward("portlet.sites_admin.error"); } else { throw e; } } return mapping.findForward(getForward(renderRequest, "portlet.sites_admin.edit_user_group_roles")); }
From source file:com.liferay.portlet.sites.action.EditUserRolesAction.java
License:Open Source License
@Override public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try {// w ww. j a v a2 s .c o m if (cmd.equals("user_group_role_users")) { updateUserGroupRoleUsers(actionRequest); } sendRedirect(actionRequest, actionResponse); } catch (Exception e) { if (e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass().getName()); setForward(actionRequest, "portlet.sites_admin.error"); } else { throw e; } } }
From source file:com.liferay.portlet.sites.action.EditUserRolesAction.java
License:Open Source License
@Override public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { try {// w w w .j a v a2s . co m ActionUtil.getGroup(renderRequest); ActionUtil.getRole(renderRequest); Role role = (Role) renderRequest.getAttribute(WebKeys.ROLE); if (role != null) { String name = role.getName(); if (name.equals(RoleConstants.ORGANIZATION_USER) || name.equals(RoleConstants.SITE_MEMBER)) { throw new NoSuchRoleException(); } } } catch (Exception e) { if (e instanceof NoSuchGroupException || e instanceof NoSuchRoleException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass().getName()); return mapping.findForward("portlet.sites_admin.error"); } else { throw e; } } return mapping.findForward(getForward(renderRequest, "portlet.sites_admin.edit_user_roles")); }