コード例 #1
0
 private void createOfficeHours(Instructor instructor) {
   for (EventInformation eventInformation : instructor.getOfficeHours()) {
     Long eventInformationId = commonDao.getEventInformationId(eventInformation);
     if (eventInformationId == null) {
       commonDao.createEventInformation(eventInformation);
       eventInformationId = commonDao.getEventInformationId(eventInformation);
     }
     commonDao.createOfficeHours(instructor.getId(), eventInformationId);
   }
 }
コード例 #2
0
 private void createMeetingHours(Course course) {
   for (EventInformation eventInformation : course.getMeetingHours()) {
     Long eventInformationId = commonDao.getEventInformationId(eventInformation);
     if (eventInformationId == null) {
       commonDao.createEventInformation(eventInformation);
       eventInformationId = commonDao.getEventInformationId(eventInformation);
     }
     commonDao.createMeetingHours(course.getId(), eventInformationId);
   }
 }
コード例 #3
0
  public Instructor update(Instructor instructor) {
    instructorVerifier.verifyOnUpdate(instructor);
    Long locationId = commonDao.provideCourseLocation(instructor.getOffice());

    instructorDao.update(instructor, locationId);

    commonDao.deleteAllOfficeHoursForInstructor(instructor.getId());
    createOfficeHours(instructor);

    return instructorDao.getById(instructor.getId());
  }
コード例 #4
0
  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());
  }
コード例 #5
0
 public Instructor create(Instructor instructor) {
   instructorVerifier.verifyOnCreate(instructor);
   Long locationId = commonDao.provideCourseLocation(instructor.getOffice());
   instructorDao.create(instructor, locationId);
   createOfficeHours(instructor);
   return instructorDao.getById(instructor.getId());
 }
コード例 #6
0
  public void delete(Course course) {

    courseVerifier.verifyCourseOnDelete(course);

    commonDao.deleteAllMeetingHoursForCourse(course.getId());
    courseDao.delete(course.getId());
  }
コード例 #7
0
  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());
  }
コード例 #8
0
 public void delete(Instructor instructor) {
   instructorVerifier.verifyOnDelete(instructor);
   commonDao.deleteAllOfficeHoursForInstructor(instructor.getId());
   instructorDao.delete(instructor.getId());
 }