public void delete(Course course) { courseVerifier.verifyCourseOnDelete(course); commonDao.deleteAllMeetingHoursForCourse(course.getId()); courseDao.delete(course.getId()); }
public List<Student> getStudentsByCourse(Course course) { courseVerifier.verifyCourseExists(course); List<Student> students = studentDao.getStudentsByCourse(course.getId()); if (students.size() == 0) { logger.info("No students enrolled in this course were found"); } return students; }
public Course create(Course course, Instructor instructor) { courseVerifier.verifyCourseOnCreate(course, instructor); Long locationId = commonDao.provideCourseLocation(course.getLocation()); Course newlyCreatedCourse = courseDao.create(course, instructor.getId(), locationId); createMeetingHours(course); return courseDao.getById(newlyCreatedCourse.getId()); }
public Instructor getInstructorByCourse(Course course) { courseVerifier.verifyCourseExists(course); Instructor instructor = instructorDao.getInstructorByCourse(course.getId()); if (instructor == null) { logger.error("The course doesn't have an instructor. This shouldn't have happened"); throw new GeneralException( "The course doesn't have an instructor. This shouldn't have happened"); } return instructor; }
public Course update(Course course) { courseVerifier.verifyCourseOnUpdate(course); commonDao.deleteAllMeetingHoursForCourse(course.getId()); Long locationId = commonDao.provideCourseLocation(course.getLocation()); courseDao.update(course, locationId); createMeetingHours(course); return courseDao.getById(course.getId()); }
public void updateInstructor(Course course, Instructor instructor) { courseVerifier.verifyUpdateInstructor(course, instructor); courseDao.updateInstructor(course.getId(), instructor.getId()); }
public void unEnrollStudent(Course course, Student student) { courseVerifier.verifyUnenrollStudent(course, student); courseDao.unenrollStudent(course.getId(), student.getId()); }