public ActionForward createClassifications( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixFilterException, FenixServiceException, IOException { IUserView userView = UserView.getUser(); DynaActionForm dynaActionForm = (DynaActionForm) form; Integer degreeCurricularPlanID = (Integer) dynaActionForm.get("degreeCurricularPlanID"); Integer[] entryGradeLimits = (Integer[]) dynaActionForm.get("entryGradeLimits"); Integer[] approvationRatioLimits = (Integer[]) dynaActionForm.get("approvationRatioLimits"); Integer[] arithmeticMeanLimits = (Integer[]) dynaActionForm.get("arithmeticMeanLimits"); Object[] args = { entryGradeLimits, approvationRatioLimits, arithmeticMeanLimits, degreeCurricularPlanID }; ByteArrayOutputStream resultStream = (ByteArrayOutputStream) ServiceUtils.executeService("CreateClassificationsForStudents", args); String currentDate = new SimpleDateFormat("dd-MMM-yy.HH-mm").format(new Date()); response.setHeader( "Content-disposition", "attachment;filename=" + degreeCurricularPlanID + "_" + currentDate + ".zip"); response.setContentType("application/zip"); DataOutputStream dos = new DataOutputStream(response.getOutputStream()); dos.write(resultStream.toByteArray()); dos.close(); return null; }
public ActionForward prepare( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixFilterException, FenixServiceException { IUserView userView = UserView.getUser(); InfoExecutionYear executionYear = ReadCurrentExecutionYear.run(); Object[] argsDCPs = {executionYear.getIdInternal()}; List degreeCurricularPlans = (List) ServiceUtils.executeService("ReadActiveDegreeCurricularPlansByExecutionYear", argsDCPs); final ComparatorChain comparatorChain = new ComparatorChain(); comparatorChain.addComparator(new BeanComparator("infoDegree.tipoCurso")); comparatorChain.addComparator(new BeanComparator("infoDegree.nome")); Collections.sort(degreeCurricularPlans, comparatorChain); request.setAttribute("degreeCurricularPlans", degreeCurricularPlans); DynaActionForm dynaActionForm = (DynaActionForm) form; Integer[] defaultLimits = {0, 10, 35, 65, 90, 100}; dynaActionForm.set("entryGradeLimits", defaultLimits); dynaActionForm.set("approvationRatioLimits", defaultLimits); dynaActionForm.set("arithmeticMeanLimits", defaultLimits); return mapping.findForward("chooseDegreeCurricularPlan"); }
private SiteView readSiteView( HttpServletRequest request, ISiteComponent firstPageComponent, Integer infoExecutionCourseCode, Object obj1, Object obj2) throws FenixActionException, FenixFilterException { IUserView userView = getUserView(request); Integer objectCode = null; if (infoExecutionCourseCode == null) { objectCode = getObjectCode(request); infoExecutionCourseCode = objectCode; } ISiteComponent commonComponent = new InfoSiteCommon(); Object[] args = { infoExecutionCourseCode, commonComponent, firstPageComponent, objectCode, obj1, obj2 }; try { TeacherAdministrationSiteView siteView = (TeacherAdministrationSiteView) ServiceUtils.executeService("TeacherAdministrationSiteComponentService", args); request.setAttribute("siteView", siteView); request.setAttribute( "objectCode", ((InfoSiteCommon) siteView.getCommonComponent()).getExecutionCourse().getIdInternal()); if (siteView.getComponent() instanceof InfoSiteSection) { request.setAttribute( "infoSection", ((InfoSiteSection) siteView.getComponent()).getSection()); } return siteView; } catch (FenixServiceException e) { throw new FenixActionException(e); } }
public ActionForward print( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixActionException, FenixFilterException { IUserView userView = UserView.getUser(); Integer reimbursementGuideId = new Integer(this.getFromRequest("id", request)); InfoReimbursementGuide infoReimbursementGuide = null; List infoStudents = null; InfoStudent infoStudent = null; try { infoReimbursementGuide = ViewReimbursementGuide.run(reimbursementGuideId); Object args2[] = {infoReimbursementGuide.getInfoGuide().getInfoPerson()}; infoStudents = (List) ServiceUtils.executeService("ReadStudentsByPerson", args2); Iterator it = infoStudents.iterator(); while (it.hasNext()) { infoStudent = (InfoStudent) it.next(); if (infoStudent.getDegreeType().equals(DegreeType.MASTER_DEGREE)) { break; } } } catch (FenixServiceException e) { throw new FenixActionException(e.getMessage(), mapping.findForward("error")); } Locale locale = this.getLocale(request); Date date = null; InfoReimbursementGuideSituation infoReimbursementGuideSituation = null; List infoReimbursementGuideSituations = infoReimbursementGuide.getInfoReimbursementGuideSituations(); Iterator it = infoReimbursementGuideSituations.iterator(); while (it.hasNext()) { infoReimbursementGuideSituation = (InfoReimbursementGuideSituation) it.next(); if (infoReimbursementGuideSituation .getReimbursementGuideState() .equals(ReimbursementGuideState.ISSUED)) { date = infoReimbursementGuideSituation.getOfficialDate().getTime(); } } String formatedDate = DateFormat.getDateInstance(DateFormat.LONG, locale).format(date); request.setAttribute(PresentationConstants.DATE, formatedDate); request.setAttribute(PresentationConstants.REIMBURSEMENT_GUIDE, infoReimbursementGuide); if (infoStudent != null) { request.setAttribute(PresentationConstants.STUDENT, infoStudent); } return mapping.findForward("start"); }
public ActionForward edit( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaValidatorForm createExamForm = (DynaValidatorForm) form; Integer infoExamID = Integer.valueOf(((String) createExamForm.get("exam_oid"))); String infoExamIdInteger = (String) request.getAttribute(PresentationConstants.EXAM_OID); if (infoExamIdInteger == null) { infoExamIdInteger = request.getParameter(PresentationConstants.EXAM_OID); } request.setAttribute(PresentationConstants.EXAM_OID, infoExamIdInteger); // exam season Season season = new Season(Integer.valueOf(((String) createExamForm.get("season")))); List<String> executionCourseIDs = Arrays.asList((String[]) createExamForm.get("executionCourses")); // exam date Calendar examDate = Calendar.getInstance(); Integer day = new Integer((String) createExamForm.get("day")); Integer month = new Integer((String) createExamForm.get("month")); Integer year = new Integer((String) createExamForm.get("year")); examDate.set(Calendar.YEAR, year.intValue()); examDate.set(Calendar.MONTH, month.intValue() - 1); examDate.set(Calendar.DAY_OF_MONTH, day.intValue()); if (examDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { addErrorMessage(request, "error.sunday", "error.sunday"); return prepare(mapping, form, request, response); } // exam start time Calendar examStartTime = Calendar.getInstance(); Integer startHour = new Integer((String) createExamForm.get("beginningHour")); Integer startMinute = new Integer((String) createExamForm.get("beginningMinute")); examStartTime.set(Calendar.HOUR_OF_DAY, startHour.intValue()); examStartTime.set(Calendar.MINUTE, startMinute.intValue()); examStartTime.set(Calendar.SECOND, 0); // exam end time Calendar examEndTime = Calendar.getInstance(); Integer endHour = new Integer((String) createExamForm.get("endHour")); Integer endMinute = new Integer((String) createExamForm.get("endMinute")); examEndTime.set(Calendar.HOUR_OF_DAY, endHour.intValue()); examEndTime.set(Calendar.MINUTE, endMinute.intValue()); examEndTime.set(Calendar.SECOND, 0); if (examStartTime.after(examEndTime)) { addErrorMessage(request, "error.timeSwitched", "error.timeSwitched"); return prepare(mapping, form, request, response); } List<String> scopeIDs = Arrays.asList((String[]) createExamForm.get("scopes")); List<String> contextIDs = new ArrayList<String>(); List<String> roomIDs = Arrays.asList((String[]) createExamForm.get("rooms")); Object argsEditExam[] = { null, examDate.getTime(), examStartTime.getTime(), examEndTime.getTime(), executionCourseIDs, scopeIDs, contextIDs, roomIDs, infoExamID, season, null, null }; try { ServiceUtils.executeService("EditWrittenEvaluation", argsEditExam); } catch (FenixServiceException ex) { addErrorMessage(request, "errors", ex.getMessage()); return prepare(mapping, form, request, response); } String date = (String) request.getAttribute(PresentationConstants.DATE); if (date == null) { date = request.getParameter(PresentationConstants.DATE); } if (date == null) { return mapping.findForward("Sucess"); } return mapping.findForward("sucessSearchByDate"); }
public ActionForward create( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaValidatorForm createExamForm = (DynaValidatorForm) form; // exam season Season season = new Season(new Integer((String) createExamForm.get("season"))); // exam execution course List<String> executionCourseIDs = Arrays.asList((String[]) createExamForm.get("executionCourses")); // exam date Calendar examDate = Calendar.getInstance(); Integer day = new Integer((String) createExamForm.get("day")); Integer month = new Integer((String) createExamForm.get("month")); Integer year = new Integer((String) createExamForm.get("year")); examDate.set(Calendar.YEAR, year.intValue()); examDate.set(Calendar.MONTH, month.intValue() - 1); examDate.set(Calendar.DAY_OF_MONTH, day.intValue()); if (examDate.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { addErrorMessage(request, "error.sunday", "error.sunday"); return prepare(mapping, form, request, response); } // exam start time Calendar examStartTime = Calendar.getInstance(); Integer startHour = new Integer((String) createExamForm.get("beginningHour")); Integer startMinute = new Integer((String) createExamForm.get("beginningMinute")); examStartTime.set(Calendar.HOUR_OF_DAY, startHour.intValue()); examStartTime.set(Calendar.MINUTE, startMinute.intValue()); examStartTime.set(Calendar.SECOND, 0); // exam end time Calendar examEndTime = Calendar.getInstance(); Integer endHour = new Integer((String) createExamForm.get("endHour")); Integer endMinute = new Integer((String) createExamForm.get("endMinute")); examEndTime.set(Calendar.HOUR_OF_DAY, endHour.intValue()); examEndTime.set(Calendar.MINUTE, endMinute.intValue()); examEndTime.set(Calendar.SECOND, 0); if (examStartTime.after(examEndTime)) { addErrorMessage(request, "error.timeSwitched", "error.timeSwitched"); return prepare(mapping, form, request, response); } // associated scopes List<String> curricularCourseScopeIDs = Arrays.asList((String[]) createExamForm.get("scopes")); List<String> curricularCourseContextIDs = new ArrayList<String>(); // associated rooms List<String> roomIDs = Arrays.asList((String[]) createExamForm.get("rooms")); // Create an exam with season, examDateAndTime and executionCourse Object argsCreateExam[] = { null, examDate.getTime(), examStartTime.getTime(), examEndTime.getTime(), executionCourseIDs, curricularCourseScopeIDs, curricularCourseContextIDs, roomIDs, season, null }; try { ServiceUtils.executeService("CreateWrittenEvaluation", argsCreateExam); } catch (FenixServiceException ex) { addErrorMessage(request, "errors", ex.getMessage()); return prepare(mapping, form, request, response); } return mapping.findForward("Sucess"); }