@Test public void shouldGetPeriodById() throws Exception { ProcessingPeriod period = new ProcessingPeriod(); when(service.getPeriodById(1L)).thenReturn(period); ResponseEntity<OpenLmisResponse> response = controller.get(1L); verify(service).getPeriodById(1L); assertThat((ProcessingPeriod) response.getBody().getData().get("period"), is(period)); }
@RequestMapping(value = "/periods/{id}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DISTRIBUTION')") public ResponseEntity<OpenLmisResponse> get(@PathVariable("id") Long id) { ProcessingPeriod processingPeriod = processingScheduleService.getPeriodById(id); return response("period", processingPeriod); }
ProcessingPeriodController extends BaseController { @RequestMapping(value = "/periods/{id}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DISTRIBUTION')") public ResponseEntity<OpenLmisResponse> get(@PathVariable("id") Long id) { ProcessingPeriod processingPeriod = processingScheduleService.getPeriodById(id); return response("period", processingPeriod); } }
ProcessingPeriodController extends BaseController { @RequestMapping(value = "/periods/{id}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DISTRIBUTION')") public ResponseEntity<OpenLmisResponse> get(@PathVariable("id") Long id) { ProcessingPeriod processingPeriod = processingScheduleService.getPeriodById(id); return response("period", processingPeriod); }  }
ProcessingPeriodController extends BaseController { @RequestMapping(value = "/periods/{id}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DISTRIBUTION')") public ResponseEntity<OpenLmisResponse> get(@PathVariable("id") Long id) { ProcessingPeriod processingPeriod = processingScheduleService.getPeriodById(id); return response("period", processingPeriod); }  @RequestMapping(value = "/schedules/{scheduleId}/periods", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") ResponseEntity<OpenLmisResponse> getAll(@PathVariable("scheduleId") Long scheduleId); @RequestMapping(value = "/schedules/{scheduleId}/periods", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") ResponseEntity<OpenLmisResponse> save(@PathVariable("scheduleId") Long scheduleId, @RequestBody ProcessingPeriod processingPeriod, HttpServletRequest request); @RequestMapping(value = "/periods/{id}", method = DELETE, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") ResponseEntity<OpenLmisResponse> delete(@PathVariable("id") Long id); @RequestMapping(value = "/periods/{id}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DISTRIBUTION')") ResponseEntity<OpenLmisResponse> get(@PathVariable("id") Long id); }
ProcessingPeriodController extends BaseController { @RequestMapping(value = "/periods/{id}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DISTRIBUTION')") public ResponseEntity<OpenLmisResponse> get(@PathVariable("id") Long id) { ProcessingPeriod processingPeriod = processingScheduleService.getPeriodById(id); return response("period", processingPeriod); }  @RequestMapping(value = "/schedules/{scheduleId}/periods", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") ResponseEntity<OpenLmisResponse> getAll(@PathVariable("scheduleId") Long scheduleId); @RequestMapping(value = "/schedules/{scheduleId}/periods", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") ResponseEntity<OpenLmisResponse> save(@PathVariable("scheduleId") Long scheduleId, @RequestBody ProcessingPeriod processingPeriod, HttpServletRequest request); @RequestMapping(value = "/periods/{id}", method = DELETE, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_SCHEDULE')") ResponseEntity<OpenLmisResponse> delete(@PathVariable("id") Long id); @RequestMapping(value = "/periods/{id}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DISTRIBUTION')") ResponseEntity<OpenLmisResponse> get(@PathVariable("id") Long id); static final String PERIODS; static final String NEXT_START_DATE; }