public static Professorship create( Boolean responsibleFor, ExecutionCourse executionCourse, Teacher teacher, Double hours) throws MaxResponsibleForExceed, InvalidCategory { for (final Professorship otherProfessorship : executionCourse.getProfessorshipsSet()) { if (teacher == otherProfessorship.getTeacher()) { throw new DomainException("error.teacher.already.associated.to.professorship"); } } if (responsibleFor == null || executionCourse == null || teacher == null) { throw new NullPointerException(); } Professorship professorShip = new Professorship(); professorShip.setHours((hours == null) ? new Double(0.0) : hours); professorShip.setExecutionCourse(executionCourse); professorShip.setPerson(teacher.getPerson()); professorShip.setCreator(AccessControl.getPerson()); professorShip.setResponsibleFor(responsibleFor); executionCourse.moveSummariesFromTeacherToProfessorship(teacher, professorShip); return professorShip; }
public static List<Professorship> readByDegreeCurricularPlansAndExecutionYearAndBasic( List<DegreeCurricularPlan> degreeCurricularPlans, ExecutionYear executionYear, Boolean basic) { Set<Professorship> professorships = new HashSet<Professorship>(); for (DegreeCurricularPlan degreeCurricularPlan : degreeCurricularPlans) { for (CurricularCourse curricularCourse : degreeCurricularPlan.getCurricularCourses()) { if (curricularCourse.getBasic() == null || curricularCourse.getBasic().equals(basic)) { if (executionYear != null) { for (ExecutionCourse executionCourse : curricularCourse.getExecutionCoursesByExecutionYear(executionYear)) { professorships.addAll(executionCourse.getProfessorships()); } } else { for (ExecutionCourse executionCourse : curricularCourse.getAssociatedExecutionCourses()) { professorships.addAll(executionCourse.getProfessorships()); } } } } } return new ArrayList<Professorship>(professorships); }
public static List<Professorship> readByDegreeCurricularPlanAndExecutionPeriod( DegreeCurricularPlan degreeCurricularPlan, ExecutionSemester executionSemester) { Set<Professorship> professorships = new HashSet<Professorship>(); for (CurricularCourse curricularCourse : degreeCurricularPlan.getCurricularCourses()) { for (ExecutionCourse executionCourse : curricularCourse.getExecutionCoursesByExecutionPeriod(executionSemester)) { professorships.addAll(executionCourse.getProfessorships()); } } return new ArrayList<Professorship>(professorships); }
public boolean isTeachingInquiriesToAnswer() { final ExecutionCourse executionCourse = this.getExecutionCourse(); final InquiryResponsePeriod responsePeriod = executionCourse .getExecutionPeriod() .getInquiryResponsePeriod(InquiryResponsePeriodType.TEACHING); if (responsePeriod == null || !responsePeriod.isOpen() || !executionCourse.isAvailableForInquiry() || executionCourse.getStudentInquiriesCourseResults().isEmpty() || (!isResponsibleFor() && !hasAssociatedLessonsInTeachingServices())) { return false; } return true; }
public Set<Shift> findAvailableShifts( final CurricularYear curricularYear, final ExecutionSemester executionSemester) { final DegreeCurricularPlan degreeCurricularPlan = getDegreeCurricularPlan(); final Set<Shift> shifts = new HashSet<Shift>(); for (final CurricularCourse curricularCourse : degreeCurricularPlan.getCurricularCoursesSet()) { if (curricularCourse.hasScopeInGivenSemesterAndCurricularYearInDCP( curricularYear, degreeCurricularPlan, executionSemester)) { for (final ExecutionCourse executionCourse : curricularCourse.getAssociatedExecutionCoursesSet()) { if (executionCourse.getExecutionPeriod() == executionSemester) { shifts.addAll(executionCourse.getAssociatedShifts()); } } } } return shifts; }
@Atomic public static Professorship create( Boolean responsibleFor, ExecutionCourse executionCourse, Person person, Double hours) throws MaxResponsibleForExceed, InvalidCategory { for (final Professorship otherProfessorship : executionCourse.getProfessorshipsSet()) { if (person == otherProfessorship.getPerson()) { throw new DomainException("error.teacher.already.associated.to.professorship"); } } if (responsibleFor == null || executionCourse == null || person == null) { throw new NullPointerException(); } Professorship professorShip = new Professorship(); professorShip.setHours((hours == null) ? new Double(0.0) : hours); professorShip.setExecutionCourse(executionCourse); professorShip.setPerson(person); professorShip.setCreator(AccessControl.getPerson()); if (responsibleFor.booleanValue() && professorShip.getPerson().getTeacher() != null) { ResponsibleForValidator.getInstance() .validateResponsibleForList( professorShip.getPerson().getTeacher(), professorShip.getExecutionCourse(), professorShip); professorShip.setResponsibleFor(Boolean.TRUE); } else { professorShip.setResponsibleFor(Boolean.FALSE); } if (person.getTeacher() != null) { executionCourse.moveSummariesFromTeacherToProfessorship(person.getTeacher(), professorShip); } ProfessorshipManagementLog.createLog( professorShip.getExecutionCourse(), "resources.MessagingResources", "log.executionCourse.professorship.added", professorShip.getPerson().getPresentationName(), professorShip.getExecutionCourse().getNome(), professorShip.getExecutionCourse().getDegreePresentationString()); return professorShip; }