public ActionForward exportResultsToFile(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    String degreeTypeString = (String) getFromRequest(request, "degreeType");
    DegreeType degreeType = DegreeType.valueOf(degreeTypeString);
    ExecutionYear executionYear = getDomainObject(request, "executionYearOID");
    StyledExcelSpreadsheet spreadsheet =
        YearDelegateElection.exportElectionsResultsToFile(
            Degree.readAllByDegreeType(degreeType), executionYear);

    final ServletOutputStream writer = response.getOutputStream();
    spreadsheet.getWorkbook().write(writer);
    response.setContentType("application/txt");
    final String filename =
        String.format(
            "electionsResults_%s_%s.xls",
            degreeType.getLocalizedName(), executionYear.getYear().replace("/", "-"));
    response.addHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
    writer.flush();
    response.flushBuffer();
    return null;
  }
예제 #2
0
  public String getLastEnrolledExecutionYear() {
    if (getStudent() == null) {
      return "";
    }

    List<ExecutionYear> enrolmentsExecutionYears =
        new ArrayList<ExecutionYear>(getEnrolmentsExecutionYears(getStudent()));
    Collections.sort(enrolmentsExecutionYears, ExecutionYear.REVERSE_COMPARATOR_BY_YEAR);

    ExecutionYear lastEnrolledExecutionYear = null;

    if (enrolmentsExecutionYears.isEmpty()) {
      return "";
    }

    if (enrolmentsExecutionYears.size() == 1
        && ExecutionYear.readCurrentExecutionYear()
            .equals(enrolmentsExecutionYears.iterator().next())) {
      return "";
    } else if (ExecutionYear.readCurrentExecutionYear()
        .equals(enrolmentsExecutionYears.iterator().next())) {
      lastEnrolledExecutionYear = enrolmentsExecutionYears.get(1);
    } else {
      lastEnrolledExecutionYear = enrolmentsExecutionYears.iterator().next();
    }

    return ((Integer) lastEnrolledExecutionYear.getBeginCivilYear()).toString();
  }
예제 #3
0
  public BigDecimal getNumberOfApprovedEctsOneYearAgo() {
    ExecutionYear oneYearAgo = getForExecutionYear().getPreviousExecutionYear();
    BigDecimal result = BigDecimal.ZERO;

    if (student == null) {
      return BigDecimal.ZERO;
    }

    for (final Registration registration : student.getRegistrationsSet()) {

      if (registration.isBolonha() && registration.hasAnyEnrolmentsIn(oneYearAgo)) {
        result =
            result
                .add(
                    calculateApprovedECTS(
                        registration
                            .getLastStudentCurricularPlan()
                            .getAprovedEnrolmentsInExecutionPeriod(
                                oneYearAgo.getFirstExecutionPeriod())))
                .add(
                    calculateApprovedECTS(
                        registration
                            .getLastStudentCurricularPlan()
                            .getAprovedEnrolmentsInExecutionPeriod(
                                oneYearAgo.getLastExecutionPeriod())));
      }
    }

    return result;
  }
  protected List<SelectItem> readExecutionYearItems() {
    final List<SelectItem> result = new ArrayList<SelectItem>();

    final Collection<ExecutionDegree> executionDegrees =
        getDegreeCurricularPlan().getExecutionDegreesSet();

    if (executionDegrees.isEmpty()) {
      final ExecutionYear executionYear =
          getDegreeCurricularPlan().getRoot().getMinimumExecutionPeriod().getExecutionYear();
      result.add(new SelectItem(executionYear.getExternalId(), executionYear.getYear()));
      return result;
    }

    for (ExecutionDegree executionDegree : executionDegrees) {
      result.add(
          new SelectItem(
              executionDegree.getExecutionYear().getExternalId(),
              executionDegree.getExecutionYear().getYear()));
    }

    if (getExecutionYearID() == null) {
      setExecutionYearID(
          getDegreeCurricularPlan()
              .getMostRecentExecutionDegree()
              .getExecutionYear()
              .getExternalId());
    }

    return result;
  }
 private static ExecutionDegree findExecutionDegreeByID(
     final ExecutionSemester executionSemester, final String executionDegreeId) {
   final ExecutionYear executionYear = executionSemester.getExecutionYear();
   for (final ExecutionDegree executionDegree : executionYear.getExecutionDegreesSet()) {
     if (executionDegree.getExternalId().equals(executionDegreeId)) {
       return executionDegree;
     }
   }
   return null;
 }
  private ExecutionYear readExecutionYear(String year) {

    final ExecutionYear executionYear;
    if (year == null || year.equals("")) {
      executionYear = ExecutionYear.readCurrentExecutionYear();
    } else {
      executionYear = ExecutionYear.readExecutionYearByName(year);
    }
    return executionYear;
  }
