public void save() { TutorshipIntention intention = TutorshipIntention.readByDcpAndTeacherAndInterval(dcp, teacher, academicInterval); ExecutionYear executionYear = (ExecutionYear) ExecutionYear.getExecutionInterval(academicInterval); if (intention == null && intending) { new TutorshipIntention(dcp, teacher, academicInterval); ProgramTutoredParticipationLog.createLog( dcp.getDegree(), executionYear, Bundle.MESSAGING, "log.degree.programtutoredparticipation.addteacher", teacher.getPerson().getPresentationName(), dcp.getDegree().getPresentationName()); } else if (intention != null && !intending) { ProgramTutoredParticipationLog.createLog( dcp.getDegree(), executionYear, Bundle.MESSAGING, "log.degree.programtutoredparticipation.removeteacher", teacher.getPerson().getPresentationName(), dcp.getDegree().getPresentationName()); intention.delete(); } }
public TutorshipIntentionSelector( Teacher teacher, Department department, DegreeCurricularPlan dcp, AcademicInterval academicInterval) { this.teacher = teacher; this.department = department; this.dcp = dcp; this.academicInterval = academicInterval; TutorshipIntention intention = TutorshipIntention.readByDcpAndTeacherAndInterval(dcp, teacher, academicInterval); if (intention == null) { intending = false; deletable = true; } else { intending = true; deletable = intention.isDeletable(); } previousParticipations = teacher.getActiveTutorships(academicInterval.getPreviousAcademicInterval()).size(); }