/** {@inheritDoc} */ public ActionForward execute( ActionMapping mapping, ActionForm formIn, HttpServletRequest request, HttpServletResponse response) { RequestContext requestContext = new RequestContext(request); StrutsDelegate strutsDelegate = getStrutsDelegate(); User user = requestContext.getCurrentUser(); Errata errata = requestContext.lookupErratum(); DataResult dr = ErrataManager.systemsAffected(user, errata.getId(), null); RhnSet set = RhnSetDecl.SYSTEMS_AFFECTED.get(user); RhnListSetHelper helper = new RhnListSetHelper(request); // if its not submitted // ==> this is the first visit to this page // clear the 'dirty set' if (!requestContext.isSubmitted()) { set.clear(); RhnSetManager.store(set); } if (request.getParameter(DISPATCH) != null) { helper.updateSet(set, LIST_NAME); if (!set.isEmpty()) { // Send to AffectedSystemsAction to handle submit return strutsDelegate.forwardParams( mapping.findForward("confirm"), request.getParameterMap()); } RhnHelper.handleEmptySelection(request); } if (ListTagHelper.getListAction(LIST_NAME, request) != null) { helper.execute(set, LIST_NAME, dr); } // if I have a previous set selections populate data using it if (!set.isEmpty()) { helper.syncSelections(set, dr); ListTagHelper.setSelectedAmount(LIST_NAME, set.size(), request); } TagHelper.bindElaboratorTo("systemAffectedList", dr.getElaborator(), request); ListTagHelper.bindSetDeclTo(LIST_NAME, RhnSetDecl.SYSTEMS_AFFECTED, request); request.setAttribute(RequestContext.PAGE_LIST, dr); request.setAttribute("set", set); request.setAttribute("errata", errata); request.setAttribute( ListTagHelper.PARENT_URL, request.getRequestURI() + "?" + RequestContext.ERRATA_ID + "=" + errata.getId()); return strutsDelegate.forwardParams( mapping.findForward(RhnHelper.DEFAULT_FORWARD), request.getParameterMap()); }
/** {@inheritDoc} */ public ActionForward execute( ActionMapping mapping, ActionForm formIn, HttpServletRequest request, HttpServletResponse response) { RequestContext context = new RequestContext(request); User user = context.getCurrentUser(); Long cid = Long.parseLong(request.getParameter(CID)); Channel channel = ChannelFactory.lookupByIdAndUser(cid, user); PublishErrataHelper.checkPermissions(user, cid); request.setAttribute(CID, cid); request.setAttribute("user", user); request.setAttribute("channel_name", channel.getName()); request.setAttribute(ListTagHelper.PARENT_URL, request.getRequestURI()); request.setAttribute("emptyKey", EMPTY_KEY); List<SelectableChannel> channelList = null; RhnSet set = getDecl(channel).get(user); // if its not submitted // ==> this is the first visit to this page // clear the 'dirty set' if (!context.isSubmitted()) { set.clear(); RhnSetManager.store(set); } Channel original = ChannelFactory.lookupOriginalChannel(channel); RhnListSetHelper helper = new RhnListSetHelper(request); if (request.getParameter(DISPATCH) != null) { // if its one of the Dispatch actions handle it.. helper.updateSet(set, LIST_NAME); if (!set.isEmpty()) { Map<String, Object> params = new HashMap<String, Object>(); params.put(CID, request.getParameter(CID)); params.put(ConfirmErrataAction.SELECTED_CHANNEL, original.getId()); return getStrutsDelegate().forwardParams(mapping.findForward("submit"), params); } else { RhnHelper.handleEmptySelection(request); } } // get the errata list DataResult<ErrataOverview> dataSet = ErrataFactory.relevantToOneChannelButNotAnother(original.getId(), channel.getId()); if (ListTagHelper.getListAction(LIST_NAME, request) != null) { helper.execute(set, LIST_NAME, dataSet); } if (!set.isEmpty()) { helper.syncSelections(set, dataSet); ListTagHelper.setSelectedAmount(LIST_NAME, set.size(), request); } request.setAttribute(RequestContext.PAGE_LIST, dataSet); ListTagHelper.bindSetDeclTo(LIST_NAME, getDecl(channel), request); TagHelper.bindElaboratorTo(LIST_NAME, dataSet.getElaborator(), request); return mapping.findForward(RhnHelper.DEFAULT_FORWARD); }