예제 #7
0
 public static ExecutionYear getExecutionYearFourYearsBack(final ExecutionYear executionYear) {
   ExecutionYear executionYearFourYearsBack = executionYear;
   if (executionYear != null) {
     for (int i = 5; i > 1; i--) {
       final ExecutionYear previousExecutionYear =
           executionYearFourYearsBack.getPreviousExecutionYear();
       if (previousExecutionYear != null) {
         executionYearFourYearsBack = previousExecutionYear;
       }
     }
   }
   return executionYearFourYearsBack;
 }
예제 #8
0
 /*
  * Checks if given period belongs to given execution year
  */
 private void validatePeriodGivenExecutionYear(
     ExecutionYear executionYear, DelegateElectionPeriod period) {
   if (period.getStartDate().isBefore(executionYear.getBeginDateYearMonthDay())
       || period.getEndDate().isAfter(executionYear.getEndDateYearMonthDay())) {
     throw new DomainException(
         "error.elections.setPeriod.invalidPeriod",
         new String[] {
           getDegree().getSigla(),
           getCurricularYear().getYear().toString(),
           period.getPeriod(),
           executionYear.getYear()
         });
   }
 }
  protected void run(String year) {

    gratuitySituationsToDelete = new HashSet<GratuitySituation>();

    ExecutionYear executionYear = readExecutionYear(year);

    // read master degree and persistentSupportecialization execution
    // degrees
    Collection<ExecutionDegree> executionDegrees =
        executionYear.getExecutionDegreesByType(DegreeType.MASTER_DEGREE);

    for (ExecutionDegree executionDegree : executionDegrees) {

      GratuityValues gratuityValues = executionDegree.getGratuityValues();

      if (gratuityValues == null) {
        continue;
      }

      this.firstYear = executionDegree.isFirstYear();

      Collection<StudentCurricularPlan> studentCurricularPlans =
          executionDegree.getDegreeCurricularPlan().getStudentCurricularPlans();
      for (StudentCurricularPlan studentCurricularPlan : studentCurricularPlans) {

        GratuitySituation gratuitySituation =
            studentCurricularPlan.getGratuitySituationByGratuityValues(gratuityValues);

        if (year.equals("2002/2003") && gratuitySituation.getTransactionListSet().size() == 0) {
          gratuitySituation.setEmployee(null);
          gratuitySituation.setGratuityValues(null);
          gratuitySituation.setStudentCurricularPlan(null);
          this.gratuitySituationsToDelete.add(gratuitySituation);
          continue;
        }

        if (gratuitySituation == null) {
          createGratuitySituation(gratuityValues, studentCurricularPlan);
        } else {
          updateGratuitySituation(gratuitySituation);
        }
      }
    }

    for (GratuitySituation gratuitySituationToDelete : this.gratuitySituationsToDelete) {
      gratuitySituationToDelete.delete();
    }
  }
