예제 #1
0
 private Set<ShiftType> getNonAssociatedTeachersShiftTypes(ExecutionCourse executionCourse) {
   Set<ShiftType> nonAssociatedTeachersShiftTypes = new HashSet<ShiftType>();
   for (Shift shift : executionCourse.getAssociatedShifts()) {
     if (shift.getDegreeTeachingServicesSet().isEmpty()
         && shift.getNonRegularTeachingServicesSet().isEmpty()) {
       nonAssociatedTeachersShiftTypes.addAll(shift.getTypes());
     }
   }
   return nonAssociatedTeachersShiftTypes;
 }
예제 #2
0
  @Atomic
  public static void run(InfoShift infoShift, List<String> schoolClassOIDs)
      throws FenixServiceException {
    check(RolePredicates.RESOURCE_ALLOCATION_MANAGER_PREDICATE);

    final Shift shift = FenixFramework.getDomainObject(infoShift.getExternalId());
    if (shift == null) {
      throw new InvalidArgumentsServiceException();
    }

    for (final String schoolClassOID : schoolClassOIDs) {
      final SchoolClass schoolClass = FenixFramework.getDomainObject(schoolClassOID);
      if (schoolClass == null) {
        throw new InvalidArgumentsServiceException();
      }

      shift.associateSchoolClass(schoolClass);
    }
  }
예제 #3
0
 @Atomic
 public static Object run(final InfoShift infoShift, final InfoClass infoClass) {
   check(RolePredicates.RESOURCE_ALLOCATION_MANAGER_PREDICATE);
   final Shift shift = FenixFramework.getDomainObject(infoShift.getExternalId());
   if (shift == null) {
     return Boolean.FALSE;
   }
   final SchoolClass schoolClass =
       (SchoolClass)
           CollectionUtils.find(
               shift.getAssociatedClassesSet(),
               new Predicate() {
                 @Override
                 public boolean evaluate(Object arg0) {
                   final SchoolClass schoolClass = (SchoolClass) arg0;
                   return schoolClass.getExternalId().equals(infoClass.getExternalId());
                 }
               });
   if (schoolClass == null) {
     return Boolean.FALSE;
   }
   shift.getAssociatedClassesSet().remove(schoolClass);
   return Boolean.TRUE;
 }
예제 #4
0
  public SummariesManagementBean(
      MultiLanguageString title,
      MultiLanguageString summaryText,
      Integer studentsNumber,
      SummaryType summaryType,
      Professorship professorship,
      String teacherName,
      Teacher teacher,
      Shift shift,
      Lesson lesson,
      YearMonthDay summaryDate,
      AllocatableSpace summaryRoom,
      Partial summaryTime,
      Summary summary,
      Professorship professorshipLogged,
      ShiftType lessonType,
      Boolean taught) {

    setTitle(title);
    setSummaryText(summaryText);
    setSummaryType(summaryType);
    setShift(shift);
    setLesson(lesson);
    setProfessorship(professorship);
    setTeacher(teacher);
    setTeacherName(teacherName);
    setSummary(summary);
    setSummaryDate(summaryDate);
    setSummaryRoom(summaryRoom);
    setSummaryTime(summaryTime);
    setStudentsNumber(studentsNumber);
    setExecutionCourse(shift.getExecutionCourse());
    setProfessorshipLogged(professorshipLogged);
    setLessonType(lessonType);
    setTaught(taught);
  }
예제 #5
0
  @Atomic
  private Map<ExecutionDegree, Integer> setFirstYearShiftsCapacity(
      Boolean toBlock, ExecutionYear executionYear) {

    final ExecutionSemester executionSemester = executionYear.getFirstExecutionPeriod();

    final Map<Shift, Set<ExecutionDegree>> shiftsDegrees =
        new HashMap<Shift, Set<ExecutionDegree>>();
    final Set<Shift> shifts = new HashSet<Shift>();
    final Map<ExecutionDegree, Integer> modified = new HashMap<ExecutionDegree, Integer>();

    for (final Degree degree :
        Degree.readAllByDegreeType(
            DegreeType.BOLONHA_DEGREE, DegreeType.BOLONHA_INTEGRATED_MASTER_DEGREE)) {
      for (final DegreeCurricularPlan degreeCurricularPlan :
          degree.getActiveDegreeCurricularPlans()) {
        final ExecutionDegree executionDegree =
            degreeCurricularPlan.getExecutionDegreeByAcademicInterval(
                executionSemester.getExecutionYear().getAcademicInterval());

        if (executionDegree != null) {
          for (final SchoolClass schoolClass : executionDegree.getSchoolClassesSet()) {
            if (schoolClass.getAnoCurricular().equals(FIRST_CURRICULAR_YEAR)
                && schoolClass.getExecutionPeriod() == executionSemester) {
              for (final Shift shift : schoolClass.getAssociatedShiftsSet()) {
                Set<ExecutionDegree> executionDegrees = shiftsDegrees.get(shift);
                if (executionDegrees == null) {
                  executionDegrees = new HashSet<ExecutionDegree>();
                }
                executionDegrees.add(executionDegree);
                shiftsDegrees.put(shift, executionDegrees);
                shifts.add(shift);
              }
            }
          }
        }
      }
    }

    for (final Shift shift : shifts) {
      int capacity = shift.getLotacao().intValue();

      if (toBlock && capacity > 0) {
        shift.setLotacao(capacity * -1);
      } else if (!toBlock && capacity < 0) {
        shift.setLotacao(capacity * -1);
      } else {
        continue;
      }

      for (ExecutionDegree executionDegree : shiftsDegrees.get(shift)) {
        if (modified.containsKey(executionDegree)) {
          modified.put(executionDegree, modified.get(executionDegree) + 1);
        } else {
          modified.put(executionDegree, 1);
        }
      }
    }

    if (modified.size() > 0) {
      new FirstYearShiftsCapacityToggleLog(
          executionYear.getFirstExecutionPeriod(), Authenticate.getUser().getPerson().getUser());
    }

    return modified;
  }