@Override
  public List<StudentCurricularPlan> getPrecedentStudentCurricularPlans() {
    final Student student = getStudent();
    if (student == null) {
      return Collections.emptyList();
    }

    final List<StudentCurricularPlan> studentCurricularPlans =
        new ArrayList<StudentCurricularPlan>();
    for (final Registration registration : student.getRegistrationsSet()) {

      if (registration.isBolonha()) {
        final StudentCurricularPlan studentCurricularPlan =
            registration.getLastStudentCurricularPlan();

        for (final CycleType cycleType : getValidPrecedentCycleTypes()) {
          if (studentCurricularPlan.hasCycleCurriculumGroup(cycleType)) {
            final CycleCurriculumGroup cycle = studentCurricularPlan.getCycle(cycleType);

            if (!cycle.isConclusionProcessed() && !cycle.isConcluded()) {
              studentCurricularPlans.add(registration.getLastStudentCurricularPlan());
              break;
            }
          }
        }

      } else if (isPreBolonhaPrecedentDegreeAllowed()) {
        if (!registration.isConcluded() && !registration.isRegistrationConclusionProcessed()) {
          studentCurricularPlans.add(registration.getLastStudentCurricularPlan());
        }
      }
    }

    return studentCurricularPlans;
  }
Exemplo n.º 2
0
 @Atomic
 private void doit() {
   final CgdCard card = FenixFramework.getDomainObject(cardId);
   final Person person = card.getUser().getPerson();
   if (person != null) {
     final Student student = person.getStudent();
     if (student != null) {
       for (final Registration registration : student.getRegistrationsSet()) {
         if (registration.isActive()) {
           new CgdForm43Sender().sendForm43For(registration);
         }
       }
     }
   }
 }
 public static pt.ist.fenixframework.dml.runtime.DirectRelation<
         org.fenixedu.academic.domain.student.Student,
         org.fenixedu.academic.domain.residence.StudentsPerformanceReport>
     getRelationResidenceManagementStudentsPerformanceReportStudent() {
   return org.fenixedu.academic.domain.student.Student
       .getRelationResidenceManagementStudentsPerformanceReportStudent();
 }
 protected void addDebtsWarningMessages(
     final Student student,
     final ExecutionSemester executionSemester,
     final HttpServletRequest request) {
   if (student.isAnyGratuityOrAdministrativeOfficeFeeAndInsuranceInDebt()) {
     addActionMessage("warning", request, "label.student.events.in.debt.warning");
   }
 }
 public boolean hasCandidacy(final Student student) {
   for (final Registration registration : student.getRegistrationsSet()) {
     for (final OutboundMobilityCandidacySubmission submission :
         registration.getOutboundMobilityCandidacySubmissionSet()) {
       for (final OutboundMobilityCandidacy candidacy :
           submission.getOutboundMobilityCandidacySet()) {
         if (candidacy.getOutboundMobilityCandidacyContest() == this) {
           return true;
         }
       }
     }
   }
   return false;
 }
  @EntryPoint
  public ActionForward prepareSearch(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response) {

    StudentsSearchBean studentsSearchBean = getRenderedObject();

    if (studentsSearchBean == null) { // 1st time
      studentsSearchBean = new StudentsSearchBean();
    } else {

      final Set<Student> students = studentsSearchBean.search();
      Set<Student> result = new HashSet<Student>();

      for (Student student : students) {
        for (Registration registration : student.getAllRegistrations()) {
          if (!registration.isBolonha()) {
            result.add(student);
            break;
          }
        }
      }

      if (result.size() == 1) {
        Student student = result.iterator().next();
        request.setAttribute("student", student);
        request.setAttribute("choosePhdOrRegistration", new ChooseRegistrationOrPhd(student));
        return mapping.findForward("viewStudentDetails");
      }
      request.setAttribute("students", result);
    }

    request.setAttribute("studentsSearchBean", studentsSearchBean);
    return mapping.findForward("search");
  }
 public Registration findBestRegistration(final Student student) {
   for (final Registration registration : student.getRegistrationsSet()) {
     for (final ExecutionDegree executionDegree :
         getOutboundMobilityCandidacyContestGroup().getExecutionDegreeSet()) {
       if (executionDegree.getDegree() == registration.getDegree()) {
         final ExecutionYear executionYear =
             (ExecutionYear) getOutboundMobilityCandidacyPeriod().getExecutionInterval();
         final RegistrationState registrationState =
             registration.getLastRegistrationState(executionYear);
         if (registrationState != null && registrationState.getStateType().isActive()) {
           return registration;
         }
       }
     }
   }
   return null;
 }
  public ActionForward warmUpCacheForEnrolmentPeriodStart(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    final ExecutionSemester ces = ExecutionSemester.readActualExecutionSemester();
    final ExecutionSemester pes = ces == null ? null : ces.getPreviousExecutionPeriod();

    if (ces != null && pes != null) {
      long s = System.currentTimeMillis();
      for (final ExecutionCourse executionCourse : ces.getAssociatedExecutionCoursesSet()) {
        executionCourse.getName();
        for (final CourseLoad courseLoad : executionCourse.getCourseLoadsSet()) {
          courseLoad.getType();
          for (final Shift shift : courseLoad.getShiftsSet()) {
            shift.getNome();
            for (final SchoolClass schoolClass : shift.getAssociatedClassesSet()) {
              schoolClass.getNome();
              final ExecutionDegree executionDegree = schoolClass.getExecutionDegree();
              final DegreeCurricularPlan degreeCurricularPlan =
                  executionDegree.getDegreeCurricularPlan();
              degreeCurricularPlan.getName();
              final Degree degree = degreeCurricularPlan.getDegree();
              degree.getDegreeType();
              final RootCourseGroup root = degreeCurricularPlan.getRoot();
              load(root);
            }
            for (final Lesson lesson : shift.getAssociatedLessonsSet()) {
              lesson.getBeginHourMinuteSecond();
              for (OccupationPeriod period = lesson.getPeriod();
                  period != null;
                  period = period.getNextPeriod()) {
                period.getStartDate();
              }
              for (final LessonInstance lessonInstance : lesson.getLessonInstancesSet()) {
                lessonInstance.getBeginDateTime();
              }
            }
          }
        }
      }
      long e = System.currentTimeMillis();
      logger.info(
          "Warming up cache for enrolment period. Load of current semester information took {}ms.",
          e - s);

      s = System.currentTimeMillis();
      //            for (final RoomClassification roomClassification :
      // rootDomainObject.getRoomClassificationSet()) {
      //                for (final RoomInformation roomInformation :
      // roomClassification.getRoomInformationsSet()) {
      //                    roomInformation.getDescription();
      //                    final Room room = roomInformation.getRoom();
      //                    room.getNormalCapacity();
      //                }
      //            }
      e = System.currentTimeMillis();
      logger.info("Warming up cache for enrolment period. Load of room listing took {}ms.", e - s);

      final Set<Student> students = new HashSet<Student>();
      s = System.currentTimeMillis();
      for (final Enrolment enrolment : pes.getEnrolmentsSet()) {
        students.add(enrolment.getStudent());
      }
      e = System.currentTimeMillis();
      logger.info("Warming up cache for enrolment period. Search for students took {}ms.", e - s);

      s = System.currentTimeMillis();
      for (final Student student : students) {
        student.getNumber();
        for (final Registration registration : student.getRegistrationsSet()) {
          registration.getNumber();
          for (final StudentCurricularPlan studentCurricularPlan :
              registration.getStudentCurricularPlansSet()) {
            final RootCurriculumGroup root = studentCurricularPlan.getRoot();
            load(root);
          }
        }
      }
      e = System.currentTimeMillis();
      logger.info(
          "Warming up cache for enrolment period. Load of student curriculum took {}ms.", e - s);
    }

    return monitor(mapping, form, request, response);
  }
 public Comparable<?> getKey(org.fenixedu.academic.domain.student.Student value) {
   return value.getOid();
 }