@Test public void shouldSave() throws Exception { ServiceType type = new ServiceType(); doNothing().when(service).save(type); ResponseEntity<OpenLmisResponse> response = controller.save(type); assertThat(type, is(response.getBody().getData().get("service_type"))); assertThat(response.getBody().getSuccessMsg(), is(notNullValue())); }
@RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> save(@RequestBody ServiceType type){ service.save(type); ResponseEntity<OpenLmisResponse> response = OpenLmisResponse.success("message.equipment.service.type.saved"); response.getBody().addData(SERVICE_TYPE, type); return response; }
ServiceTypeController extends BaseController { @RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> save(@RequestBody ServiceType type){ service.save(type); ResponseEntity<OpenLmisResponse> response = OpenLmisResponse.success("message.equipment.service.type.saved"); response.getBody().addData(SERVICE_TYPE, type); return response; } }
ServiceTypeController extends BaseController { @RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> save(@RequestBody ServiceType type){ service.save(type); ResponseEntity<OpenLmisResponse> response = OpenLmisResponse.success("message.equipment.service.type.saved"); response.getBody().addData(SERVICE_TYPE, type); return response; }  }
ServiceTypeController extends BaseController { @RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> save(@RequestBody ServiceType type){ service.save(type); ResponseEntity<OpenLmisResponse> response = OpenLmisResponse.success("message.equipment.service.type.saved"); response.getBody().addData(SERVICE_TYPE, type); return response; }  @RequestMapping(method = GET, value = "list") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS') or @permissionEvaluator.hasPermission(principal,'SERVICE_VENDOR_RIGHT')") ResponseEntity<OpenLmisResponse> getAll(); @RequestMapping(method = GET, value = "id") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> getById( @RequestParam("id") Long id); @RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> save(@RequestBody ServiceType type); }
ServiceTypeController extends BaseController { @RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> save(@RequestBody ServiceType type){ service.save(type); ResponseEntity<OpenLmisResponse> response = OpenLmisResponse.success("message.equipment.service.type.saved"); response.getBody().addData(SERVICE_TYPE, type); return response; }  @RequestMapping(method = GET, value = "list") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS') or @permissionEvaluator.hasPermission(principal,'SERVICE_VENDOR_RIGHT')") ResponseEntity<OpenLmisResponse> getAll(); @RequestMapping(method = GET, value = "id") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> getById( @RequestParam("id") Long id); @RequestMapping(value = "save", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> save(@RequestBody ServiceType type); static final String SERVICE_TYPE; static final String SERVICE_TYPES; }