@RequestMapping(
     value = {"/courses/{courseId}/groups"},
     method = RequestMethod.GET)
 public List<GroupNameJsonDto> getAllGroupsByCourseId(@PathVariable Long courseId) {
   return dtoService.convert(
       groupService.getAllByCourseId(courseId), GroupNameJsonDto.class, Group.class);
 }
 @RequestMapping(
     value = {"/courses/{courseId}/modules"},
     method = RequestMethod.GET)
 public List<ModuleJsonDto> getModules(@PathVariable Long courseId) {
   return dtoService.convert(
       moduleService.getAllByCourseId(courseId), ModuleJsonDto.class, Module.class);
 }
 @RequestMapping(
     value = {"/modules/{moduleId}/resources", "/courses/{courseId}/modules/{moduleId}/resources"},
     method = RequestMethod.GET)
 public List<ResourceJsonDto> getResources(@PathVariable Long moduleId) {
   return dtoService.convert(
       resourceService.getAllByModuleId(moduleId), ResourceJsonDto.class, Resource.class);
 }
 @RequestMapping(
     value = {"/modules/{moduleId}/tests", "/courses/{courseId}/modules/{moduleId}/tests"},
     method = RequestMethod.GET)
 public List<TestJsonDto> getTests(@PathVariable Long moduleId) {
   return dtoService.convert(
       testService.getAllByModuleId(moduleId), TestJsonDto.class, Test.class);
 }
 @RequestMapping(
     value = {"/areas"},
     method = RequestMethod.GET)
 public List<AreaJsonDto> getAreas(HttpServletResponse response) {
   List<AreaJsonDto> dtos =
       dtoService.convert(areaService.getAll(), AreaJsonDto.class, Area.class);
   response.addIntHeader("X-Total-Count", dtos.size());
   return dtos;
 }
 // resources REST
 @RequestMapping(
     value = {"/resources/notAssociatedWith/modules/{moduleId}"},
     method = RequestMethod.GET)
 public List<ResourceJsonDto> getAllResourcesNotAssociatedWithModule(@PathVariable Long moduleId) {
   return dtoService.convert(
       resourceService.getAllNotAssociatedWithModule(moduleId),
       ResourceJsonDto.class,
       Resource.class);
 }
 @RequestMapping(
     value = {
       "/resources/{resourceId}",
       "/courses/{courseId}/modules/{moduleId}/resources/{resourceId}"
     },
     method = RequestMethod.GET)
 public ResourceJsonDto getResource(@PathVariable Long resourceId) {
   return dtoService.convert(
       resourceService.getById(resourceId), ResourceJsonDto.class, Resource.class);
 }
 @RequestMapping(
     value = {"/courses/{courseId}"},
     method = RequestMethod.GET)
 public CourseJsonDto getCourse(@PathVariable Long courseId) {
   return dtoService.convert(courseService.getById(courseId), CourseJsonDto.class, Course.class);
 }
 @RequestMapping(
     value = {"/courses"},
     method = RequestMethod.GET)
 public List<CourseJsonDto> getCourses() {
   return dtoService.convert(courseService.getAll(), CourseJsonDto.class, Course.class);
 }
Exemplo n.º 10
0
 @RequestMapping(
     value = {"/areas/{areaId}"},
     method = RequestMethod.GET)
 public AreaJsonDto getArea(@PathVariable Long areaId) {
   return dtoService.convert(areaService.getById(areaId), AreaJsonDto.class, Area.class);
 }
Exemplo n.º 11
0
 // Group REST
 @RequestMapping(
     value = {"/groups"},
     method = RequestMethod.GET)
 public List<GroupNameJsonDto> getAllGroups() {
   return dtoService.convert(groupService.getAll(), GroupNameJsonDto.class, Group.class);
 }
Exemplo n.º 12
0
 @RequestMapping(
     value = {"/tests/{testId}", "/courses/{courseId}/modules/{moduleId}/tests/{testId}"},
     method = RequestMethod.GET)
 public TestJsonDto getTest(@PathVariable Long testId) {
   return dtoService.convert(testService.getById(testId), TestJsonDto.class, Test.class);
 }
Exemplo n.º 13
0
 @RequestMapping(
     value = {"/modules/{moduleId}", "/courses/{courseId}/modules/{moduleId}"},
     method = RequestMethod.GET)
 public ModuleJsonDto getModule(@PathVariable Long moduleId) {
   return dtoService.convert(moduleService.getById(moduleId), ModuleJsonDto.class, Module.class);
 }