示例#1
0
 @POST
 @Path("{id}")
 @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
 public void edit(
     @PathParam("id") Long id,
     @FormParam("name") String name,
     @FormParam("description") String description) {
   Genre genre = genreManager.get(id);
   if (genre != null) {
     genreManager.update(genre, name, description);
   }
 }
示例#2
0
 @PUT
 @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
 public void add(@FormParam("name") String name, @FormParam("description") String description) {
   Genre newGenre = new Genre();
   newGenre.setName(name);
   newGenre.setDescription(description);
   genreManager.add(newGenre);
 }
示例#3
0
 @DELETE
 @Path("{id}")
 public void delete(@PathParam("id") Long id) {
   genreManager.delete(genreManager.get(id));
 }
示例#4
0
 @GET
 @Path("{id}")
 public Genre get(@PathParam("id") Long id) {
   return genreManager.get(id);
 }
示例#5
0
 @GET
 public List<Genre> getAllGenres() {
   return genreManager.getAllGenres();
 }