@Logged @RequestMapping( value = "", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) HttpEntity create(@RequestBody TestCaseDTO dto) { return new ResponseEntity<>(testCaseService.create(dto), HttpStatus.CREATED); }
@Logged @RequestMapping( value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE) HttpEntity update(@PathVariable long id, @RequestBody TestCaseDTO dto) { if (dto.getId() != id) { return new ResponseEntity<>("ID in URL does not match ID in body", HttpStatus.CONFLICT); } return new ResponseEntity<>(testCaseService.update(dto), HttpStatus.OK); }
@Logged @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) HttpEntity delete(@PathVariable long id) { testCaseService.delete(id); return new ResponseEntity<>(HttpStatus.ACCEPTED); }
@Logged @RequestMapping(value = "", method = RequestMethod.GET) HttpEntity readAll(@PageableDefault Pageable pageable) { Page<TestCaseDTO> dtos = testCaseService.readAll(pageable); return new ResponseEntity<>(dtos, HttpStatus.OK); }
@Logged @RequestMapping(value = "/{id}", method = RequestMethod.GET) HttpEntity read(@PathVariable long id) { return new ResponseEntity<>(testCaseService.read(id), HttpStatus.OK); }