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 ExecutionDegree getExecutionDegree() {
   if (this.executionDegree == null) {
     for (final ExecutionDegree executionDegree :
         getDegreeCurricularPlan().getExecutionDegreesSet()) {
       if (executionDegree.getExecutionYear() == getExecutionPeriod().getExecutionYear()) {
         return (this.executionDegree = executionDegree);
       }
     }
   }
   return this.executionDegree;
 }
Exemple #3
0
  public static ExecutionDegree getByDegreeCurricularPlanAndExecutionYear(
      DegreeCurricularPlan degreeCurricularPlan, ExecutionYear executionYear) {
    if (degreeCurricularPlan == null || executionYear == null) {
      return null;
    }

    for (ExecutionDegree executionDegree : degreeCurricularPlan.getExecutionDegreesSet()) {
      if (executionYear == executionDegree.getExecutionYear()) {
        return executionDegree;
      }
    }

    return null;
  }
Exemple #4
0
  public static List<ExecutionDegree> getAllByExecutionYear(String year) {

    if (year == null) {
      return Collections.emptyList();
    }

    final List<ExecutionDegree> result = new ArrayList<ExecutionDegree>();
    for (ExecutionDegree executionDegree : Bennu.getInstance().getExecutionDegreesSet()) {
      if (year.equals(executionDegree.getExecutionYear().getYear())) {
        result.add(executionDegree);
      }
    }
    Collections.sort(result, COMPARATOR_BY_DEGREE_CURRICULAR_PLAN_ID_INTERNAL_DESC);

    return result;
  }
Exemple #5
0
  public static ExecutionDegree getByDegreeCurricularPlanAndExecutionYear(
      DegreeCurricularPlan degreeCurricularPlan, String executionYear) {
    if (degreeCurricularPlan == null) {
      return null;
    }

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

    for (ExecutionDegree executionDegree : degreeCurricularPlan.getExecutionDegreesSet()) {
      if (executionYear.equalsIgnoreCase(executionDegree.getExecutionYear().getYear())) {
        return executionDegree;
      }
    }

    return null;
  }
Exemple #6
0
 @Override
 public int compare(ExecutionDegree o1, ExecutionDegree o2) {
   return o1.getExecutionYear().compareTo(o2.getExecutionYear());
 }
Exemple #7
0
 @Override
 public int compareTo(ExecutionDegree executionDegree) {
   final ExecutionYear executionYear = executionDegree.getExecutionYear();
   return getExecutionYear().compareTo(executionYear);
 }