public ActionForward nextPage(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    DynaActionForm escolherContextoForm = (DynaActionForm) form;

    String nextPage = (String) request.getAttribute(PresentationConstants.NEXT_PAGE);
    if (nextPage == null) {
      nextPage = request.getParameter(PresentationConstants.NEXT_PAGE);
    }

    Integer semestre =
        ((InfoExecutionPeriod) request.getAttribute(PresentationConstants.EXECUTION_PERIOD))
            .getSemester();
    Integer anoCurricular = (Integer) escolherContextoForm.get("curricularYear");

    int index = Integer.parseInt((String) escolherContextoForm.get("index"));

    request.setAttribute("anoCurricular", anoCurricular);
    request.setAttribute("semestre", semestre);

    List infoExecutionDegreeList =
        ReadExecutionDegreesByExecutionYear.run(
            ((InfoExecutionPeriod) request.getAttribute(PresentationConstants.EXECUTION_PERIOD))
                .getInfoExecutionYear());
    List licenciaturas = new ArrayList();
    licenciaturas.add(new LabelValueBean("escolher", ""));
    Collections.sort(infoExecutionDegreeList, new ComparatorByNameForInfoExecutionDegree());
    // ////

    InfoExecutionDegree infoExecutionDegree =
        (InfoExecutionDegree) infoExecutionDegreeList.get(index);

    if (infoExecutionDegree != null) {
      CurricularYearAndSemesterAndInfoExecutionDegree cYSiED =
          new CurricularYearAndSemesterAndInfoExecutionDegree(
              anoCurricular, semestre, infoExecutionDegree);
      request.setAttribute(PresentationConstants.CONTEXT_KEY, cYSiED);

      request.setAttribute(PresentationConstants.CURRICULAR_YEAR_KEY, anoCurricular);
      request.setAttribute(PresentationConstants.CURRICULAR_YEAR_OID, anoCurricular.toString());
      request.setAttribute(PresentationConstants.INFO_EXECUTION_DEGREE_KEY, infoExecutionDegree);
      request.setAttribute(PresentationConstants.EXECUTION_DEGREE, infoExecutionDegree);
      request.setAttribute(
          PresentationConstants.EXECUTION_DEGREE_OID,
          infoExecutionDegree.getExternalId().toString());
    } else {
      return mapping.findForward("Licenciatura execucao inexistente");
    }

    if (nextPage != null) {
      return mapping.findForward(nextPage);
    }

    // TODO : throw a proper exception
    throw new Exception("SomeOne is messing around with the links");
  }
Пример #2
0
  public List<InfoExecutionCourse> run(
      InfoExecutionPeriod infoExecutionPeriod,
      InfoExecutionDegree infoExecutionDegree,
      InfoCurricularYear infoCurricularYear,
      String executionCourseName) {

    List<InfoExecutionCourse> result = null;

    final ExecutionSemester executionSemester =
        FenixFramework.getDomainObject(infoExecutionPeriod.getExternalId());

    ExecutionDegree executionDegree = null;
    if (infoExecutionDegree != null) {
      executionDegree = FenixFramework.getDomainObject(infoExecutionDegree.getExternalId());
    }

    CurricularYear curricularYear = null;
    if (infoCurricularYear != null) {
      curricularYear = FenixFramework.getDomainObject(infoCurricularYear.getExternalId());
    }

    List<ExecutionCourse> executionCourses = new ArrayList<ExecutionCourse>();
    if (executionSemester != null) {
      executionCourses =
          executionSemester
              .getExecutionCoursesByDegreeCurricularPlanAndSemesterAndCurricularYearAndName(
                  executionDegree.getDegreeCurricularPlan(), curricularYear, executionCourseName);
    }

    return fillInfoExecutionCourses(executionSemester.getAcademicInterval(), executionCourses);
  }
  private void setFromRequest(HttpServletRequest request) {
    InfoExecutionDegree infoExecutionDegree =
        (InfoExecutionDegree) request.getAttribute(PresentationConstants.EXECUTION_DEGREE);

    String shift = request.getParameter("shift");
    if (shift == null) {
      shift = (String) request.getAttribute("shift");
    }
    if (shift == null) {
      shift = "false";
    }

    request.setAttribute("shift", shift);

    String degreeId = getFromRequest("degreeID", request);
    if (degreeId == null) {
      degreeId = infoExecutionDegree.getInfoDegreeCurricularPlan().getInfoDegree().getExternalId();
    }
    request.setAttribute("degreeID", degreeId);

    String executionDegreeId = getFromRequest("executionDegreeID", request);
    if (executionDegreeId == null) {
      executionDegreeId = infoExecutionDegree.getExternalId();
    }
    request.setAttribute("executionDegreeID", executionDegreeId);
    String degreeCurricularPlanId = getFromRequest("degreeCurricularPlanID", request);
    if (degreeCurricularPlanId == null) {
      degreeCurricularPlanId = infoExecutionDegree.getInfoDegreeCurricularPlan().getExternalId();
    }
    request.setAttribute("degreeCurricularPlanID", degreeCurricularPlanId);
  }
