@Override public void processAction( ActionMapping actionMapping, ActionForm actionForm, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try { if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { validateCAS(actionRequest); validateLDAP(actionRequest); if (!SessionErrors.isEmpty(actionRequest)) { setForward(actionRequest, "portlet.portal_settings.edit_company"); } else { updateCompany(actionRequest); sendRedirect(actionRequest, actionResponse); } } } catch (Exception e) { if (e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass()); setForward(actionRequest, "portlet.portal_settings.error"); } else if (e instanceof AddressCityException || e instanceof AccountNameException || e instanceof AddressStreetException || e instanceof AddressZipException || e instanceof CompanyMxException || e instanceof CompanyVirtualHostException || e instanceof CompanyWebIdException || e instanceof EmailAddressException || e instanceof LocaleException || e instanceof NoSuchCountryException || e instanceof NoSuchListTypeException || e instanceof NoSuchRegionException || e instanceof PhoneNumberException || e instanceof WebsiteURLException) { if (e instanceof NoSuchListTypeException) { NoSuchListTypeException nslte = (NoSuchListTypeException) e; SessionErrors.add(actionRequest, e.getClass().getName() + nslte.getType()); } else { SessionErrors.add(actionRequest, e.getClass(), e); } setForward(actionRequest, "portlet.portal_settings.edit_company"); } else { throw e; } } }
@Override public void processAction( ActionMapping actionMapping, ActionForm actionForm, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try { Organization organization = null; if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { organization = updateOrganization(actionRequest); } else if (cmd.equals(Constants.DELETE)) { deleteOrganizations(actionRequest); } String redirect = ParamUtil.getString(actionRequest, "redirect"); if (organization != null) { redirect = HttpUtil.setParameter( redirect, actionResponse.getNamespace() + "organizationId", organization.getOrganizationId()); } sendRedirect(actionRequest, actionResponse, redirect); } catch (Exception e) { if (e instanceof NoSuchOrganizationException || e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass()); setForward(actionRequest, "portlet.users_admin.error"); } else if (e instanceof AddressCityException || e instanceof AddressStreetException || e instanceof AddressZipException || e instanceof DuplicateOrganizationException || e instanceof EmailAddressException || e instanceof NoSuchCountryException || e instanceof NoSuchListTypeException || e instanceof NoSuchRegionException || e instanceof OrganizationNameException || e instanceof OrganizationParentException || e instanceof PhoneNumberException || e instanceof RequiredOrganizationException || e instanceof WebsiteURLException) { if (e instanceof NoSuchListTypeException) { NoSuchListTypeException nslte = (NoSuchListTypeException) e; SessionErrors.add(actionRequest, e.getClass().getName() + nslte.getType()); } else { SessionErrors.add(actionRequest, e.getClass()); } if (e instanceof RequiredOrganizationException) { String redirect = PortalUtil.escapeRedirect(ParamUtil.getString(actionRequest, "redirect")); long organizationId = ParamUtil.getLong(actionRequest, "organizationId"); if (organizationId > 0) { redirect = HttpUtil.setParameter( redirect, actionResponse.getNamespace() + "organizationId", organizationId); } if (Validator.isNotNull(redirect)) { actionResponse.sendRedirect(redirect); } } } else { throw e; } } }