course = DaoManager.getTimetableDao().getCourse(course, new String[] {TimetableDao.JOIN_GROUPS_SUBJECTS, TimetableDao.JOIN_TEACHERS_DIRECTING});   UnavailabilityFilter filter = new UnavailabilityFilter(); filter.setIdCourse(course.getIdCourse()); DaoManager.getAvailabilityDao().removeUnavailability(filter);
    public void actionPerformed(ActionEvent arg0) {        Subject subject = mainFrame.getSubjectSelected();        if (subject == null)            return;                int select = JOptionPane.showConfirmDialog(null, "Voulez-vous vraiment supprimer la matire '"+subject.getHeading()+"'", "Confirmation", JOptionPane.YES_NO_OPTION);        if (select == JOptionPane.YES_OPTION) {            Timetable timetable = mainFrame.getModel().getTimetable();            Collection courses = timetable.getCourses(subject);            try {                if (courses.size() > 0) {                    select = JOptionPane.showConfirmDialog(null, "Des cours sont lis  cette matire.\nLa suppression de la matire supprima aussi les cours lis.\nContinuer ?", "Confirmation", JOptionPane.YES_NO_OPTION);                    if (select == JOptionPane.NO_OPTION)                        return;                    for (Iterator i = courses.iterator(); i.hasNext(); ) {                        Course course = (Course) i.next();                        DaoManager.getTimetableDao().removeCourse(course);                    }                }                   DaoManager.getTimetableDao().removeSubject(subject);                                JOptionPane.showMessageDialog(null, "Suppression effectue avec succs", "Information", JOptionPane.INFORMATION_MESSAGE);            } catch (Exception e) {                e.printStackTrace();                JOptionPane.showMessageDialog(null, "Une erreur interne est survenue", "Erreur", JOptionPane.ERROR_MESSAGE);            }        }    }