@Test public void shouldSubmitPOD() throws Exception { Long podId = 4L; OrderPOD orderPOD = new OrderPOD(); orderPOD.setId(podId); when(service.submit(podId, USER_ID)).thenReturn(orderPOD); ResponseEntity<OpenLmisResponse> response = controller.submit(podId, request); verify(service).submit(podId, USER_ID); assertThat(response.getBody().getSuccessMsg(), is("msg.pod.submit.success")); }
@RequestMapping(value = "/pods/submit/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") public ResponseEntity<OpenLmisResponse> submit(@PathVariable Long id, HttpServletRequest request) { try { service.submit(id, loggedInUserId(request)); return success("msg.pod.submit.success"); } catch (DataException exception) { return error(exception, HttpStatus.BAD_REQUEST); } }
PODController extends BaseController { @RequestMapping(value = "/pods/submit/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") public ResponseEntity<OpenLmisResponse> submit(@PathVariable Long id, HttpServletRequest request) { try { service.submit(id, loggedInUserId(request)); return success("msg.pod.submit.success"); } catch (DataException exception) { return error(exception, HttpStatus.BAD_REQUEST); } } }
PODController extends BaseController { @RequestMapping(value = "/pods/submit/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") public ResponseEntity<OpenLmisResponse> submit(@PathVariable Long id, HttpServletRequest request) { try { service.submit(id, loggedInUserId(request)); return success("msg.pod.submit.success"); } catch (DataException exception) { return error(exception, HttpStatus.BAD_REQUEST); } }  }
PODController extends BaseController { @RequestMapping(value = "/pods/submit/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") public ResponseEntity<OpenLmisResponse> submit(@PathVariable Long id, HttpServletRequest request) { try { service.submit(id, loggedInUserId(request)); return success("msg.pod.submit.success"); } catch (DataException exception) { return error(exception, HttpStatus.BAD_REQUEST); } }  @RequestMapping(value = "/pods", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") ResponseEntity<OpenLmisResponse> createPOD(@RequestParam Long orderId,
                                                    HttpServletRequest request); @RequestMapping(value = "/pods/{id}", method = GET, headers = ACCEPT_JSON) @PostAuthorize("@fulfillmentPermissionService.hasPermission(principal, returnObject.body.data.get(\"order\").getId(), 'MANAGE_POD')") ResponseEntity<OpenLmisResponse> getPOD(@PathVariable("id") Long podId); @RequestMapping(value = "/pods/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") ResponseEntity<OpenLmisResponse> save(@RequestBody OrderPOD orderPOD, @PathVariable Long id, HttpServletRequest request); @RequestMapping(value = "/pods/submit/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") ResponseEntity<OpenLmisResponse> submit(@PathVariable Long id, HttpServletRequest request); @RequestMapping(value = "/pods/{id}/print", method = GET, headers = ACCEPT_JSON) ModelAndView print(@PathVariable Long id); }
PODController extends BaseController { @RequestMapping(value = "/pods/submit/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") public ResponseEntity<OpenLmisResponse> submit(@PathVariable Long id, HttpServletRequest request) { try { service.submit(id, loggedInUserId(request)); return success("msg.pod.submit.success"); } catch (DataException exception) { return error(exception, HttpStatus.BAD_REQUEST); } }  @RequestMapping(value = "/pods", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") ResponseEntity<OpenLmisResponse> createPOD(@RequestParam Long orderId,
                                                    HttpServletRequest request); @RequestMapping(value = "/pods/{id}", method = GET, headers = ACCEPT_JSON) @PostAuthorize("@fulfillmentPermissionService.hasPermission(principal, returnObject.body.data.get(\"order\").getId(), 'MANAGE_POD')") ResponseEntity<OpenLmisResponse> getPOD(@PathVariable("id") Long podId); @RequestMapping(value = "/pods/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") ResponseEntity<OpenLmisResponse> save(@RequestBody OrderPOD orderPOD, @PathVariable Long id, HttpServletRequest request); @RequestMapping(value = "/pods/submit/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") ResponseEntity<OpenLmisResponse> submit(@PathVariable Long id, HttpServletRequest request); @RequestMapping(value = "/pods/{id}/print", method = GET, headers = ACCEPT_JSON) ModelAndView print(@PathVariable Long id); static final String ORDER_POD; static final String ORDER; static final String RECEIVED_DATE; static final String PRINT_POD; }