diff --git a/spring-data-neo4j-examples/cineasts-rest/pom.xml b/spring-data-neo4j-examples/cineasts-rest/pom.xml index a6a11a18f..0c32684c9 100644 --- a/spring-data-neo4j-examples/cineasts-rest/pom.xml +++ b/spring-data-neo4j-examples/cineasts-rest/pom.xml @@ -247,6 +247,12 @@ test + + org.neo4j + neo4j-kernel + ${neo4j.version} + + org.neo4j.app neo4j-server diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/controller/MovieController.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/controller/MovieController.java index 11d4dd956..3529a1d8d 100644 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/controller/MovieController.java +++ b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/controller/MovieController.java @@ -4,12 +4,14 @@ import org.neo4j.cineasts.domain.Movie; import org.neo4j.cineasts.domain.Person; import org.neo4j.cineasts.domain.Rating; import org.neo4j.cineasts.domain.User; +import org.neo4j.cineasts.service.CineastsRepository; import org.neo4j.cineasts.service.CineastsUserDetailsService; import org.neo4j.cineasts.service.DatabasePopulator; -import org.neo4j.cineasts.service.CineastsRepository; +import org.neo4j.helpers.collection.IteratorUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.neo4j.support.Neo4jTemplate; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; @@ -26,14 +28,16 @@ public class MovieController { private CineastsRepository moviesRepository; private CineastsUserDetailsService userDetailsService; + private final Neo4jTemplate template; private DatabasePopulator populator; private static final Logger log = LoggerFactory.getLogger(MovieController.class); @Autowired - public MovieController(CineastsRepository moviesRepository, DatabasePopulator populator, CineastsUserDetailsService userDetailsService) { + public MovieController(CineastsRepository moviesRepository, DatabasePopulator populator, CineastsUserDetailsService userDetailsService, Neo4jTemplate template) { this.moviesRepository = moviesRepository; this.populator = populator; this.userDetailsService = userDetailsService; + this.template = template; } // for web service (JSON) clients @@ -95,6 +99,7 @@ public class MovieController { Person person = moviesRepository.getPerson(id); model.addAttribute("actor", person); model.addAttribute("id", id); + model.addAttribute("roles", IteratorUtil.asCollection(person.getRoles())); addUser(model); return "/actors/show"; } diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/applicationContext.xml b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/applicationContext.xml index a2d1731c7..611ff25f8 100644 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/applicationContext.xml +++ b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/applicationContext.xml @@ -14,7 +14,12 @@ - + + + + + + diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/actors/show.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/actors/show.jsp index 8c2c40129..fffb8c52e 100644 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/actors/show.jsp +++ b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/actors/show.jsp @@ -3,6 +3,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%--@elvariable id="actor" type="org.neo4j.cineasts.domain.Actor"--%> +<%--@elvariable id="role" type="org.neo4j.cineasts.domain.Role"--%>
@@ -20,7 +21,7 @@

Roles

    - +
  • as in
  • diff --git a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/controller/MovieController.java b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/controller/MovieController.java index 11d4dd956..9918185a7 100644 --- a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/controller/MovieController.java +++ b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/controller/MovieController.java @@ -7,6 +7,7 @@ import org.neo4j.cineasts.domain.User; import org.neo4j.cineasts.service.CineastsUserDetailsService; import org.neo4j.cineasts.service.DatabasePopulator; import org.neo4j.cineasts.service.CineastsRepository; +import org.neo4j.helpers.collection.IteratorUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -95,6 +96,7 @@ public class MovieController { Person person = moviesRepository.getPerson(id); model.addAttribute("actor", person); model.addAttribute("id", id); + model.addAttribute("roles", IteratorUtil.asCollection(person.getRoles())); addUser(model); return "/actors/show"; } diff --git a/spring-data-neo4j-examples/cineasts/src/main/webapp/WEB-INF/views/actors/show.jsp b/spring-data-neo4j-examples/cineasts/src/main/webapp/WEB-INF/views/actors/show.jsp index 8c2c40129..fffb8c52e 100644 --- a/spring-data-neo4j-examples/cineasts/src/main/webapp/WEB-INF/views/actors/show.jsp +++ b/spring-data-neo4j-examples/cineasts/src/main/webapp/WEB-INF/views/actors/show.jsp @@ -3,6 +3,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%--@elvariable id="actor" type="org.neo4j.cineasts.domain.Actor"--%> +<%--@elvariable id="role" type="org.neo4j.cineasts.domain.Role"--%>
    @@ -20,7 +21,7 @@

    Roles