public ActionForward insert(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws FenixActionException {

    IUserView userView = UserView.getUser();

    DynaActionForm dynaForm = (DynaValidatorForm) form;
    String code = (String) dynaForm.get("code");
    String name = (String) dynaForm.get("name");
    String nameEn = (String) dynaForm.get("nameEn");
    String degreeTypeInt = (String) dynaForm.get("degreeType");
    String gradeTypeString = (String) dynaForm.get("gradeType");

    DegreeType degreeType = DegreeType.valueOf(degreeTypeInt);
    GradeScale gradeScale = null;
    if (gradeTypeString != null && gradeTypeString.length() > 0) {
      gradeScale = GradeScale.valueOf(gradeTypeString);
    }

    try {
      InsertDegree.run(code, name, nameEn, degreeType, gradeScale);

    } catch (ExistingServiceException ex) {
      throw new ExistingActionException(
          "message.already.existing.degree", mapping.findForward("readDegrees"));
    } catch (FenixServiceException e) {
      throw new FenixActionException(e.getMessage());
    }

    return mapping.findForward("readDegrees");
  }
 public String addContext() {
   try {
     checkCourseGroup();
     checkCurricularCourse();
     checkCurricularSemesterAndYear();
     AddContextToCurricularCourse.run(
         getCurricularCourse(),
         getCourseGroup(),
         getBeginExecutionPeriodID(),
         getFinalEndExecutionPeriodID(),
         getCurricularYearID(),
         getCurricularSemesterID());
     addInfoMessage(BundleUtil.getString(Bundle.BOLONHA, "addedNewContextToCurricularCourse"));
   } catch (FenixActionException e) {
     this.addErrorMessage(BundleUtil.getString(Bundle.BOLONHA, e.getMessage()));
     return "";
   } catch (FenixServiceException e) {
     this.addErrorMessage(BundleUtil.getString(Bundle.BOLONHA, e.getMessage()));
     return "";
   } catch (DomainException e) {
     addErrorMessage(BundleUtil.getString(Bundle.BOLONHA, e.getMessage(), e.getArgs()));
     return "";
   } catch (Exception e) {
     this.addErrorMessage(BundleUtil.getString(Bundle.BOLONHA, "general.error"));
     return "buildCurricularPlan";
   }
   setContextID(null); // resetContextID
   return "buildCurricularPlan";
 }
 public String editCurricularCourse() {
   try {
     runEditCurricularCourse();
     addInfoMessage(BundleUtil.getString(Bundle.BOLONHA, "curricularCourseEdited"));
   } catch (FenixServiceException e) {
     addErrorMessage(BundleUtil.getString(Bundle.BOLONHA, e.getMessage()));
   } catch (FenixActionException e) {
     addErrorMessage(BundleUtil.getString(Bundle.BOLONHA, e.getMessage()));
   }
   setContextID(null); // resetContextID
   return "";
 }
 public void deleteContext(ActionEvent event) {
   try {
     DeleteContextFromDegreeModule.run(getCurricularCourseID(), getContextIDToDelete());
     addInfoMessage(BundleUtil.getString(Bundle.BOLONHA, "successAction"));
   } catch (IllegalDataAccessException e) {
     this.addErrorMessage(BundleUtil.getString(Bundle.BOLONHA, "error.notAuthorized"));
   } catch (FenixServiceException e) {
     addErrorMessage(e.getMessage());
   } catch (DomainException e) {
     addErrorMessage(BundleUtil.getString(Bundle.DOMAIN_EXCEPTION, e.getKey(), e.getArgs()));
   }
   setContextID(null); // resetContextID
 }
 protected List<ExecutionCourse> getExecutionCourses() {
   if (this.executionCourses != null) {
     return this.executionCourses;
   }
   try {
     this.executionCourses =
         ReadExecutionCoursesByDegreeCurricularPlanAndExecutionPeriodAndCurricularYear
             .runReadExecutionCoursesByDegreeCurricularPlanAndExecutionPeriodAndCurricularYear(
                 getDegreeCurricularPlanID(), getExecutionPeriodID(), getCurricularYearID());
     return this.executionCourses;
   } catch (NotAuthorizedException e) {
   } catch (FenixServiceException e) {
     setErrorMessage(e.getMessage());
   }
   return new ArrayList();
 }
  public String createCurricularCourse() {
    try {
      checkCourseGroup();
      checkCurricularSemesterAndYear();
      runCreateCurricularCourse();

    } catch (FenixActionException e) {
      this.addErrorMessage(BundleUtil.getString(Bundle.BOLONHA, e.getMessage()));
      return "";
    } catch (FenixServiceException e) {
      this.addErrorMessage(BundleUtil.getString(Bundle.BOLONHA, e.getMessage()));
      return "";
    } catch (DomainException e) {
      addErrorMessage(BundleUtil.getString(Bundle.DOMAIN_EXCEPTION, e.getMessage()));
      return "";
    } catch (Exception e) {
      this.addErrorMessage(BundleUtil.getString(Bundle.BOLONHA, "general.error"));
      return "buildCurricularPlan";
    }
    addInfoMessage(BundleUtil.getString(Bundle.BOLONHA, "curricularCourseCreated"));
    return "buildCurricularPlan";
  }
  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");
  }
