MTrainingService

public interface MTrainingService

Service interface for mTraining. Contains APIs to perform CRUD operations on Course and related objects like chapters, lessons, quiz, etc.

Methods

createChapter

Chapter createChapter(Chapter chapter)

Creates a chapter.

Parameters:
  • chapter – chapter to create
Returns:

chapter created in the store

createCourse

Course createCourse(Course course)

Creates a course with the given structure.

Parameters:
  • course – course object to store
Returns:

Course object created in the store

createLesson

Lesson createLesson(Lesson lesson)

Creates a lesson.

Parameters:
  • lesson – lesson to create in store
Returns:

stored lesson from store

createQuiz

Quiz createQuiz(Quiz quiz)

Creates a quiz.

Parameters:
  • quiz – New quiz object to store
Returns:

quiz object from store

deleteChapter

void deleteChapter(long chapterId)

Deletes a chapter by id.

Parameters:
  • chapterId – id of the chapter to delete

deleteCourse

void deleteCourse(long courseId)

Deletes the course with the given id

Parameters:
  • courseId – ID of the course to delete

deleteLesson

void deleteLesson(long lessonId)

Deletes a lesson with a given id.

Parameters:
  • lessonId – id of the lesson to delete

deleteQuiz

void deleteQuiz(long quizId)

Deletes a quiz with id.

Parameters:
  • quizId – id of the quiz to delete

getAllChapters

List<Chapter> getAllChapters()

Get all chapters.

Returns:list of chapters

getAllCourses

List<Course> getAllCourses()

Gets all courses.

Returns:list of courses

getAllLessons

List<Lesson> getAllLessons()

Gets all lessons.

Returns:list of lessons

getAllQuizzes

List<Quiz> getAllQuizzes()

Gets all quizzes.

Returns:list of quizzes

getChapterById

Chapter getChapterById(long chapterId)

Gets chapters from store by ID.

Parameters:
  • chapterId – the chapter ID
Returns:

Chapter with id

getChaptersByName

List<Chapter> getChaptersByName(String chapterName)

Gets chapters that match the name.

Parameters:
  • chapterName – name of the chapter
Returns:

list of chapters with matching name

getChaptersByProperties

List<Chapter> getChaptersByProperties(Map<String, String> properties)

Gets chapters that contains the given properties.

Parameters:
  • properties – the properties
Returns:

list of chapters that contains the given properties

getCourseById

Course getCourseById(long courseId)

Retrieves a course with the given course id.

Parameters:
  • courseId – id of the course to retrieve
Returns:

the course with the given id, or null if it does not exist

getCoursesByName

List<Course> getCoursesByName(String courseName)

Gets courses that match the name.

Parameters:
  • courseName – name of the course
Returns:

list of courses that match the course name

getCoursesByProperties

List<Course> getCoursesByProperties(Map<String, String> properties)

Gets courses that contains the given properties.

Parameters:
  • properties – the properties
Returns:

list of courses that contains the given properties

getLessonById

Lesson getLessonById(long id)

Gets lesson by id.

Parameters:
  • id – id of the lesson
Returns:

lesson with id

getLessonsByName

List<Lesson> getLessonsByName(String lessonName)

Gets lessons that match the name.

Parameters:
  • lessonName – name of the lesson
Returns:

list of lessons with matching name

getLessonsByProperties

List<Lesson> getLessonsByProperties(Map<String, String> properties)

Gets lessons that contains the given properties.

Parameters:
  • properties – the properties
Returns:

list of lessons that contains the given properties

getQuizById

Quiz getQuizById(long id)

Gets a quiz by id.

Parameters:
  • id – Id of the quiz
Returns:

quiz object with id

getQuizForChapter

Quiz getQuizForChapter(long chapterId)

Gets the quiz for a given chapter.

Parameters:
  • chapterId – chapter id to retrieve quiz for
Returns:

Quiz object for the chapter

getQuizzesByName

List<Quiz> getQuizzesByName(String quizName)

Gets a quizzes that match the name.

Parameters:
  • quizName – name of the quiz
Returns:

list of quiz objects with the given name

getQuizzesByProperties

List<Quiz> getQuizzesByProperties(Map<String, String> properties)

Gets quizzes that contains the given properties.

Parameters:
  • properties – the properties
Returns:

list of quizzes that contains the given properties

getUnusedChapters

List<Chapter> getUnusedChapters()

Gets chapters that are not used by any Course.

Returns:list of chapters that are not used

getUnusedLessons

List<Lesson> getUnusedLessons()

Gets lessons that are not used by any Chapter.

Returns:list of lessons that are not used

getUnusedQuizzes

List<Quiz> getUnusedQuizzes()

Gets quizzes that are not used by any Chapter.

Returns:list of quizzes that are not used

updateChapter

Chapter updateChapter(Chapter chapter)

Updates a given chapter.

Parameters:
  • chapter – chapter to update
Returns:

updated chapter from the store

updateCourse

Course updateCourse(Course course)

Updates a course with the given structure

Parameters:
  • course – Course structure to update
Returns:

the newly updated course

updateLesson

Lesson updateLesson(Lesson lesson)

Updates a lesson in the store.

Parameters:
  • lesson – lesson to update
Returns:

updated lesson from store

updateQuiz

Quiz updateQuiz(Quiz quiz)

Updates a quiz object in store.

Parameters:
  • quiz – quiz object to update
Returns:

updated quiz object from store