예제 #10
0
  private double getEnrolmentsEctsCredits(
      final Registration registration, final ExecutionYear executionYear) {
    double result = 0.0;
    double annualCredits = 0.0;

    for (final ExecutionSemester executionSemester : executionYear.getExecutionPeriodsSet()) {
      for (final Enrolment enrolment :
          registration.getLastStudentCurricularPlan().getEnrolmentsSet()) {
        if (enrolment.isValid(executionSemester)) {
          if (enrolment.isAnual()) {
            this.enrolledInAnualCoursesLastYear = true;

            if (executionSemester.getSemester() == 1) {
              annualCredits += enrolment.getEctsCredits();
            }
            continue;
          }

          result += enrolment.getEctsCredits();
        }
      }
    }

    return result + annualCredits;
  }
예제 #11
0
  private static Map<PhdProgramFocusArea, Set<PhdProgramPublicCandidacyHashCode>> getApplicants(
      final List<PhdProgramPublicCandidacyHashCode> unfocusAreaCandidates) {
    final Map<PhdProgramFocusArea, Set<PhdProgramPublicCandidacyHashCode>> candidates =
        new TreeMap<PhdProgramFocusArea, Set<PhdProgramPublicCandidacyHashCode>>(
            PhdProgramFocusArea.COMPARATOR_BY_NAME);

    for (final PublicCandidacyHashCode hashCode : Bennu.getInstance().getCandidacyHashCodesSet()) {
      if (hashCode.isFromPhdProgram() && hashCode.hasCandidacyProcess()) {

        final PhdProgramPublicCandidacyHashCode phdHashCode =
            (PhdProgramPublicCandidacyHashCode) hashCode;

        if (phdHashCode.getIndividualProgramProcess().getExecutionYear()
            != ExecutionYear.readCurrentExecutionYear()) {
          continue;
        }

        if (!PhdIndividualProgramCollaborationType.EPFL.equals(
            phdHashCode.getIndividualProgramProcess().getCollaborationType())) {
          continue;
        }

        if (!PhdIndividualProgramProcessState.CANDIDACY.equals(
            phdHashCode.getIndividualProgramProcess().getActiveState())) {
          continue;
        }

        //                if (phdHashCode.getPhdProgramCandidacyProcess().isValidatedByCandidate())
        // {
        addCandidate(unfocusAreaCandidates, candidates, phdHashCode);
        //                }
      }
    }
    return candidates;
  }
  public ActionForward showVotingResults(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    final String forwardTo = (String) getFromRequest(request, "forwardTo");

    final ExecutionYear currentExecutionYear = ExecutionYear.readCurrentExecutionYear();

    final YearDelegateElection yearDelegateElection =
        (YearDelegateElection)
            FenixFramework.getDomainObject(
                (String) getFromRequest(request, "selectedVotingPeriod"));

    final ExecutionYear executionYear = yearDelegateElection.getExecutionYear();

    List<DelegateElectionResultsByStudentDTO> electionResultsByStudentDTOList =
        yearDelegateElection.getLastVotingPeriod().getDelegateElectionResults();

    ElectionPeriodBean bean = new ElectionPeriodBean();
    bean.setCurricularYear(yearDelegateElection.getCurricularYear());
    bean.setDegree(yearDelegateElection.getDegree());
    bean.setDegreeType(yearDelegateElection.getDegree().getDegreeType());
    bean.setElection(yearDelegateElection);
    bean.setExecutionYear(executionYear);

    request.setAttribute("currentExecutionYear", currentExecutionYear);
    request.setAttribute("electionPeriodBean", bean);
    request.setAttribute("votingResultsByStudent", electionResultsByStudentDTOList);
    return mapping.findForward(forwardTo);
  }
  public ActionForward showCandidates(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    final ExecutionYear currentExecutionYear = ExecutionYear.readCurrentExecutionYear();

    final YearDelegateElection yearDelegateElection =
        (YearDelegateElection)
            FenixFramework.getDomainObject(request.getParameter("selectedCandidacyPeriod"));
    Collection<Student> candidates = yearDelegateElection.getCandidatesSet();

    final ExecutionYear executionYear = yearDelegateElection.getExecutionYear();

    ElectionPeriodBean bean = new ElectionPeriodBean();
    bean.setCurricularYear(yearDelegateElection.getCurricularYear());
    bean.setDegree(yearDelegateElection.getDegree());
    bean.setDegreeType(yearDelegateElection.getDegree().getDegreeType());
    bean.setElection(yearDelegateElection);
    bean.setExecutionYear(executionYear);

    if (request.getParameter("showPhotos") != null) {
      request.setAttribute("candidatesWithPhotos", candidates);
    } else {
      request.setAttribute("candidatesWithoutPhotos", candidates);
    }

    request.setAttribute("currentExecutionYear", currentExecutionYear);
    request.setAttribute("electionPeriodBean", bean);
    return mapping.findForward("showCandidates");
  }
 public void save() {
   TutorshipIntention intention =
       TutorshipIntention.readByDcpAndTeacherAndInterval(dcp, teacher, academicInterval);
   ExecutionYear executionYear =
       (ExecutionYear) ExecutionYear.getExecutionInterval(academicInterval);
   if (intention == null && intending) {
     new TutorshipIntention(dcp, teacher, academicInterval);
     ProgramTutoredParticipationLog.createLog(
         dcp.getDegree(),
         executionYear,
         Bundle.MESSAGING,
         "log.degree.programtutoredparticipation.addteacher",
         teacher.getPerson().getPresentationName(),
         dcp.getDegree().getPresentationName());
   } else if (intention != null && !intending) {
     ProgramTutoredParticipationLog.createLog(
         dcp.getDegree(),
         executionYear,
         Bundle.MESSAGING,
         "log.degree.programtutoredparticipation.removeteacher",
         teacher.getPerson().getPresentationName(),
         dcp.getDegree().getPresentationName());
     intention.delete();
   }
 }
