Ejemplo n.º 1
0
  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);
  }
Ejemplo n.º 2
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;
  }
Ejemplo n.º 3
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;
  }
  @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;
  }
  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 static ExecutionDegree findExecutionDegreeByID(
     final ExecutionSemester executionSemester, final String executionDegreeId) {
   final ExecutionYear executionYear = executionSemester.getExecutionYear();
   for (final ExecutionDegree executionDegree : executionYear.getExecutionDegreesSet()) {
     if (executionDegree.getExternalId().equals(executionDegreeId)) {
       return executionDegree;
     }
   }
   return null;
 }
Ejemplo n.º 7
0
        @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());
        }
Ejemplo n.º 8
0
  /**
   * Ver onde sao guardados os StudentInquiries (QUC): ir por CurricularCourses
   *
   * <p>1. Extrair o ED 2. A partir do ED extrair duas collections: CourseResults e TeacherResults
   * 3. Magia para tirar um score desses results (ainda nao sei o q possa ser esse score. vou
   * extrair o 'average_NDE' e 'average_P6_1' apenas a titulo de exemplo. nao tem qq valor real. os
   * values sao em double, passar a BigDecimals e trabalhar sempre neste format). 4. Aplicar 50% à
   * media do score de todos os CourseResults e 50% à media do score de todos os TeacherResults 5.
   * Mostrar esse score.
   */
  private String generateQUCResults(YearViewBean bean) {
    ExecutionDegree executionDegree =
        ExecutionDegree.getByDegreeCurricularPlanAndExecutionYear(
            bean.getDegreeCurricularPlan(), bean.getExecutionYear());

    Set<StudentInquiriesCourseResult> courseResults =
        executionDegree.getStudentInquiriesCourseResultsSet();
    Set<StudentInquiriesTeachingResult> teachingResults =
        executionDegree.getStudentInquiriesTeachingResultsSet();

    BigDecimal sigmaCR = new BigDecimal(0);
    BigDecimal cardinalityCR = new BigDecimal(0);
    BigDecimal averageCR = new BigDecimal(0);

    BigDecimal sigmaTR = new BigDecimal(0);
    BigDecimal cardinalityTR = new BigDecimal(0);
    BigDecimal averageTR = new BigDecimal(0);

    BigDecimal partialCourse = new BigDecimal(0);
    BigDecimal partialTeaching = new BigDecimal(0);

    String result;

    for (StudentInquiriesCourseResult courseResult : courseResults) {
      BigDecimal converted =
          new BigDecimal(courseResult.getAverage_NDE() != null ? courseResult.getAverage_NDE() : 0);
      sigmaCR = sigmaCR.add(converted);
      cardinalityCR = cardinalityCR.add(BigDecimal.ONE);
    }
    if (cardinalityCR.compareTo(BigDecimal.ZERO) != 0) {
      averageCR = sigmaCR.divide(cardinalityCR, 4, RoundingMode.HALF_EVEN);
    } else {
      averageCR = BigDecimal.ZERO;
    }

    for (StudentInquiriesTeachingResult teachingResult : teachingResults) {
      BigDecimal converted =
          new BigDecimal(
              teachingResult.getAverage_P6_1() != null ? teachingResult.getAverage_P6_1() : 0);
      sigmaTR = sigmaTR.add(converted);
      cardinalityTR = cardinalityTR.add(BigDecimal.ONE);
    }
    if (cardinalityCR.compareTo(BigDecimal.ZERO) != 0) {
      averageTR = sigmaTR.divide(cardinalityTR, 4, RoundingMode.HALF_EVEN);
    } else {
      averageTR = BigDecimal.ZERO;
    }

    partialCourse = averageCR.divide(new BigDecimal(2), 2, RoundingMode.HALF_EVEN);
    partialTeaching = averageTR.divide(new BigDecimal(2), 2, RoundingMode.HALF_EVEN);

    result = partialCourse.add(partialTeaching).toPlainString();

    return result;
  }
