@Test public void shouldGetASchedule() throws Exception { ProcessingSchedule processingSchedule = new ProcessingSchedule(); when(processingScheduleService.get(1L)).thenReturn(processingSchedule); ResponseEntity<OpenLmisResponse> responseEntity = processingScheduleController.get(1L); Map<String, Object> responseEntityData = responseEntity.getBody().getData(); assertThat((ProcessingSchedule) responseEntityData.get(SCHEDULE), is(processingSchedule)); }
@RequestMapping(value = "/schedules/{id}", method = RequestMethod.GET, headers = "Accept=application/json") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") public ResponseEntity<OpenLmisResponse> get(@PathVariable("id") Long id) { try { ProcessingSchedule processingSchedule = processingScheduleService.get(id); return OpenLmisResponse.response(SCHEDULE, processingSchedule); } catch (DataException e) { return error(e, HttpStatus.NOT_FOUND); } }
ProcessingScheduleController extends BaseController { @RequestMapping(value = "/schedules/{id}", method = RequestMethod.GET, headers = "Accept=application/json") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") public ResponseEntity<OpenLmisResponse> get(@PathVariable("id") Long id) { try { ProcessingSchedule processingSchedule = processingScheduleService.get(id); return OpenLmisResponse.response(SCHEDULE, processingSchedule); } catch (DataException e) { return error(e, HttpStatus.NOT_FOUND); } } }
ProcessingScheduleController extends BaseController { @RequestMapping(value = "/schedules/{id}", method = RequestMethod.GET, headers = "Accept=application/json") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") public ResponseEntity<OpenLmisResponse> get(@PathVariable("id") Long id) { try { ProcessingSchedule processingSchedule = processingScheduleService.get(id); return OpenLmisResponse.response(SCHEDULE, processingSchedule); } catch (DataException e) { return error(e, HttpStatus.NOT_FOUND); } }  }
ProcessingScheduleController extends BaseController { @RequestMapping(value = "/schedules/{id}", method = RequestMethod.GET, headers = "Accept=application/json") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") public ResponseEntity<OpenLmisResponse> get(@PathVariable("id") Long id) { try { ProcessingSchedule processingSchedule = processingScheduleService.get(id); return OpenLmisResponse.response(SCHEDULE, processingSchedule); } catch (DataException e) { return error(e, HttpStatus.NOT_FOUND); } }  @RequestMapping(value = "/schedules", method = RequestMethod.GET, headers = "Accept=application/json") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE, MANAGE_REQUISITION_GROUP')") ResponseEntity<OpenLmisResponse> getAll(); @RequestMapping(value = "/schedules", method = RequestMethod.POST, headers = "Accept=application/json") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") ResponseEntity<OpenLmisResponse> create(@RequestBody ProcessingSchedule processingSchedule, HttpServletRequest request); @RequestMapping(value = "/schedules/{id}", method = RequestMethod.PUT, headers = "Accept=application/json") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") ResponseEntity<OpenLmisResponse> update(@RequestBody ProcessingSchedule processingSchedule, @PathVariable("id") Long id, HttpServletRequest request); @RequestMapping(value = "/schedules/{id}", method = RequestMethod.GET, headers = "Accept=application/json") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") ResponseEntity<OpenLmisResponse> get(@PathVariable("id") Long id); }
ProcessingScheduleController extends BaseController { @RequestMapping(value = "/schedules/{id}", method = RequestMethod.GET, headers = "Accept=application/json") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") public ResponseEntity<OpenLmisResponse> get(@PathVariable("id") Long id) { try { ProcessingSchedule processingSchedule = processingScheduleService.get(id); return OpenLmisResponse.response(SCHEDULE, processingSchedule); } catch (DataException e) { return error(e, HttpStatus.NOT_FOUND); } }  @RequestMapping(value = "/schedules", method = RequestMethod.GET, headers = "Accept=application/json") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE, MANAGE_REQUISITION_GROUP')") ResponseEntity<OpenLmisResponse> getAll(); @RequestMapping(value = "/schedules", method = RequestMethod.POST, headers = "Accept=application/json") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") ResponseEntity<OpenLmisResponse> create(@RequestBody ProcessingSchedule processingSchedule, HttpServletRequest request); @RequestMapping(value = "/schedules/{id}", method = RequestMethod.PUT, headers = "Accept=application/json") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") ResponseEntity<OpenLmisResponse> update(@RequestBody ProcessingSchedule processingSchedule, @PathVariable("id") Long id, HttpServletRequest request); @RequestMapping(value = "/schedules/{id}", method = RequestMethod.GET, headers = "Accept=application/json") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") ResponseEntity<OpenLmisResponse> get(@PathVariable("id") Long id); static final String SCHEDULES; static final String SCHEDULE; }