Ejemplo n.º 1
0
  public ActionForward associateExecutionCourse(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    String infoExamId = (String) request.getAttribute(PresentationConstants.EXAM_OID);
    if (infoExamId == null) {
      infoExamId = request.getParameter(PresentationConstants.EXAM_OID);
    }
    request.setAttribute(PresentationConstants.EXAM_OID, infoExamId);

    ContextUtils.setCurricularYearContext(request);
    ContextUtils.setExecutionDegreeContext(request);
    ContextUtils.setExecutionPeriodContext(request);
    ContextUtils.setCurricularYearsContext(request);

    return mapping.findForward("associateExecutionCourse");
  }
Ejemplo n.º 2
0
  public ActionForward prepareAfterAssociateRoom(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    String infoExamId = (String) request.getAttribute(PresentationConstants.EXAM_OID);
    if (infoExamId == null) {
      infoExamId = request.getParameter(PresentationConstants.EXAM_OID);
    }
    request.setAttribute(PresentationConstants.EXAM_OID, infoExamId);

    ContextUtils.setCurricularYearContext(request);
    ContextUtils.setExecutionDegreeContext(request);
    ContextUtils.setExecutionPeriodContext(request);
    ContextUtils.setCurricularYearsContext(request);

    String executionDegreeOID =
        (String) request.getAttribute(PresentationConstants.EXECUTION_DEGREE_OID);
    request.setAttribute("executionDegreeOID", executionDegreeOID);

    DynaValidatorForm createExamForm = (DynaValidatorForm) form;
    String[] executionCourseArray = (String[]) createExamForm.get("executionCourses");

    List executionCourseList = new ArrayList();
    for (String element : executionCourseArray) {

      InfoExecutionCourse executionCourse;
      try {
        executionCourse =
            ReadExecutionCourseWithAssociatedCurricularCourses.run(new Integer(element));
      } catch (Exception ex) {
        throw new Exception(ex);
      }

      executionCourseList.add(executionCourse);
    }
    request.setAttribute(PresentationConstants.EXECUTION_COURSES_LIST, executionCourseList);

    String nextPage = request.getParameter("nextPage");
    request.setAttribute(PresentationConstants.NEXT_PAGE, nextPage);

    List examSeasons = Util.getExamSeasons();
    request.setAttribute(PresentationConstants.LABLELIST_SEASONS, examSeasons);

    String[] scopeIDArray = (String[]) createExamForm.get("scopes");
    request.setAttribute("scopes", scopeIDArray);

    String[] rooms = (String[]) createExamForm.get("rooms");
    List roomNames = new ArrayList();

    if (rooms != null && rooms.length > 0) {

      for (String room : rooms) {

        InfoRoom infoRoom = ReadRoomByOID.run(new Integer(room));

        roomNames.add(infoRoom);
      }
    }

    request.setAttribute("rooms", roomNames);

    return mapping.findForward("showCreateForm");
  }
Ejemplo n.º 3
0
  public ActionForward associateRoom(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    String infoExamId = (String) request.getAttribute(PresentationConstants.EXAM_OID);
    if (infoExamId == null) {
      infoExamId = request.getParameter(PresentationConstants.EXAM_OID);
    }
    request.setAttribute(PresentationConstants.EXAM_OID, infoExamId);

    ContextUtils.setCurricularYearContext(request);
    ContextUtils.setExecutionCourseContext(request);
    ContextUtils.setExecutionDegreeContext(request);
    ContextUtils.setExecutionPeriodContext(request);
    ContextUtils.setCurricularYearsContext(request);

    DynaValidatorForm examForm = (DynaValidatorForm) form;

    // exam start time
    Calendar examStartTime = Calendar.getInstance();
    Integer startHour = new Integer((String) examForm.get("beginningHour"));
    Integer startMinute = new Integer((String) examForm.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) examForm.get("endHour"));
    Integer endMinute = new Integer((String) examForm.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);
    }

    // exam date
    Calendar examDate = Calendar.getInstance();
    Integer day = new Integer((String) examForm.get("day"));
    Integer month = new Integer((String) examForm.get("month"));
    Integer year = new Integer((String) examForm.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);
    }
    // //////////////////
    String[] scopeIDArray = (String[]) examForm.get("scopes");
    request.setAttribute("scopes", scopeIDArray);
    // ///////////////

    return mapping.findForward("associateRoom");
  }