Ejemplo n.º 9
0
  public static List<ExecutionDegree> getAllByDegree(final Degree degree) {
    List<ExecutionDegree> result = new ArrayList<ExecutionDegree>();

    for (ExecutionDegree executionDegree : Bennu.getInstance().getExecutionDegreesSet()) {
      if (executionDegree.getDegree() == degree) {
        result.add(executionDegree);
      }
    }

    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;
 }
Ejemplo n.º 11
0
  public static ExecutionDegree readByDegreeCodeAndExecutionYearAndCampus(
      String degreeCode, ExecutionYear executionYear, Space campus) {
    for (final Degree degree : Degree.readAllByDegreeCode(degreeCode)) {
      final ExecutionDegree executionDegree =
          degree.getMostRecentDegreeCurricularPlan().getExecutionDegreeByYear(executionYear);
      if (executionDegree.getCampus() == campus) {
        return executionDegree;
      }
    }

    return null;
  }
Ejemplo n.º 12
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;
  }
 public Date getCalendarEndDate() {
   Date endDate = getExecutionPeriod().getEndDate();
   final ExecutionDegree executionDegree = getExecutionDegree();
   if (executionDegree != null) {
     if (getExecutionPeriod().getSemester().intValue() == 1
         && executionDegree.getPeriodExamsFirstSemester().getEnd() != null) {
       endDate = executionDegree.getPeriodExamsFirstSemester().getEnd();
     } else if (getExecutionPeriod().getSemester().intValue() == 2
         && executionDegree.getPeriodExamsSecondSemester().getEnd() != null) {
       endDate = executionDegree.getPeriodExamsSecondSemester().getEnd();
     }
   }
   return endDate;
 }
 public Date getCalendarBeginDate() {
   Date beginDate = getExecutionPeriod().getBeginDate();
   final ExecutionDegree executionDegree = getExecutionDegree();
   if (executionDegree != null) {
     if (getExecutionPeriod().getSemester().intValue() == 1
         && executionDegree.getPeriodLessonsFirstSemester().getStart() != null) {
       beginDate = executionDegree.getPeriodLessonsFirstSemester().getStart();
     } else if (getExecutionPeriod().getSemester().intValue() == 2
         && executionDegree.getPeriodLessonsSecondSemester().getStart() != null) {
       beginDate = executionDegree.getPeriodLessonsSecondSemester().getStart();
     }
   }
   return beginDate;
 }
  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();
    }
  }
Ejemplo n.º 16
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;
  }
