protected List<SecondCycleCandidacyProcess> getCandidacyProcesses(
     final ExecutionInterval executionInterval) {
   final List<SecondCycleCandidacyProcess> result = new ArrayList<SecondCycleCandidacyProcess>();
   for (final SecondCycleCandidacyPeriod period :
       executionInterval.getSecondCycleCandidacyPeriods()) {
     result.add(period.getSecondCycleCandidacyProcess());
   }
   return result;
 }
Beispiel #2
0
 private void check(
     final ExecutionInterval executionInterval,
     final PaymentCode oldCode,
     final PaymentCode newCode) {
   if (oldCode.equals(newCode)) {
     throw new DomainException("error.PaymentCodeMapping.old.code.equals.new.code");
   }
   final PaymentCode code = executionInterval.findNewCodeInPaymentCodeMapping(oldCode);
   if (code != null) {
     throw new DomainException(
         "error.PaymentCodeMapping.find.existing.code",
         oldCode.getFormattedCode(),
         code.getFormattedCode());
   }
 }
 /** Set context information used by intro page */
 protected void setMainCandidacyProcessInformation(
     final HttpServletRequest request, final CandidacyProcess process) {
   request.setAttribute("process", process);
   request.setAttribute("processName", getParentProcessType().getSimpleName());
   request.setAttribute("canCreateProcess", canCreateProcess(getParentProcessType().getName()));
   request.setAttribute(
       "processActivities", process.getAllowedActivities(AccessControl.getUserView()));
   request.setAttribute("canCreateChildProcess", canCreateProcess(getProcessType().getName()));
   request.setAttribute("childProcessName", getProcessType().getSimpleName());
   request.setAttribute("childProcesses", process.getChildProcesses());
   request.setAttribute(
       "executionIntervalId", process.getCandidacyExecutionInterval().getIdInternal());
   request.setAttribute(
       "executionIntervals",
       ExecutionInterval.readExecutionIntervalsWithCandidacyPeriod(
           process.getCandidacyPeriod().getClass()));
 }
  @Override
  protected SecondCycleCandidacyProcess getCandidacyProcess(
      final HttpServletRequest request, final ExecutionInterval executionInterval) {

    final String selectedProcessId = getStringFromRequest(request, "selectedProcessId");
    if (selectedProcessId != null) {
      for (final SecondCycleCandidacyPeriod candidacyPeriod :
          executionInterval.getSecondCycleCandidacyPeriods()) {
        if (candidacyPeriod
            .getSecondCycleCandidacyProcess()
            .getExternalId()
            .equals(selectedProcessId)) {
          return candidacyPeriod.getSecondCycleCandidacyProcess();
        }
      }
    }
    return null;
  }
Beispiel #5
0
  public ActionForward chooseStudent(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    final StudentContextSelectionBean studentContextSelectionBean = getRenderedObject();

    final String number = studentContextSelectionBean.getNumber();
    if (number != null && !number.isEmpty()) {
      final AcademicInterval academicInterval = studentContextSelectionBean.getAcademicInterval();
      final ExecutionInterval executionInterval =
          ExecutionInterval.getExecutionInterval(academicInterval);

      final SearchParameters searchParameters = new SearchParameters();
      if (StringUtils.isNumeric(number)) {
        searchParameters.setStudentNumber(Integer.valueOf(number));
      } else {
        searchParameters.setUsername(number);
      }
      final CollectionPager<Person> people =
          new SearchPerson()
              .run(searchParameters, new SearchPerson.SearchPersonPredicate(searchParameters));
      final Collection<Registration> registrations = new ArrayList<Registration>();
      for (final Person person : people.getCollection()) {
        if (person.getStudent() != null) {
          for (final Registration registration : person.getStudent().getRegistrationsSet()) {
            if (registration.hasAnyActiveState((ExecutionSemester) executionInterval)) {
              registrations.add(registration);
            }
          }
        }
      }

      if (studentContextSelectionBean.getToEdit()) {
        request.setAttribute("toEditScheduleRegistrations", registrations);
      } else {
        request.setAttribute("registrations", registrations);
        request.setAttribute("timeTableExecutionSemester", executionInterval);
      }
    }

    return prepare(mapping, form, request, response);
  }
Beispiel #6
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");
  }
 private List<ExecutionInterval> getExecutionIntervalsWithCandidacyPeriod() {
   return ExecutionInterval.readExecutionIntervalsWithCandidacyPeriod(getCandidacyPeriodType());
 }