/** {@inheritDoc} */ public ActionForward execute( ActionMapping mapping, ActionForm formIn, HttpServletRequest request, HttpServletResponse response) { RequestContext requestContext = new RequestContext(request); User user = requestContext.getCurrentUser(); Long sid = requestContext.getRequiredParam("sid"); RhnSet set = getSetDecl(sid).get(user); ListRhnSetHelper help = new ListRhnSetHelper(this, request, getSetDecl(sid)); help.setListName(LIST_NAME); String parentURL = request.getRequestURI() + "?sid=" + sid; help.setParentUrl(parentURL); help.execute(); if (help.isDispatched()) { if (requestContext.wasDispatched("errata.jsp.apply")) { return applyErrata(mapping, formIn, request, response); } } String showButton = "true"; // Show the "Apply Errata" button only when unapplied errata exist: if (!SystemManager.hasUnscheduledErrata(user, sid)) { showButton = "false"; } Map params = new HashMap(); Set keys = request.getParameterMap().keySet(); for (Iterator i = keys.iterator(); i.hasNext(); ) { String key = (String) i.next(); params.put(key, request.getParameter(key)); } Server server = SystemManager.lookupByIdAndUser(sid, user); SdcHelper.ssmCheck(request, server.getId(), user); request.setAttribute("showApplyErrata", showButton); request.setAttribute("set", set); request.setAttribute("system", server); request.setAttribute("combo", getComboList(request)); request.setAttribute(SELECTOR, request.getParameter(SELECTOR)); return getStrutsDelegate() .forwardParams(mapping.findForward(RhnHelper.DEFAULT_FORWARD), params); }
protected ActionForward doExecute( HttpServletRequest request, ActionMapping mapping, DynaActionForm form) { String viewMode = form.getString(VIEW_MODE); String searchString = form.getString(SEARCH_STR).trim(); ActionErrors errs = new ActionErrors(); if (viewMode.equals(SystemSearchHelper.ID) || viewMode.equals(SystemSearchHelper.CPU_MHZ_LT) || viewMode.equals(SystemSearchHelper.CPU_MHZ_GT) || viewMode.equals(SystemSearchHelper.RAM_LT) || viewMode.equals(SystemSearchHelper.RAM_GT) || viewMode.equals(SystemSearchHelper.NUM_CPUS_LT) || viewMode.equals(SystemSearchHelper.NUM_CPUS_GT) || viewMode.equals(SystemSearchHelper.CHECKIN) || viewMode.equals(SystemSearchHelper.REGISTERED)) { String regEx = "(\\d)*"; Pattern pattern = Pattern.compile(regEx); Matcher matcher = pattern.matcher(searchString); if (!matcher.matches()) { errs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("systemsearch.errors.numeric")); } } // TODO: Set up combined-form validator // errs.add(RhnValidationHelper.validateDynaActionForm(this, daForm)); addErrors(request, errs); ListRhnSetHelper helper = new ListRhnSetHelper(this, request, RhnSetDecl.SYSTEMS); helper.setWillClearSet(false); helper.setDataSetName(getDataSetName()); helper.setListName(getListName()); helper.execute(); List results = (List) request.getAttribute(getDataSetName()); log.debug( "SystemSearch results.size() = " + (results != null ? results.size() : "null results")); if ((results != null) && (results.size() == 1)) { SystemSearchResult s = (SystemSearchResult) results.get(0); return StrutsDelegate.getInstance() .forwardParam(mapping.findForward("single"), "sid", s.getId().toString()); } return mapping.findForward(RhnHelper.DEFAULT_FORWARD); }