package net.sourceforge.fenixedu.presentationTier.Action.publico; import java.util.Collections; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sourceforge.fenixedu.applicationTier.Filtro.exception.FenixFilterException; import net.sourceforge.fenixedu.applicationTier.Servico.publico.SelectExecutionCourse; import net.sourceforge.fenixedu.dataTransferObject.InfoExecutionDegree; import net.sourceforge.fenixedu.dataTransferObject.InfoExecutionPeriod; import net.sourceforge.fenixedu.presentationTier.Action.base.FenixContextAction; import net.sourceforge.fenixedu.presentationTier.Action.exceptions.FenixActionException; import net.sourceforge.fenixedu.presentationTier.Action.resourceAllocationManager.utils.RequestUtils; import net.sourceforge.fenixedu.presentationTier.Action.resourceAllocationManager.utils.PresentationConstants; import org.apache.commons.beanutils.BeanComparator; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; /** * @author Joćo Mota */ public class PrepareSelectExecutionCourseAction extends FenixContextAction { @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixActionException, FenixFilterException { try { super.execute(mapping, form, request, response); } catch (Exception e1) { e1.printStackTrace(); } InfoExecutionPeriod infoExecutionPeriod = (InfoExecutionPeriod) request .getAttribute(PresentationConstants.EXECUTION_PERIOD); InfoExecutionDegree infoExecutionDegree = RequestUtils.getExecutionDegreeFromRequest(request, infoExecutionPeriod .getInfoExecutionYear()); Integer curricularYear = (Integer) request.getAttribute("curYear"); List infoExecutionCourses = (List) SelectExecutionCourse.run(infoExecutionDegree, infoExecutionPeriod, curricularYear); Collections.sort(infoExecutionCourses, new BeanComparator("nome")); request.setAttribute("exeCourseList", infoExecutionCourses); return mapping.findForward("sucess"); } }