Ejemplo n.º 17
0
 @Atomic
 public static List<InfoExecutionCourse> runSearchExecutionCourses(
     AcademicInterval academicInterval, ExecutionDegree executionDegree, String courseName)
     throws NotAuthorizedException {
   CoordinatorExecutionDegreeAuthorizationFilter.instance.execute(executionDegree.getExternalId());
   return serviceInstance.run(academicInterval, executionDegree, courseName);
 }
  /**
   * @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;
  }
Ejemplo n.º 19
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;
  }
Ejemplo n.º 20
0
 public boolean contains(int abstractStudentNumber, final ExecutionDegree executionDegree) {
   for (final ShiftDistributionEntry distributionEntry :
       executionDegree.getShiftDistributionEntriesSet()) {
     if (distributionEntry.getAbstractStudentNumber().intValue() == abstractStudentNumber) {
       return true;
     }
   }
   return false;
 }
Ejemplo n.º 21
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;
  }
Ejemplo n.º 22
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;
  }
Ejemplo n.º 23
0
  @Atomic
  public static InfoCandidateRegistration run(
      String candidateID, String branchID, Integer studentNumber, User userView)
      throws FenixServiceException {
    check(RolePredicates.MASTER_DEGREE_ADMINISTRATIVE_OFFICE_PREDICATE);
    MasterDegreeCandidate masterDegreeCandidate = FenixFramework.getDomainObject(candidateID);

    Person person = masterDegreeCandidate.getPerson();

    checkCandidateSituation(masterDegreeCandidate.getActiveCandidateSituation());

    // remove master degree candidate role
    person.removeRoleByType(RoleType.MASTER_DEGREE_CANDIDATE);

    // check if old student number is free
    checkOldStudentNumber(studentNumber, person);

    // create new student
    final ExecutionDegree executionDegree = masterDegreeCandidate.getExecutionDegree();
    Registration registration =
        createNewRegistration(person, studentNumber, executionDegree.getDegree());

    // person.addPersonRoles(Role.getRoleByRoleType(RoleType.STUDENT));

    StudentCurricularPlan studentCurricularPlan =
        createNewStudentCurricularPlan(registration, branchID, masterDegreeCandidate);

    // person.addPersonRoles(Role.getRoleByRoleType(RoleType.STUDENT));

    createEnrolments(userView, masterDegreeCandidate, studentCurricularPlan);

    updateCandidateSituation(masterDegreeCandidate);

    copyQualifications(masterDegreeCandidate, person);

    createGratuitySituation(masterDegreeCandidate, studentCurricularPlan);

    return createNewInfoCandidateRegistration(masterDegreeCandidate, studentCurricularPlan);
  }
Ejemplo n.º 24
0
  public static List<ExecutionDegree> getAllByExecutionYearAndDegreeType(
      ExecutionYear executionYear, DegreeType... typeOfCourse) {

    if (executionYear == null || typeOfCourse == null) {
      return Collections.emptyList();
    }

    final List<ExecutionDegree> result = new ArrayList<ExecutionDegree>();
    for (final ExecutionDegree executionDegree : executionYear.getExecutionDegreesSet()) {
      boolean match = false;
      for (DegreeType type : typeOfCourse) {
        match |= type.equals(executionDegree.getDegreeType());
      }
      if (!match) {
        continue;
      }

      result.add(executionDegree);
    }
    Collections.sort(result, COMPARATOR_BY_DEGREE_CURRICULAR_PLAN_ID_INTERNAL_DESC);

    return result;
  }
Ejemplo n.º 25
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");
  }
Ejemplo n.º 26
0
  public ScientificCommission(ExecutionDegree executionDegree, Person person) {
    super();

    if (executionDegree.isPersonInScientificCommission(person)) {
      throw new DomainException("scientificCommission.person.duplicate");
    }

    setRootDomainObject(RootDomainObject.getInstance());

    setContact(false);
    setExecutionDegree(executionDegree);
    setPerson(person);

    ScientificCommissionLog.createLog(
        this.getExecutionDegree().getDegree(),
        this.getExecutionDegree().getExecutionYear(),
        "resources.MessagingResources",
        "log.degree.scientificcomission.addmember",
        this.getPerson().getPresentationName(),
        this.getExecutionDegree().getDegree().getPresentationName());
  }
Ejemplo n.º 27
0
 @Override
 public int compare(ExecutionDegree o1, ExecutionDegree o2) {
   return o1.getExecutionYear().compareTo(o2.getExecutionYear());
 }
Ejemplo n.º 28
0
 @Override
 public int compare(ExecutionDegree o1, ExecutionDegree o2) {
   final int dcc = o1.getDegree().getSigla().compareTo(o2.getDegree().getSigla());
   return dcc == 0 ? o1.getExternalId().compareTo(o2.getExternalId()) : dcc;
 }
Ejemplo n.º 29
0
 @Override
 public int compareTo(ExecutionDegree executionDegree) {
   final ExecutionYear executionYear = executionDegree.getExecutionYear();
   return getExecutionYear().compareTo(executionYear);
 }
Ejemplo n.º 30
0
 @Override
 public int compare(ExecutionDegree o1, ExecutionDegree o2) {
   return o2.getDegreeCurricularPlan()
       .getExternalId()
       .compareTo(o1.getDegreeCurricularPlan().getExternalId());
 }