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);
  }
Exemple #2
0
  protected Set<Teacher> getTeachers(List<ExecutionSemester> executionSemesters) {
    Set<Teacher> teachers = new HashSet<Teacher>();
    ExecutionYear previousExecutionYear =
        executionSemester.getExecutionYear().getPreviousExecutionYear();
    for (final DegreeCurricularPlan degreeCurricularPlan : degree.getDegreeCurricularPlansSet()) {
      for (final CurricularCourse course : degreeCurricularPlan.getCurricularCourses()) {
        for (final ExecutionCourse executionCourse : course.getAssociatedExecutionCourses()) {
          if (executionSemesters.contains(executionCourse.getExecutionPeriod())) {
            for (Professorship professorhip : executionCourse.getProfessorshipsSet()) {
              if (professorhip
                  .getPerson()
                  .getTeacher()
                  .isActiveOrHasAuthorizationForSemester(executionCourse.getExecutionPeriod())) {
                teachers.add(professorhip.getPerson().getTeacher());
              }
            }
          }
          if (previousExecutionYear.equals(
              executionCourse.getExecutionPeriod().getExecutionYear())) {
            if (executionCourse.isDissertation()) {
              for (Attends attends : executionCourse.getAttends()) {
                if (attends.hasEnrolment() && attends.getEnrolment().getThesis() != null) {
                  for (ThesisEvaluationParticipant thesisEvaluationParticipant :
                      attends.getEnrolment().getThesis().getOrientation()) {
                    if (thesisEvaluationParticipant.getPerson().getTeacher() != null
                        && thesisEvaluationParticipant
                            .getPerson()
                            .getTeacher()
                            .isActiveOrHasAuthorizationForSemester(
                                executionCourse.getExecutionPeriod())) {
                      teachers.add(thesisEvaluationParticipant.getPerson().getTeacher());
                    }
                  }
                }
              }
            }
          }
        }
      }
    }

    PhdProgram phdProgram = degree.getPhdProgram();
    if (phdProgram != null) {
      for (PhdIndividualProgramProcess phdIndividualProgramProcess :
          phdProgram.getIndividualProgramProcesses()) {
        for (ExecutionSemester executionSemester : executionSemesters) {
          if (phdIndividualProgramProcess.isActive(
              executionSemester.getAcademicInterval().toInterval())) {
            for (PhdParticipant phdParticipant : phdIndividualProgramProcess.getParticipants()) {
              if (phdParticipant instanceof InternalPhdParticipant) {
                InternalPhdParticipant internalPhdParticipant =
                    (InternalPhdParticipant) phdParticipant;
                if (internalPhdParticipant.isGuidingOrAssistantGuiding()
                    && internalPhdParticipant.getPerson().getTeacher() != null
                    && internalPhdParticipant
                        .getPerson()
                        .getTeacher()
                        .isActiveOrHasAuthorizationForSemester(executionSemester)) {
                  teachers.add(internalPhdParticipant.getPerson().getTeacher());
                }
              }
            }
          }
        }
      }
    }
    return teachers;
  }