Пример #4
0
 @Atomic
 public static List<InfoExecutionCourse> runSearchExecutionCourses(
     InfoExecutionPeriod infoExecutionPeriod,
     InfoExecutionDegree infoExecutionDegree,
     InfoCurricularYear infoCurricularYear,
     String executionCourseName)
     throws NotAuthorizedException {
   CoordinatorExecutionDegreeAuthorizationFilter.instance.execute(
       infoExecutionDegree.getExternalId());
   return serviceInstance.run(
       infoExecutionPeriod, infoExecutionDegree, infoCurricularYear, executionCourseName);
 }
  public ActionForward roomViewer(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    String roomName = request.getParameter("roomName");
    if (roomName == null) {
      roomName = (String) request.getAttribute("roomName");
    }
    // input

    InfoExecutionDegree infoExecutionDegree =
        (InfoExecutionDegree) request.getAttribute(PresentationConstants.EXECUTION_DEGREE);

    String degreeId = getFromRequest("degreeID", request);
    if (degreeId == null) {
      degreeId = infoExecutionDegree.getInfoDegreeCurricularPlan().getInfoDegree().getExternalId();
    }
    request.setAttribute("degreeID", degreeId);
    String executionDegreeId = getFromRequest("executionDegreeID", request);
    if (executionDegreeId == null) {
      executionDegreeId = infoExecutionDegree.getExternalId();
    }
    request.setAttribute("executionDegreeID", executionDegreeId);
    String degreeCurricularPlanId = getFromRequest("degreeCurricularPlanID", request);
    if (degreeCurricularPlanId == null) {
      degreeCurricularPlanId = infoExecutionDegree.getInfoDegreeCurricularPlan().getExternalId();
    }
    request.setAttribute("degreeCurricularPlanID", degreeCurricularPlanId);

    request.setAttribute(
        "infoDegreeCurricularPlan", infoExecutionDegree.getInfoDegreeCurricularPlan());

    //

    RoomKey roomKey = null;

    if (roomName != null) {

      roomKey = new RoomKey(roomName);

      Integer objectCode = null;
      String objectCodeString = request.getParameter("objectCode");
      if (objectCodeString == null) {
        objectCodeString = (String) request.getAttribute("objectCode");
      }
      objectCode = new Integer(objectCodeString);
      ISiteComponent bodyComponent = new InfoSiteRoomTimeTable();

      // ****************************************************************
      // The following code was refactored from a berserk call into a not
      // compiling invocation.
      throw new FenixActionException();
      // try {
      // SiteView siteView = (SiteView)
      // RoomSiteComponentService.run(bodyComponent, roomKey, objectCode);
      //
      // request.setAttribute("sigla", ((InfoSiteRoomTimeTable)
      // siteView.getComponent()).getInfoRoom().getNome());
      // request.setAttribute("siteView", siteView);
      // request.setAttribute("objectCode", objectCode);
      //
      // } catch (NonExistingServiceException e) {
      // throw new NonExistingActionException(e);
      // } catch (FenixServiceException e) {
      // throw new FenixActionException(e);
      // }
      //
      // return mapping.findForward("roomViewer");
    }
    throw new FenixActionException();
  }