Package org.neo4j.cineasts.domain

Examples of org.neo4j.cineasts.domain.Rating


        model.addAttribute("id", movieId);
        if (movie != null) {
            model.addAttribute("movie", movie);
            final int stars = movie.getStars();
            model.addAttribute("stars", stars);
            Rating rating = null;
            if (user!=null) rating = movie.getRelationshipTo(user, Rating.class, "RATED");
            if (rating == null) rating = new Rating().rate(stars,null);
            model.addAttribute("userRating",rating);
        }
        return "/movies/show";
    }
View Full Code Here


    @Test
    public void testRateMovie() throws Exception {
        Movie movie = new Movie("1", "Test-Movie").persist();
        User user=new User("me","me","me").persist();
        user.rate(movie, 5, "comment");
        final Rating rating = IteratorUtil.first(movie.getRatings());
        assertEquals("rating stars", 5, rating.getStars());
        assertEquals("rating comment", "comment", rating.getComment());
        assertEquals("rating user", user, rating.getUser());
        assertEquals("rating movie", movie, rating.getMovie());
    }
View Full Code Here

        if (movieData != null) {
            Movie movie = movieData.getMovie();
            model.addAttribute("movie", movie);
            final Integer stars = movieData.getAverageRating();
            model.addAttribute("stars", stars);
            Rating rating = null;
            if (user!=null) rating = movie.getRelationshipTo(user, Rating.class, "RATED");
            if (rating == null) rating = new Rating().rate(stars==null?0:stars,null);
            model.addAttribute("userRating",rating);
        }
        return "/movies/show";
    }
View Full Code Here

        model.addAttribute("id", movieId);
        if (movie != null) {
            model.addAttribute("movie", movie);
            final int stars = movie.getStars();
            model.addAttribute("stars", stars);
            Rating rating = null;
            if (user!=null) rating = movie.getRelationshipTo(user, Rating.class, "RATED");
            if (rating == null) rating = new Rating().rate(stars, null);
            model.addAttribute("userRating",rating);
        }
        return "/movies/show";
    }
View Full Code Here

    public void testRateMovie() throws Exception {
        Movie movie = movieRepository.save(new Movie("1", "Test-Movie"));
        User user = userRepository.save(new User("me", "me", "me"));
        user.rate(template, movie, 5, "comment");
        movie = movieRepository.findById("1");
        final Rating rating = IteratorUtil.first(movie.getRatings());
        assertEquals("rating stars", 5, rating.getStars());
        assertEquals("rating comment", "comment", rating.getComment());
        assertEquals("rating user", user, rating.getUser());
        assertEquals("rating movie", movie, rating.getMovie());
    }
View Full Code Here

TOP

Related Classes of org.neo4j.cineasts.domain.Rating

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.