예제 #15
0
 protected void init(ExecutionYear executionYear) {
   checkParameters(executionYear);
   if (executionYear.hasShiftDistribution()) {
     throw new DomainException(
         "error.candidacy.degree.ShiftDistribution.executionYear.already.has.a.shiftDistribution");
   }
   super.setExecutionYear(executionYear);
 }
  private static StudentCurricularPlan findStudentCurricularPlan(
      final CardGenerationBatch cardGenerationBatch, final Student student) {
    final ExecutionYear executionYear = cardGenerationBatch.getExecutionYear();
    final DateTime begin = executionYear.getBeginDateYearMonthDay().toDateTimeAtMidnight();
    final DateTime end = executionYear.getEndDateYearMonthDay().toDateTimeAtMidnight();
    ;

    final Set<StudentCurricularPlan> studentCurricularPlans =
        cardGenerationBatch.getStudentCurricularPlans(begin, end, student);
    if (studentCurricularPlans.size() == 1) {
      return studentCurricularPlans.iterator().next();
    } else if (studentCurricularPlans.size() > 1) {
      final StudentCurricularPlan max = findMaxStudentCurricularPlan(studentCurricularPlans);
      return max;
    }
    return null;
  }
 @Service
 public static Boolean run(
     Person person, ExecutionYear executionYear, final List executionCourseResponsabilities)
     throws MaxResponsibleForExceed, InvalidCategory, NotAuthorizedException {
   AbstractModifyProfessorshipWithPerson.run(person);
   person.updateResponsabilitiesFor(
       executionYear.getIdInternal(), executionCourseResponsabilities);
   return true;
 }
  public ExecutionYear getExecutionYear() {
    String executionYearId = getExecutionYearID();

    ExecutionYear oldestContextExecutionYear =
        getDegreeCurricularPlan().getOldestContextExecutionYear();

    if (executionYearId != null) {
      return FenixFramework.getDomainObject(executionYearId);
    }

    ExecutionYear currentExecutionYear = ExecutionYear.readCurrentExecutionYear();

    if (oldestContextExecutionYear != null
        && oldestContextExecutionYear.isAfter(currentExecutionYear)) {
      return oldestContextExecutionYear;
    }

    return currentExecutionYear;
  }
