//********************************
// Third get basic course details
CoursesJpaController coursesJpaController = new CoursesJpaController();
Courses course = coursesJpaController.findCourses(courseID);
courseDetailMap.put("courseID", new Integer(courseID));
courseDetailMap.put("courseName", new String(course.getName()));
courseDetailMap.put("courseDescription", new String(course.getDescription()));
courseDetailMap.put("courseCreatorName", new String(course.getCreaterUserId().getName()));
//********************************
// Forth get rating
List<Enrollment> enrollmentList = enrollmentJpaController.findEnrollmentEntitiesWithCourseID(courseID);
List<Courserates> courseRatesList = new ArrayList<Courserates>();
for (Iterator<Enrollment> it = enrollmentList.iterator(); it.hasNext();) {
Enrollment tempEnrollment = it.next();
if (tempEnrollment.getCourserates() != null) {
courseRatesList.add(tempEnrollment.getCourserates());
}
}
Float totalRating = 0.f;
for (Iterator<Courserates> it = courseRatesList.iterator(); it.hasNext();) {
Courserates tempCourseRate = it.next();
totalRating += tempCourseRate.getPoints().floatValue();
}
if (!courseRatesList.isEmpty()) {
totalRating /= courseRatesList.size();
}
courseDetailMap.put("courseRating", new Float(totalRating.floatValue()));
//********************************
// Fifth get course tags
List<Coursetag> courseTagList = course.getCoursetagList();
ArrayList tagMapList = new ArrayList();
for (Iterator<Coursetag> it = courseTagList.iterator(); it.hasNext();) {
Coursetag coursetag = it.next();
Map courseTagMap = new HashMap();
courseTagMap.put("tagID", new Integer(coursetag.getTagId().getId()));
courseTagMap.put("tagName", new String(coursetag.getTagId().getTagName()));
tagMapList.add(courseTagMap);
}
courseDetailMap.put("courseTags", tagMapList);
//********************************
//Sixth get lecture list
List<Lecture> lectureList = course.getLectureList();
ArrayList lectureMapList = new ArrayList();
for (Iterator<Lecture> it = lectureList.iterator(); it.hasNext();) {
Lecture lecture = it.next();
Map lectureMap = new HashMap();