示例#8
0
  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");
  }
示例#9
0
  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");
  }
  public ActionForward edit(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws FenixActionException {

    User userView = Authenticate.getUser();
    DynaActionForm dynaForm = (DynaValidatorForm) form;

    String oldDegreeCPId = request.getParameter("degreeCurricularPlanId");
    final Degree degree = FenixFramework.getDomainObject(request.getParameter("degreeId"));

    InfoDegreeCurricularPlanEditor newInfoDegreeCP = new InfoDegreeCurricularPlanEditor();
    newInfoDegreeCP.setExternalId(oldDegreeCPId);
    InfoDegree infoDegree = new InfoDegree(degree);

    String name = (String) dynaForm.get("name");
    String stateString = (String) dynaForm.get("state");

    String initialDateString = (String) dynaForm.get("initialDate");
    String endDateString = (String) dynaForm.get("endDate");

    Integer degreeDuration = new Integer((String) dynaForm.get("degreeDuration"));
    Integer minimalYearForOptionalCourses =
        new Integer((String) dynaForm.get("minimalYearForOptionalCourses"));

    String neededCreditsString = (String) dynaForm.get("neededCredits");

    String markTypeString = (String) dynaForm.get("markType");
    String numerusClaususString = (String) dynaForm.get("numerusClausus");
    String anotationtring = (String) dynaForm.get("anotation");

    DegreeCurricularPlanState state = DegreeCurricularPlanState.valueOf(stateString);

    Calendar initialDate = Calendar.getInstance();
    if (initialDateString.compareTo("") != 0) {
      String[] initialDateTokens = initialDateString.split("/");
      initialDate.set(Calendar.DAY_OF_MONTH, (new Integer(initialDateTokens[0])).intValue());
      initialDate.set(Calendar.MONTH, (new Integer(initialDateTokens[1])).intValue() - 1);
      initialDate.set(Calendar.YEAR, (new Integer(initialDateTokens[2])).intValue());
      newInfoDegreeCP.setInitialDate(initialDate.getTime());
    }

    Calendar endDate = Calendar.getInstance();
    if (endDateString.compareTo("") != 0) {
      String[] endDateTokens = endDateString.split("/");
      endDate.set(Calendar.DAY_OF_MONTH, (new Integer(endDateTokens[0])).intValue());
      endDate.set(Calendar.MONTH, (new Integer(endDateTokens[1])).intValue() - 1);
      endDate.set(Calendar.YEAR, (new Integer(endDateTokens[2])).intValue());
      newInfoDegreeCP.setEndDate(endDate.getTime());
    }

    if (endDate.before(initialDate)) {
      throw new InvalidArgumentsActionException("message.manager.date.restriction");
    }

    if (neededCreditsString.compareTo("") != 0) {
      Double neededCredits = new Double(neededCreditsString);
      newInfoDegreeCP.setNeededCredits(neededCredits);
    }

    if (markTypeString.compareTo("") != 0) {

      Integer markTypeInt = new Integer(markTypeString);
      MarkType markType = new MarkType(markTypeInt);
      newInfoDegreeCP.setMarkType(markType);
    }

    String gradeTypeString = (String) dynaForm.get("gradeType");
    GradeScale gradeScale = null;
    if (gradeTypeString != null && gradeTypeString.length() > 0) {
      gradeScale = GradeScale.valueOf(gradeTypeString);
    }

    if (numerusClaususString.compareTo("") != 0) {
      Integer numerusClausus = new Integer(numerusClaususString);
      newInfoDegreeCP.setNumerusClausus(numerusClausus);
    }

    newInfoDegreeCP.setName(name);
    newInfoDegreeCP.setState(state);
    newInfoDegreeCP.setDegreeDuration(degreeDuration);
    newInfoDegreeCP.setMinimalYearForOptionalCourses(minimalYearForOptionalCourses);
    newInfoDegreeCP.setExternalId(oldDegreeCPId);
    newInfoDegreeCP.setAnotation(anotationtring);
    newInfoDegreeCP.setGradeScale(gradeScale);
    newInfoDegreeCP.setInfoDegree(infoDegree);

    try {
      EditDegreeCurricularPlan.run(newInfoDegreeCP);

    } catch (ExistingServiceException e) {
      throw new ExistingActionException("message.manager.existing.degree.curricular.plan", e);
    } catch (NonExistingServiceException e) {
      throw new NonExistingActionException(e.getMessage(), mapping.findForward("readDegree"));
    } catch (FenixServiceException fenixServiceException) {
      ActionMessages actionMessages = new ActionMessages();
      actionMessages.add(
          fenixServiceException.getMessage(),
          new ActionMessage(fenixServiceException.getMessage()));
      saveMessages(request, actionMessages);
      return mapping.findForward("editDegreeCP");
    }
    return mapping.findForward("readDegreeCP");
  }
  public ActionForward prepareEdit(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws FenixActionException {

    User userView = Authenticate.getUser();
    DynaActionForm dynaForm = (DynaActionForm) form;

    InfoDegreeCurricularPlan oldInfoDegreeCP = null;

    try {
      oldInfoDegreeCP =
          ReadDegreeCurricularPlan.runReadDegreeCurricularPlan(
              request.getParameter("degreeCurricularPlanId"));

    } catch (NonExistingServiceException e) {
      throw new NonExistingActionException(
          "message.nonExistingDegreeCurricularPlan", mapping.findForward("readDegree"));
    } catch (FenixServiceException fenixServiceException) {
      throw new FenixActionException(fenixServiceException.getMessage());
    }

    dynaForm.set("name", oldInfoDegreeCP.getName());
    dynaForm.set("state", oldInfoDegreeCP.getState().toString());

    DegreeCurricularPlan oldDegreeCP = oldInfoDegreeCP.getDegreeCurricularPlan();

    if (oldDegreeCP.getInitialDateYearMonthDay() != null) {
      YearMonthDay ymd = oldDegreeCP.getInitialDateYearMonthDay();
      String initialDateString =
          ymd.getDayOfMonth() + "/" + ymd.getMonthOfYear() + "/" + ymd.getYear();

      dynaForm.set("initialDate", initialDateString);
    }

    if (oldDegreeCP.getEndDateYearMonthDay() != null) {
      YearMonthDay ymd = oldDegreeCP.getEndDateYearMonthDay();
      String endDateString = ymd.getDayOfMonth() + "/" + ymd.getMonthOfYear() + "/" + ymd.getYear();

      dynaForm.set("endDate", endDateString);
    }

    if (oldInfoDegreeCP.getDegreeDuration() != null) {
      dynaForm.set("degreeDuration", oldInfoDegreeCP.getDegreeDuration().toString());
    }
    if (oldInfoDegreeCP.getMinimalYearForOptionalCourses() != null) {
      dynaForm.set(
          "minimalYearForOptionalCourses",
          oldInfoDegreeCP.getMinimalYearForOptionalCourses().toString());
    }

    if (oldInfoDegreeCP.getNeededCredits() != null) {
      dynaForm.set("neededCredits", oldInfoDegreeCP.getNeededCredits().toString());
    }

    dynaForm.set("markType", oldInfoDegreeCP.getMarkType().getType().toString());

    if (oldInfoDegreeCP.getGradeScale() != null) {
      dynaForm.set("gradeType", oldInfoDegreeCP.getGradeScale().toString());
    }

    if (oldInfoDegreeCP.getNumerusClausus() != null) {
      dynaForm.set("numerusClausus", oldInfoDegreeCP.getNumerusClausus().toString());
    }
    dynaForm.set("anotation", oldInfoDegreeCP.getAnotation());

    return mapping.findForward("editDegreeCP");
  }