예제 #19
0
 private boolean isRepeatedJob(Person person, HttpServletRequest request, Class aClass) {
   final DegreeType degreeType = getDegreeType(request);
   request.setAttribute("degreeType", degreeType);
   final ExecutionYear executionYear = getExecutionYear(request);
   request.setAttribute(
       "executionYearID", (executionYear == null) ? null : executionYear.getIdInternal());
   final String fileType = getFileType(request);
   for (QueueJob queueJob : QueueJob.getAllJobsForClassOrSubClass(GepReportFile.class, 5)) {
     GepReportFile gepReportFile = (GepReportFile) queueJob;
     if ((gepReportFile.getPerson() == person)
         && (gepReportFile.getClass() == aClass)
         && (!gepReportFile.getDone())
         && (gepReportFile.getExecutionYear() == executionYear)
         && (gepReportFile.getDegreeType() == degreeType)
         && (fileType.equals(gepReportFile.getType()))) {
       return true;
     }
   }
   return false;
 }
 private CardGenerationBatch findOrCreate(
     final ExecutionYear executionYear, final String description) {
   for (final CardGenerationBatch cardGenerationBatch :
       executionYear.getCardGenerationBatchesSet()) {
     if (cardGenerationBatch.getDescription() != null
         && cardGenerationBatch.getDescription().equals(description)) {
       return cardGenerationBatch;
     }
   }
   return new CardGenerationBatch(description, executionYear, true);
 }
예제 #21
0
  private VirtualPath getVirtualPath(Site site, Container container) {

    List<Content> contents = site.getPathTo(container);

    final VirtualPath filePath = new VirtualPath();

    for (Content content : contents.subList(1, contents.size())) {
      filePath.addNode(
          0,
          new VirtualPathNode(
              content.getClass().getSimpleName().substring(0, 1) + content.getExternalId(),
              content.getName().getContent()));
    }

    String authorName = site.getAuthorName();
    filePath.addNode(
        0,
        new VirtualPathNode(
            "Site" + site.getExternalId(),
            authorName == null ? "Site" + site.getExternalId() : authorName));

    ExecutionSemester executionSemester = site.getExecutionPeriod();
    if (executionSemester == null) {
      filePath.addNode(0, new VirtualPathNode("Intemporal", "Intemporal"));
    } else {
      filePath.addNode(
          0,
          new VirtualPathNode(
              "EP" + executionSemester.getExternalId(), executionSemester.getName()));

      ExecutionYear executionYear = executionSemester.getExecutionYear();
      filePath.addNode(
          0, new VirtualPathNode("EY" + executionYear.getExternalId(), executionYear.getYear()));
    }

    filePath.addNode(0, new VirtualPathNode("Courses", "Courses"));
    return filePath;
  }
  public ActionForward prepare(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    final ExecutionYear currentExecutionYear = ExecutionYear.readCurrentExecutionYear();

    ElectionPeriodBean bean = new ElectionPeriodBean();
    bean.setDegreeType(DegreeType.BOLONHA_INTEGRATED_MASTER_DEGREE); // default
    bean.setExecutionYear(currentExecutionYear); // default

    request.setAttribute("electionPeriodBean", bean);
    request.setAttribute("currentExecutionYear", currentExecutionYear);
    return selectDegreeType(mapping, actionForm, request, response);
  }
  public ActionForward prepareCreateNewImportationProcess(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    DgesBaseProcessBean bean = getRenderedBean();
    if (bean == null) {
      bean = new DgesBaseProcessBean(ExecutionYear.readCurrentExecutionYear());
    }

    RenderUtils.invalidateViewState("importation.bean");
    RenderUtils.invalidateViewState("importation.bean.edit");

    request.setAttribute("importationBean", bean);

    return mapping.findForward("prepare-create-new-process");
  }
