List<Course> courseList = schedule.getCourseList();
List<Lecture> lectureList = new ArrayList<Lecture>(courseList.size());
long id = 0L;
for (Course course : courseList) {
for (int i = 0; i < course.getLectureSize(); i++) {
Lecture lecture = new Lecture();
lecture.setId((long) id);
id++;
lecture.setCourse(course);
lecture.setLectureIndexInCourse(i);
lecture.setLocked(false);
// Notice that we leave the PlanningVariable properties on null
lectureList.add(lecture);
}
}
schedule.setLectureList(lectureList);