Exemple #1
0
  public static List<ExecutionDegree> getAllByDegreeAndCurricularStage(
      Degree degree, CurricularStage stage) {
    List<ExecutionDegree> result = new ArrayList<ExecutionDegree>();

    if (degree == null) {
      return result;
    }

    if (stage == null) {
      return result;
    }

    for (ExecutionDegree executionDegree : Bennu.getInstance().getExecutionDegreesSet()) {
      if (!degree.equals(executionDegree.getDegreeCurricularPlan().getDegree())) {
        continue;
      }

      if (!stage.equals(executionDegree.getDegreeCurricularPlan().getCurricularStage())) {
        continue;
      }

      result.add(executionDegree);
    }

    return result;
  }
        @Override
        public int compare(ExecutionDegree executionDegree1, ExecutionDegree executionDegree2) {
          final Degree degree1 = executionDegree1.getDegreeCurricularPlan().getDegree();
          final Degree degree2 = executionDegree2.getDegreeCurricularPlan().getDegree();

          int degreeTypeComparison = degree1.getDegreeType().compareTo(degree2.getDegreeType());
          return (degreeTypeComparison != 0)
              ? degreeTypeComparison
              : degree1.getNome().compareTo(degree2.getNome());
        }
Exemple #3
0
  public static List<ExecutionDegree> getAllByExecutionCourseAndTeacher(
      ExecutionCourse executionCourse, Person person) {
    List<ExecutionDegree> result = new ArrayList<ExecutionDegree>();

    for (ExecutionDegree executionDegree : Bennu.getInstance().getExecutionDegreesSet()) {
      boolean matchExecutionCourse = false;
      for (CurricularCourse curricularCourse :
          executionDegree.getDegreeCurricularPlan().getCurricularCoursesSet()) {
        if (curricularCourse.getAssociatedExecutionCoursesSet().contains(executionCourse)) {
          matchExecutionCourse = true;
          break;
        }
      }

      if (!matchExecutionCourse) {
        continue;
      }

      // if teacher is not a coordinator of the executionDegree
      if (executionDegree.getCoordinatorByTeacher(person) == null) {
        continue;
      }

      result.add(executionDegree);
    }

    return result;
  }
  @Atomic
  public static List run(
      String executionDegreeId, String executionPeriodId, Integer curricularYearInt)
      throws FenixServiceException {

    if (executionPeriodId == null) {
      throw new FenixServiceException("nullExecutionPeriodId");
    }

    final ExecutionSemester executionSemester = FenixFramework.getDomainObject(executionPeriodId);

    final List<ExecutionCourse> executionCourseList;
    if (executionDegreeId == null && curricularYearInt == null) {
      executionCourseList = executionSemester.getExecutionCoursesWithNoCurricularCourses();
    } else {
      final ExecutionDegree executionDegree =
          findExecutionDegreeByID(executionSemester, executionDegreeId);
      final DegreeCurricularPlan degreeCurricularPlan = executionDegree.getDegreeCurricularPlan();
      final CurricularYear curricularYear = CurricularYear.readByYear(curricularYearInt);
      executionCourseList =
          executionSemester
              .getExecutionCoursesByDegreeCurricularPlanAndSemesterAndCurricularYearAndName(
                  degreeCurricularPlan, curricularYear, "%");
    }

    final List infoExecutionCourseList = new ArrayList(executionCourseList.size());
    for (final ExecutionCourse executionCourse : executionCourseList) {
      infoExecutionCourseList.add(InfoExecutionCourse.newInfoFromDomain(executionCourse));
    }

    return infoExecutionCourseList;
  }
  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);
  }
  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();
    }
  }
  /**
   * @param id
   * @param argumentos
   * @return
   */
  private boolean hasPrivilege(User id, String executionDegreeID) {

    ExecutionDegree executionDegree = null;

    // Read The DegreeCurricularPlan
    try {

      executionDegree = FenixFramework.getDomainObject(executionDegreeID);

    } catch (Exception e) {
      return false;
    }

    if (executionDegree == null) {
      return false;
    }

    if (id.getPerson().hasRole(RoleType.MASTER_DEGREE_ADMINISTRATIVE_OFFICE)) {
      if (executionDegree
          .getDegreeCurricularPlan()
          .getDegree()
          .getDegreeType()
          .equals(DegreeType.MASTER_DEGREE)) {

        return true;
      }
      return false;
    }

    if (id.getPerson().hasRole(RoleType.COORDINATOR)) {
      // modified by Tânia Pousão
      Collection<Coordinator> coodinatorsList = executionDegree.getCoordinatorsListSet();
      if (coodinatorsList == null) {
        return false;
      }
      Iterator<Coordinator> listIterator = coodinatorsList.iterator();
      while (listIterator.hasNext()) {
        Coordinator coordinator = listIterator.next();

        if (coordinator.getPerson() == id.getPerson()) {
          return true;
        }
      }
    }
    return false;
  }
Exemple #8
0
  public static ExecutionDegree getByDegreeCurricularPlanNameAndExecutionYear(
      String degreeName, ExecutionYear executionYear) {
    if (degreeName == null) {
      return null;
    }

    if (executionYear == null) {
      return null;
    }

    for (ExecutionDegree executionDegree : executionYear.getExecutionDegreesSet()) {
      if (degreeName.equalsIgnoreCase(executionDegree.getDegreeCurricularPlan().getName())) {
        return executionDegree;
      }
    }

    return null;
  }
Exemple #9
0
  public static List<ExecutionDegree> getAllByDegreeAndExecutionYear(Degree degree, String year) {
    List<ExecutionDegree> result = new ArrayList<ExecutionDegree>();

    if (degree == null || year == null) {
      return result;
    }

    ExecutionYear executionYear = ExecutionYear.readExecutionYearByName(year);
    if (executionYear == null) {
      return result;
    }

    for (ExecutionDegree executionDegree : executionYear.getExecutionDegreesSet()) {
      if (degree.equals(executionDegree.getDegreeCurricularPlan().getDegree())) {
        result.add(executionDegree);
      }
    }

    return result;
  }
Exemple #10
0
 @Override
 public int compare(ExecutionDegree o1, ExecutionDegree o2) {
   return o2.getDegreeCurricularPlan()
       .getExternalId()
       .compareTo(o1.getDegreeCurricularPlan().getExternalId());
 }