예제 #24
0
  private double getEnrolmentsEctsCredits(final ExecutionYear executionYear) {
    double result = 0.0;
    Set<Enrolment> annualEnrolments = new HashSet<Enrolment>();

    for (final ExecutionSemester executionSemester : executionYear.getExecutionPeriodsSet()) {
      for (final Enrolment enrolment : getStudentCurricularPlan().getEnrolmentsSet()) {
        if (enrolment.isValid(executionSemester) && !annualEnrolments.contains(enrolment)) {
          result += enrolment.getEctsCredits();

          if (enrolment.isAnual()) {
            annualEnrolments.add(enrolment);
          }
        }
      }
    }

    return result;
  }
  public ActionForward prepareCreateNewExportationCandidaciesForPasswordGenerationJob(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    DgesBaseProcessBean bean = getRenderedBean();
    if (bean == null) {
      bean = new DgesBaseProcessBean(ExecutionYear.readCurrentExecutionYear());
    }

    RenderUtils.invalidateViewState("importation.bean");
    RenderUtils.invalidateViewState("importation.bean.edit");

    request.setAttribute("importationBean", bean);

    return mapping.findForward(
        "prepare-create-new-exportation-candidacies-for-password-generation-job");
  }
  public ActionForward list(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

    DgesBaseProcessBean bean = getRenderedBean();
    if (bean == null) {
      bean = new DgesBaseProcessBean(ExecutionYear.readCurrentExecutionYear());
    }

    RenderUtils.invalidateViewState("importation.bean");
    request.setAttribute("importationBean", bean);

    request.setAttribute(
        "importationJobsDone", DgesStudentImportationProcess.readDoneJobs(bean.getExecutionYear()));
    request.setAttribute(
        "importationJobsPending",
        DgesStudentImportationProcess.readUndoneJobs(bean.getExecutionYear()));
    request.setAttribute(
        "exportationPasswordsDone",
        ExportDegreeCandidaciesByDegreeForPasswordGeneration.readDoneJobs(bean.getExecutionYear()));
    request.setAttribute(
        "exportationPasswordsPending",
        ExportDegreeCandidaciesByDegreeForPasswordGeneration.readUndoneJobs(
            bean.getExecutionYear()));
    request.setAttribute(
        "exportationAlreadyStudentsDone",
        ExportExistingStudentsFromImportationProcess.readDoneJobs(bean.getExecutionYear()));
    request.setAttribute(
        "exportionAlreadyStudentsPending",
        ExportExistingStudentsFromImportationProcess.readUndoneJobs(bean.getExecutionYear()));

    request.setAttribute(
        "canRequestJobImportationProcess", DgesStudentImportationProcess.canRequestJob());
    request.setAttribute(
        "canRequestJobExportationPasswords",
        ExportDegreeCandidaciesByDegreeForPasswordGeneration.canRequestJob());
    request.setAttribute(
        "canRequestJobExportationAlreadyStudents",
        ExportExistingStudentsFromImportationProcess.canRequestJob());

    return mapping.findForward("list");
  }
  public ActionForward selectDegreeType(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    final String forwardTo = (String) getFromRequest(request, "forwardTo");
    final ExecutionYear currentExecutionYear = ExecutionYear.readCurrentExecutionYear();

    ElectionPeriodBean bean = (ElectionPeriodBean) getFromRequest(request, "electionPeriodBean");

    if (bean == null) {
      final Degree degree = FenixFramework.getDomainObject(request.getParameter("degreeOID"));

      bean = new ElectionPeriodBean();
      bean.setDegree(degree);
      bean.setDegreeType(degree.getDegreeType());
      bean.setExecutionYear(currentExecutionYear); // default
    } else {
      if (bean.getExecutionYear() == null) {
        bean.setExecutionYear(currentExecutionYear); // default
      }
      if (bean.getDegreeType() == null) {
        bean.setDegreeType(DegreeType.BOLONHA_INTEGRATED_MASTER_DEGREE); // default
      }
    }

    List<YearDelegateElectionsPeriodsByDegreeBean> electionsByDegree =
        new ArrayList<YearDelegateElectionsPeriodsByDegreeBean>();
    for (Degree degree : Degree.readAllByDegreeType(bean.getDegreeType())) {
      List<YearDelegateElection> elections =
          degree.getYearDelegateElectionsGivenExecutionYear(bean.getExecutionYear());
      YearDelegateElectionsPeriodsByDegreeBean electionBean =
          new YearDelegateElectionsPeriodsByDegreeBean(degree, bean.getExecutionYear(), elections);
      electionsByDegree.add(electionBean);
    }

    request.setAttribute("electionPeriodBean", bean);
    request.setAttribute("currentExecutionYear", currentExecutionYear);
    request.setAttribute("electionsByDegreeBean", electionsByDegree);
    return mapping.findForward(forwardTo);
  }
