public void processAction( ActionMapping mapping, ActionForm form, PortletConfig config, ActionRequest req, ActionResponse res) throws Exception { String cmd = ParamUtil.getString(req, Constants.CMD); try { Organization organization = null; if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { organization = updateOrganization(req); } else if (cmd.equals(Constants.DELETE)) { deleteOrganizations(req); } String redirect = ParamUtil.getString(req, "redirect"); if (organization != null) { redirect += organization.getOrganizationId(); } sendRedirect(req, res, redirect); } catch (Exception e) { if (e instanceof NoSuchOrganizationException || e instanceof PrincipalException) { SessionErrors.add(req, e.getClass().getName()); setForward(req, "portlet.enterprise_admin.error"); } else if (e instanceof DuplicateOrganizationException || e instanceof NoSuchCountryException || e instanceof NoSuchListTypeException || e instanceof OrganizationNameException || e instanceof OrganizationParentException || e instanceof RequiredOrganizationException) { SessionErrors.add(req, e.getClass().getName()); if (e instanceof RequiredOrganizationException) { res.sendRedirect(ParamUtil.getString(req, "redirect")); } } else { throw e; } } }
public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception { req.getSession().setAttribute("Maintain", null); String id = req.getParameter("id"); String answerInfo = req.getParameter("answerInfo"); String userId = (String) req.getSession().getAttribute(WebKeys.USER_ID); String operator = req.getParameter("operator"); String accidentExplain = req.getParameter("accidentExplain"); String operatorDepend = req.getParameter("operatorDepend"); String operatorStep = req.getParameter("operatorStep"); String applyPeople = req.getParameter("applyPeople"); String applyEmail = req.getParameter("applyEmail"); String[] MaintainType = req.getParameterValues("maintainType"); try { if (MaintainType == null) { SessionErrors.add(req, EcardConstants.CHOOSE_MAINTAIN_TYPE); return mapping.getInputForward(); } if (MaintainUtil.answerMaintainInfo( id, userId, answerInfo, MaintainType, operator, accidentExplain, operatorDepend, operatorStep, applyPeople, applyEmail) == true) { SessionErrors.add(req, EcardConstants.EDIT_INFO_SUCCESS); req.getSession().setAttribute("Maintain", null); Maintain maintain = MaintainUtil.getMaintainById(id); req.setAttribute("status", maintain.getStatus()); return mapping.findForward("portlet.maintain.admin"); } else { return mapping.getInputForward(); } /*if (isTokenValid(req)) { MaintainUtil.addMaintain(applyTitle,applyInfo, MaintainType,userId); resetToken(req); }*/ } catch (PortalException pe) { req.setAttribute(PageContext.EXCEPTION, pe); return mapping.findForward(Constants.COMMON_ERROR); } }
public void processAction(PortletConfig config, ActionRequest req, ActionResponse res) throws Exception { String cmd = ParamUtil.getString(req, Constants.CMD); String portletResource = ParamUtil.getString(req, "portletResource"); PortletPreferences prefs = PortletPreferencesFactoryUtil.getPortletSetup(req, portletResource, true, true); if (cmd.equals("remove-footer-article")) { removeFooterArticle(req, prefs); } else if (cmd.equals("remove-header-article")) { removeHeaderArticle(req, prefs); } else if (cmd.equals("set-footer-article")) { setFooterArticle(req, prefs); } else if (cmd.equals("set-header-article")) { setHeaderArticle(req, prefs); } else if (cmd.equals(Constants.UPDATE)) { updateConfiguration(req, prefs); } if (SessionErrors.isEmpty(req)) { try { prefs.store(); } catch (ValidatorException ve) { SessionErrors.add(req, ValidatorException.class.getName(), ve); return; } SessionMessages.add(req, config.getPortletName() + ".doConfigure"); } }
public void processAction(PortletConfig config, ActionRequest req, ActionResponse res) throws Exception { try { String cmd = ParamUtil.getString(req, Constants.CMD); if (!cmd.equals(Constants.UPDATE)) { return; } String content = ParamUtil.getString(req, "content"); if (Validator.isNull(content)) { throw new AnnouncementsContentException(); } String portletResource = ParamUtil.getString(req, "portletResource"); String languageId = LanguageUtil.getLanguageId(req); PortletPreferences prefs = PortletPreferencesFactoryUtil.getPortletSetup(req, portletResource, false, false); LocalizationUtil.setPrefsValue(prefs, "content", languageId, content); prefs.store(); SessionMessages.add(req, config.getPortletName() + ".doConfigure"); } catch (AnnouncementsContentException ace) { SessionErrors.add(req, ace.getClass().getName()); } }
public void processAction( ActionMapping mapping, ActionForm form, PortletConfig config, ActionRequest req, ActionResponse res) throws Exception { String cmd = req.getParameter(Constants.CMD); if ((cmd != null) && (cmd.equals(Constants.ADD))) { try { _import(req, res); } catch (Exception e) { if (e != null && e instanceof ContactEmailAddressException || e instanceof ContactFirstNameException || e instanceof ContactLastNameException || e instanceof DuplicateContactException || e instanceof UploadException) { SessionErrors.add(req, e.getClass().getName()); setForward(req, "portlet.address_book.import_export"); } else { req.setAttribute(PageContext.EXCEPTION, e); setForward(req, Constants.COMMON_ERROR); } } } else { setForward(req, "portlet.address_book.import_export"); } }
public void processAction(ActionRequest req, ActionResponse res) throws IOException, PortletException { try { String cmd = ParamUtil.getString(req, Constants.CMD); if (cmd.equals(Constants.SEND)) { String selectTo = req.getParameter("select_to"); String to = req.getParameter("to"); String subject = ParamUtil.getString(req, "subject"); String message = ParamUtil.getString(req, "message"); if (!Validator.isEmailAddress(selectTo) && !Validator.isEmailAddress(to)) { SessionErrors.add(req, "to_invalid"); } else if (!Validator.isEmailAddress(to)) { to = selectTo; } if (SessionErrors.isEmpty(req)) { User user = PortalUtil.getUser(req); MailServiceUtil.sendEmail( new MailMessage( new InternetAddress(user.getEmailAddress(), user.getFullName()), new InternetAddress(to), subject, message)); res.setRenderParameter("select_to", StringPool.BLANK); res.setRenderParameter("to", StringPool.BLANK); res.setRenderParameter("subject", StringPool.BLANK); res.setRenderParameter("message", StringPool.BLANK); SessionMessages.add(req, getPortletConfig().getPortletName() + ".send", to); } else { res.setRenderParameter("select_to", selectTo); res.setRenderParameter("to", to); res.setRenderParameter("subject", subject); res.setRenderParameter("message", message); } } } catch (Exception e) { throw new PortletException(e); } }
public ActionForward render( ActionMapping mapping, ActionForm form, PortletConfig config, RenderRequest req, RenderResponse res) throws Exception { try { ActionUtil.getOrganization(req); } catch (Exception e) { if (e instanceof NoSuchOrganizationException || e instanceof PrincipalException) { SessionErrors.add(req, e.getClass().getName()); return mapping.findForward("portlet.enterprise_admin.error"); } else { throw e; } } return mapping.findForward(getForward(req, "portlet.enterprise_admin.edit_organization")); }
public ActionForward render( ActionMapping mapping, ActionForm form, PortletConfig config, RenderRequest req, RenderResponse res) throws Exception { String cmd = req.getParameter(Constants.CMD); if (cmd != null) { try { String domain = ParamUtil.getString(req, "domain"); Whois whois = NetworkUtil.getWhois(domain); req.setAttribute(WebKeys.NETWORK_WHOIS, whois); } catch (Exception e) { SessionErrors.add(req, WhoisAction.class.getName()); } } return mapping.findForward("portlet.network.whois"); }