Examples of Movie


Examples of de.codecentric.moviedatabase.domain.Movie

  private Map<UUID, Movie> idToMovieMap = new ConcurrentHashMap<UUID, Movie>();
  private Map<Tag, Set<Movie>> tagToMoviesMap = new ConcurrentHashMap<Tag, Set<Movie>>();
 
  public InMemoryMovieService(){
    // let the dummy Movie have always the same ID to test it easily via command line tools / unit tests
    Movie movie = new Movie(UUID.fromString("240342ea-84c8-415f-b1d5-8e4376191aeb"),
        "Star Wars","In einer Galaxie weit, weit entfernt",
        new Date());
    Tag tag = new Tag("Science Fiction");
    movie.getTags().add(tag);
    idToMovieMap.put(movie.getId(), movie);
    Set<Movie> movies = new HashSet<Movie>();
    movies.add(movie);
    tagToMoviesMap.put(tag, movies);
  }
View Full Code Here

Examples of de.codecentric.moviedatabase.domain.Movie

  }

  @Override
  public void deleteMovie(UUID id) {
    Assert.notNull(id);
    Movie movie = idToMovieMap.remove(id);
    for (Set<Movie> movies: tagToMoviesMap.values()){
      movies.remove(movie);
    }
  }
View Full Code Here

Examples of de.codecentric.moviedatabase.domain.Movie

  @Override
  public void addCommentToMovie(Comment comment, UUID movieId) {
    Assert.notNull(comment);
    Assert.notNull(movieId);
    Movie movie = idToMovieMap.get(movieId);
    if (movie == null){
      throw new ResourceNotFoundException("Movie not found.");
    }
    movie.getComments().add(comment);
  }
View Full Code Here

Examples of de.codecentric.moviedatabase.domain.Movie

  @Override
  public void addTagToMovie(Tag tag, UUID movieId) {
    Assert.notNull(tag);
    Assert.hasText(tag.getLabel());
    Assert.notNull(movieId);
    Movie movie = idToMovieMap.get(movieId);
    if (movie == null){
      throw new ResourceNotFoundException("Movie not found.");
    }
    movie.getTags().add(tag);
    Set<Movie> movies = tagToMoviesMap.get(tag);
    if (movies == null){
      movies = new HashSet<Movie>();
    }
    movies.add(movie);
View Full Code Here

Examples of de.codecentric.moviedatabase.domain.Movie

  @Override
  public void removeTagFromMovie(Tag tag, UUID movieId) {
    Assert.notNull(tag);
    Assert.notNull(movieId);
    Movie movie = idToMovieMap.get(movieId);
    if (movie == null){
      throw new ResourceNotFoundException("Movie not found.");
    }
    movie.getTags().remove(tag);
    Set<Movie> movies = tagToMoviesMap.get(tag);
    if (movies != null){
      movies.remove(movie);
    }
  }
View Full Code Here

Examples of de.codecentric.moviedatabase.domain.Movie

  }

  @Override
  public Movie findMovieById(UUID id) {
    Assert.notNull(id);
    Movie movie = idToMovieMap.get(id);
    if (movie == null){
      throw new ResourceNotFoundException("Movie not found.");
    }
    return movie;
  }
View Full Code Here

Examples of de.codecentric.moviedatabase.domain.Movie

    }
    searchResult.addAll(taggedMovies);
    if (searchWords != null && !searchWords.isEmpty()){
      for (String searchWord: searchWords){
        for (Iterator<Movie> it = searchResult.iterator();it.hasNext();){
          Movie movie = it.next();
          if (!(movie.getTitle().toLowerCase().contains(searchWord.toLowerCase())) && !(movie.getDescription() != null && movie.getDescription().toLowerCase().contains(searchWord.toLowerCase()))){
            it.remove();
          }
        }
      }
    }
View Full Code Here

Examples of de.codecentric.moviedatabase.domain.Movie

    model.addAttribute("cancelLink", linkBuilderFactory.linkTo(HtmlMovieController.class).withSelfRel());
    return getLogicalViewNamePrefix()+"movie_edit";
  }
 
  protected void doCreateMovie(MovieForm movieForm) {
    Movie movie = new Movie(movieForm.getTitle(), movieForm.getDescription(), movieForm.getStartDate());
    movieService.createMovie(movie);
  }
View Full Code Here

Examples of de.codecentric.moviedatabase.domain.Movie

    return getLogicalViewNamePrefix()+"movie";
  }
 
  @RequestMapping(value = "/{id}/edit", method = RequestMethod.GET)
  public String getEditMovie(@PathVariable UUID id, Model model) {
    Movie movie = movieService.findMovieById(id);
    model.addAttribute("movieForm", new MovieForm(movie));
    Resource<Movie> resourceMovie = movieResourceAssembler.toResource(movie);
    model.addAttribute("actionLink", resourceMovie.getLink(Relation.SELF.getName()));
    model.addAttribute("cancelLink", resourceMovie.getLink(Relation.SELF.getName()));
    return getLogicalViewNamePrefix()+"movie_edit";
View Full Code Here

Examples of de.codecentric.moviedatabase.domain.Movie

    model.addAttribute("cancelLink", resourceMovie.getLink(Relation.SELF.getName()));
    return getLogicalViewNamePrefix()+"movie_edit";
  }
 
  protected void doEditMovie(@PathVariable UUID id, MovieForm movieForm) {
    Movie movie = movieService.findMovieById(id);
    movie.setDescription(movieForm.getDescription());
    movie.setStartDate(movieForm.getStartDate());
    movie.setTitle(movieForm.getTitle());
    movieService.updateMovie(movie);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.