cleanup work

This commit is contained in:
eugenp 2014-06-17 22:33:08 +03:00
parent a910ebae44
commit c1fed77c54
2 changed files with 15 additions and 0 deletions

View File

@ -37,4 +37,5 @@ public class FooController {
System.out.println(foo);
return foo;
}
}

View File

@ -85,4 +85,18 @@ public class FooController {
eventPublisher.publishEvent(new ResourceCreatedEvent(this, response, idOfCreatedResource));
}
@RequestMapping(method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.OK)
public void update(@RequestBody final Foo resource) {
Preconditions.checkNotNull(resource);
RestPreconditions.checkFound(service.findOne(resource.getId()));
service.update(resource);
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.OK)
public void delete(@PathVariable("id") final Long id) {
service.deleteById(id);
}
}