@Override public CourseBean getCourse(Integer id) throws GenericBusinessException { CourseService courseService = new CourseService(); Course newCourse = courseService.getCourse(id); return new CourseBean(newCourse); }
@Override public int getCourseListSize() throws GenericBusinessException { CourseService courseService = new CourseService(); int courseSize = courseService.getCourseListSize(); return courseSize; }
@Override public void saveCourse(CourseBean model) throws GenericBusinessException { Course course = new CourseBean().toEntity(model); CourseService courseService = new CourseService(); courseService.saveCourse(course); }
@Override public CourseBean addCourse(CourseBean model) throws GenericBusinessException { Course course = new CourseBean().toEntity(model); CourseService courseService = new CourseService(); courseService.addCourse(course); return getCourse(course.getPrimaryKey()); }
@Override public List<CourseBean> getCourseList() throws GenericBusinessException { CourseService courseService = new CourseService(); List list = courseService.getCourseList(); List<CourseBean> list1 = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { list1.add(new CourseBean((Course) list.get(i))); } return list1; }
@Override public List<CourseBean> findCourseBySemester(Integer semester) throws GenericBusinessException { CourseService courseService = new CourseService(); List list = courseService.findCourseBySemester(semester); List<CourseBean> list1 = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { list1.add(new CourseBean((Course) list.get(i))); } return list1; }
@Override public List<CourseBean> findCourseByAcceptingDept(String acceptingDept) throws GenericBusinessException { CourseService courseService = new CourseService(); List list = courseService.findCourseByAcceptingDept(acceptingDept); List<CourseBean> list1 = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { list1.add(new CourseBean((Course) list.get(i))); } return list1; }
@Override public List<CourseBean> getCourseList(int startIndex, int endIndex) throws GenericBusinessException { if (startIndex < 1) { startIndex = 1; } if ((endIndex - startIndex) < 0) { // Just return an empty list. return new ArrayList(); } CourseService courseService = new CourseService(); List list = courseService.getCourseList(startIndex, endIndex); List<CourseBean> list1 = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { list1.add(new CourseBean((Course) list.get(i))); } return list1; }
@Override public void deleteCourse(Integer id) throws GenericBusinessException { CourseService courseService = new CourseService(); courseService.deleteCourse(id); }