Package de.codecentric.moviedatabase.domain

Examples of de.codecentric.moviedatabase.domain.Movie


    model.addAttribute("movie", movieResourceAssembler.toResource(movieService.findMovieById(id)));
    return getLogicalViewNamePrefix()+"comments";
  }
 
  protected void doCreateComment(@PathVariable UUID id, @RequestParam String content) {
    Movie movie = movieService.findMovieById(id);
    movie.getComments().add(new Comment(new Date(), content));
  }
View Full Code Here


  }
 
  @RequestMapping(value = "/new", method = RequestMethod.POST, consumes={"application/json", "application/hal+json"})
  public @ResponseBody ResponseEntity<Resource<Movie>> addMovie(@RequestBody Movie movie) {
    // recreate the movie to make sure that the client is not sending too much information, e.g., an ID.
    Movie result = new Movie(movie.getTitle(), movie.getDescription(), movie.getStartDate());
    movieService.createMovie(result);
    return getMovie(result.getId());
  }
View Full Code Here

    return getMovie(result.getId());
  }
 
  @RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes={"application/json", "application/hal+json"})
  public @ResponseBody ResponseEntity<Resource<Movie>> editMovie(@PathVariable UUID id, @RequestBody MovieForm movieForm) {
    Movie movie = movieService.findMovieById(id);
    movie.setDescription(movieForm.getDescription());
    movie.setStartDate(movieForm.getStartDate());
    movie.setTitle(movieForm.getTitle());
    movieService.updateMovie(movie);
    return getMovie(id);
  }
View Full Code Here

    return new ResponseEntity<Object>(null, headers, HttpStatus.NO_CONTENT);
  }
 
  @RequestMapping(value = "/{id}/comments", method = RequestMethod.POST, consumes={"text/plain"})
  public @ResponseBody ResponseEntity<Resource<Movie>> addComment(@PathVariable UUID id, @RequestBody String content) {
    Movie movie = movieService.findMovieById(id);
    movie.getComments().add(new Comment(new Date(), content));
    return enableCorsRequests(movieResourceAssembler.toResource(movie), HttpStatus.CREATED);
  }
View Full Code Here

TOP

Related Classes of de.codecentric.moviedatabase.domain.Movie

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.