@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); }
// 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 = {"/modules/{moduleId}/resources/addexisting/{resourceId}"}, method = RequestMethod.POST) public void addExistingResourceToModule( @PathVariable Long moduleId, @PathVariable Long resourceId, HttpServletResponse response) throws IOException, RestAjaxInternalServerException { try { moduleService.addExistingResource(moduleId, resourceService.getById(resourceId)); } catch (Exception e) { throw new RestAjaxInternalServerException(e.getMessage(), e); } }