@Test public void shouldGetDetailsForDonor() throws Exception { Donor donor = makeADonor(); when(donorService.getById(25L)).thenReturn(donor); ResponseEntity<OpenLmisResponse> response = controller.getDetailsForDonor(25L); assertThat(donor, is(response.getBody().getData().get("donor"))); }
@RequestMapping(value="getDetails/{id}",method = GET,headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DONOR')") public ResponseEntity<OpenLmisResponse> getDetailsForDonor(@PathVariable(value="id") Long id){ return OpenLmisResponse.response(DONOR,donorService.getById(id)); }
DonorController extends BaseController { @RequestMapping(value="getDetails/{id}",method = GET,headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DONOR')") public ResponseEntity<OpenLmisResponse> getDetailsForDonor(@PathVariable(value="id") Long id){ return OpenLmisResponse.response(DONOR,donorService.getById(id)); } }
DonorController extends BaseController { @RequestMapping(value="getDetails/{id}",method = GET,headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DONOR')") public ResponseEntity<OpenLmisResponse> getDetailsForDonor(@PathVariable(value="id") Long id){ return OpenLmisResponse.response(DONOR,donorService.getById(id)); }  }
DonorController extends BaseController { @RequestMapping(value="getDetails/{id}",method = GET,headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DONOR')") public ResponseEntity<OpenLmisResponse> getDetailsForDonor(@PathVariable(value="id") Long id){ return OpenLmisResponse.response(DONOR,donorService.getById(id)); }  @RequestMapping(value="list",method= GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DONOR, MANAGE_EQUIPMENT_INVENTORY')") ResponseEntity<OpenLmisResponse> getAll(); @RequestMapping(value="insert.json",method=POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DONOR')") ResponseEntity<OpenLmisResponse> save(@RequestBody Donor donor, HttpServletRequest request); @RequestMapping(value="getDetails/{id}",method = GET,headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DONOR')") ResponseEntity<OpenLmisResponse> getDetailsForDonor(@PathVariable(value="id") Long id); @RequestMapping(value="remove/{id}",method = GET,headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DONOR')") ResponseEntity<OpenLmisResponse> remove(@PathVariable(value="id") Long donorId, HttpServletRequest request); }
DonorController extends BaseController { @RequestMapping(value="getDetails/{id}",method = GET,headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DONOR')") public ResponseEntity<OpenLmisResponse> getDetailsForDonor(@PathVariable(value="id") Long id){ return OpenLmisResponse.response(DONOR,donorService.getById(id)); }  @RequestMapping(value="list",method= GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DONOR, MANAGE_EQUIPMENT_INVENTORY')") ResponseEntity<OpenLmisResponse> getAll(); @RequestMapping(value="insert.json",method=POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DONOR')") ResponseEntity<OpenLmisResponse> save(@RequestBody Donor donor, HttpServletRequest request); @RequestMapping(value="getDetails/{id}",method = GET,headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DONOR')") ResponseEntity<OpenLmisResponse> getDetailsForDonor(@PathVariable(value="id") Long id); @RequestMapping(value="remove/{id}",method = GET,headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_DONOR')") ResponseEntity<OpenLmisResponse> remove(@PathVariable(value="id") Long donorId, HttpServletRequest request); static final String DONOR; static final String DONORS; }