Class CourseService

java.lang.Object
com.ericbouchut.learndev.course.CourseService

@Service @Transactional(readOnly=true) public class CourseService extends Object
Read side of the course catalogue, applying the student visibility rule: a student sees PUBLISHED courses; a student who is enrolled keeps read access to the course and its published lessons if the course is later ARCHIVED (content continuity); DRAFT content is never visible to students. Invisible content surfaces as 404, not 403, so the URL space does not leak which drafts exist.
  • Constructor Details

  • Method Details

    • catalogue

      public List<Course> catalogue()
      The public catalogue: published courses only.
    • visibleCourse

      public Course visibleCourse(Long courseId, User student)
      The course as visible to the given student, or 404 when the course does not exist or the visibility rule (see class Javadoc) hides it.
    • publishedLessons

      public List<Lesson> publishedLessons(Course course)
      The lessons of a course a student may read, in reading order.
    • publishedLesson

      public Lesson publishedLesson(Course course, Long lessonId)
      One published lesson of the given course, or 404 when the lesson does not exist, is not published, or belongs to another course.