예제 #1
0
  public ActionForward prepare(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ContextUtils.setCurricularYearsContext(request);

    Integer executionCourseOID =
        ((InfoExecutionCourse) request.getAttribute(PresentationConstants.EXECUTION_COURSE))
            .getIdInternal();

    InfoExecutionCourse executionCourse;
    try {
      executionCourse = ReadExecutionCourseWithAssociatedCurricularCourses.run(executionCourseOID);
    } catch (Exception ex) {
      throw new Exception(ex);
    }
    List executionCourseList = new ArrayList();

    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);

    DynaValidatorForm createExamForm = (DynaValidatorForm) form;
    String[] executionCourseIDList = {executionCourse.getIdInternal().toString()};
    createExamForm.set("executionCourses", executionCourseIDList);

    List scopeIDList = new ArrayList();
    Iterator iter1 = executionCourse.getAssociatedInfoCurricularCourses().iterator();
    while (iter1.hasNext()) {
      Iterator iter2 = ((InfoCurricularCourse) iter1.next()).getInfoScopes().iterator();
      while (iter2.hasNext()) {
        scopeIDList.add(((InfoCurricularCourseScope) iter2.next()).getIdInternal().toString());
      }
    }
    String[] scopeIDArray = CollectionUtils.toArrayOfString(scopeIDList);
    createExamForm.set("scopes", scopeIDArray);

    return mapping.findForward("showCreateForm");
  }
예제 #2
0
  public ActionForward prepareAfterAssociateExecutionCourse(
      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);

    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");
    List scopeIDList = CollectionUtils.toList(scopeIDArray);
    InfoExecutionCourse executionCourse =
        (InfoExecutionCourse) executionCourseList.get(executionCourseList.size() - 1);
    Iterator iter2 = executionCourse.getAssociatedInfoCurricularCourses().iterator();
    while (iter2.hasNext()) {
      Iterator iter3 = ((InfoCurricularCourse) iter2.next()).getInfoScopes().iterator();
      while (iter3.hasNext()) {
        scopeIDList.add(((InfoCurricularCourseScope) iter3.next()).getIdInternal().toString());
      }
    }
    scopeIDArray = CollectionUtils.toArrayOfString(scopeIDList);
    createExamForm.set("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");
  }