예제 #28
0
  @EntryPoint
  public ActionForward prepare(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ContextSelectionBean contextSelectionBean =
        (ContextSelectionBean) request.getAttribute(PresentationConstants.CONTEXT_SELECTION_BEAN);

    final StudentContextSelectionBean studentContextSelectionBean =
        new StudentContextSelectionBean(contextSelectionBean.getAcademicInterval());
    request.setAttribute("studentContextSelectionBean", studentContextSelectionBean);

    final List<ExecutionDegree> executionDegrees =
        new ArrayList<ExecutionDegree>(
            ExecutionDegree.filterByAcademicInterval(contextSelectionBean.getAcademicInterval()));
    Collections.sort(executionDegrees, executionDegreeComparator);
    request.setAttribute("executionDegrees", executionDegrees);
    ExecutionSemester executionSemester =
        (ExecutionSemester)
            ExecutionInterval.getExecutionInterval(contextSelectionBean.getAcademicInterval());
    request.setAttribute("executionSemester", executionSemester);

    AcademicCalendarEntry academicCalendarEntry =
        contextSelectionBean.getAcademicInterval().getAcademicCalendarEntry();
    while (!(academicCalendarEntry instanceof AcademicCalendarRootEntry)) {
      if (academicCalendarEntry instanceof AcademicYearCE) {
        ExecutionYear year = ExecutionYear.getExecutionYear((AcademicYearCE) academicCalendarEntry);
        request.setAttribute("executionYear", year);
        break;
      } else {
        academicCalendarEntry = academicCalendarEntry.getParentEntry();
      }
    }

    if (!executionSemester.isCurrent()) {
      request.setAttribute("noEditionAllowed", true);
    }

    return mapping.findForward("showForm");
  }
  protected List run(String teacherID, String executionYearID) throws FenixServiceException {

    final Teacher teacher = FenixFramework.getDomainObject(teacherID);
    if (teacher == null) {
      throw new DomainException("error.noTeacher");
    }

    final ExecutionYear executionYear;
    if (executionYearID == null) {
      executionYear = ExecutionYear.readCurrentExecutionYear();
    } else {
      executionYear = FenixFramework.getDomainObject(executionYearID);
    }

    final List<Professorship> responsibleFors = new ArrayList();
    for (final Professorship professorship : teacher.responsibleFors()) {
      if (professorship.getExecutionCourse().getExecutionPeriod().getExecutionYear()
          == executionYear) {
        responsibleFors.add(professorship);
      }
    }
    return getDetailedProfessorships(teacher.getProfessorships(executionYear), responsibleFors);
  }
 protected InfoExecutionYear getCurrentExecutionYear() {
   return InfoExecutionYear.newInfoFromDomain(ExecutionYear.readCurrentExecutionYear());
 }