Package org.motechproject.mots.service
Class ModuleService
- java.lang.Object
-
- org.motechproject.mots.service.ModuleService
-
@Service public class ModuleService extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ModuleService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ModuleDtocopyModule(java.util.UUID id)Copy Module as a new draft.CourseDtocreateCourse()Create new Course.ModuleDtocreateModule(ModuleDto moduleDto)Create new Module.CoursefindCourseById(java.util.UUID id)CourseModulefindReleasedCourseModuleByModuleId(java.util.UUID id)Find released Course Module for Module with given Id.java.util.List<CourseDto>getCourses()CoursegetReleasedCourse()Get released Course.java.util.List<ModuleSimpleDto>getReleasedModules()Get modules from released course.CourseDtoreleaseCourse(Course course)Release Course.CourseDtoupdateCourse(java.util.UUID id, CourseDto courseDto)Update existing Course.ModuleDtoupdateModule(java.util.UUID id, ModuleDto moduleDto)Update existing Module.
-
-
-
Method Detail
-
getCourses
@PreAuthorize("hasAnyRole(\'ROLE_ASSIGN_MODULES\',\'ROLE_MANAGE_MODULES\',\'ROLE_DISPLAY_MODULES\')") public java.util.List<CourseDto> getCourses()
-
getReleasedModules
@PreAuthorize("hasAnyRole(\'ROLE_ASSIGN_MODULES\',\'ROLE_MANAGE_MODULES\',\'ROLE_DISPLAY_MODULES\')") public java.util.List<ModuleSimpleDto> getReleasedModules()Get modules from released course.- Returns:
- released modules
-
createModule
@Transactional @PreAuthorize("hasRole(\'ROLE_MANAGE_MODULES\')") public ModuleDto createModule(ModuleDto moduleDto)Create new Module.- Parameters:
moduleDto- DTO of Module to be created- Returns:
- Created Module
-
updateModule
@PreAuthorize("hasRole(\'ROLE_MANAGE_MODULES\')") public ModuleDto updateModule(java.util.UUID id, ModuleDto moduleDto)Update existing Module.- Parameters:
id- id of Module to be updatedmoduleDto- Module DTO- Returns:
- updated Module
-
copyModule
@PreAuthorize("hasRole(\'ROLE_MANAGE_MODULES\')") public ModuleDto copyModule(java.util.UUID id)Copy Module as a new draft.- Parameters:
id- id of module to be copied- Returns:
- copied module draft
-
createCourse
@Transactional @PreAuthorize("hasRole(\'ROLE_MANAGE_MODULES\')") public CourseDto createCourse()Create new Course.- Returns:
- Created Course
-
updateCourse
@PreAuthorize("hasRole(\'ROLE_MANAGE_MODULES\')") public CourseDto updateCourse(java.util.UUID id, CourseDto courseDto)Update existing Course.- Parameters:
id- id of Course to be updatedcourseDto- Course DTO- Returns:
- updated Course
-
releaseCourse
@PreAuthorize("hasRole(\'ROLE_MANAGE_MODULES\')") public CourseDto releaseCourse(Course course)Release Course. First unassign old modules, then update the module progress and update ivr main menu treeIvrConfigService.updateMainMenuTreeId(java.lang.String).- Parameters:
course- Course to be released- Returns:
- released course dto
-
findCourseById
public Course findCourseById(java.util.UUID id)
-
findReleasedCourseModuleByModuleId
public CourseModule findReleasedCourseModuleByModuleId(java.util.UUID id)
Find released Course Module for Module with given Id.- Parameters:
id- id of related Module- Returns:
- Course Module with given Module
-
getReleasedCourse
public Course getReleasedCourse()
Get released Course.- Returns:
- Course with released status
- Throws:
EntityNotFoundException- if course is not found.
-
-