diff --git a/pom.xml b/pom.xml index 7440a6e61..dda02c2b2 100644 --- a/pom.xml +++ b/pom.xml @@ -63,10 +63,7 @@ spring-data-neo4j-examples/hello-worlds spring-data-neo4j-examples/hello-worlds-aspects - spring-data-neo4j-examples/imdb spring-data-neo4j-examples/cineasts - spring-data-neo4j-examples/cineasts-aspects - spring-data-neo4j-examples/cineasts-rest spring-data-neo4j-examples/myrestaurants-social spring-data-neo4j-examples/todos spring-data-neo4j-examples/backwardscompatibility diff --git a/spring-data-neo4j-examples/cineasts-aspects/.gitignore b/spring-data-neo4j-examples/cineasts-aspects/.gitignore deleted file mode 100644 index 490bd87be..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -.DS_Store -*.ipr -*.iws -*.iml -*.zip -data -target -*.log -tmp -.classpath -.project -.settings diff --git a/spring-data-neo4j-examples/cineasts-aspects/Readme.md b/spring-data-neo4j-examples/cineasts-aspects/Readme.md deleted file mode 100644 index 57c196e9c..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/Readme.md +++ /dev/null @@ -1,16 +0,0 @@ -![Cineasts.net Logo](https://github.com/jexp/cineasts/raw/master/cineasts.png) -Cineasts.net -============ - -This project is the demo/tutorial application for the [Spring Data Neo4j](https://github.com/SpringSource/spring-data-neo4j) library which provides convenient access to the [Neo4j](http://neo4j.org) graph database. - -This tutorial creates a complete web application built on top of Spring Data Neo4j. - -It uses a domain that should be familiar to most - movies. So for cineasts.net we decided to add a social -touch to the whole movie rating business, allowing friends to share their ratings and get recommendations -for new friends and movies. - -The tutorial is presented as a colloquial description of the steps necessary to create the application. -It provides the configuration and code examples that are needed to understand what's happening. - -The complete tutorial is contained in this projects [github wiki](https://github.com/jexp/cineasts/wiki). \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-aspects/cineasts.png b/spring-data-neo4j-examples/cineasts-aspects/cineasts.png deleted file mode 100644 index e7778456b..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/cineasts.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/pom.xml b/spring-data-neo4j-examples/cineasts-aspects/pom.xml deleted file mode 100644 index c7b8f2ddd..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/pom.xml +++ /dev/null @@ -1,356 +0,0 @@ - - 4.0.0 - - org.neo4j.examples - cineasts-aspects - 2.2.0.BUILD-SNAPSHOT - war - - Cineasts.net Aspects - - - UTF-8 - 3.1.0.RELEASE - 1.6.1 - 1.8.1 - ${project.version} - 1.6.12 - - - - - spring-maven-release - Spring Maven Release Repository - http://maven.springframework.org/release - - - spring-maven-snapshot - Spring Maven Snapshot Repository - - true - - http://maven.springframework.org/snapshot - - - spring-maven-milestone - Spring Maven Milestone Repository - http://maven.springframework.org/milestone - - - neo4j-release-repository - Neo4j Maven 2 release repository - http://m2.neo4j.org/releases - - true - - - false - - - - neo4j-snapshot-repository - Neo4j Maven 2 snapshot repository - http://m2.neo4j.org/snapshots - - true - - - false - - - - jboss-public-repo - http://repository.jboss.org/maven2/ - JBoss public available repo - - - - - - spring-maven-release - Spring Maven Release Repository - http://maven.springframework.org/release - - - spring-maven-milestone - Spring Maven Milestone Repository - http://maven.springframework.org/milestone - - - - - - - org.springframework - spring-core - ${spring.version} - - - commons-logging - commons-logging - - - - - org.springframework - spring-test - ${spring.version} - test - - - commons-logging - commons-logging - - - - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-aop - ${spring.version} - - - org.springframework - spring-aspects - ${spring.version} - - - org.springframework - spring-tx - ${spring.version} - - - - org.springframework - spring-webmvc - ${spring.version} - - - commons-logging - commons-logging - - - - - - org.springframework.security - spring-security-web - ${spring.version} - - - org.springframework.security - spring-security-config - ${spring.version} - - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - jcl-over-slf4j - ${slf4j.version} - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - runtime - - - log4j - log4j - 1.2.16 - runtime - - - - org.springframework.data - spring-data-neo4j-aspects - ${spring-data-neo4j.version} - - - org.hibernate.javax.persistence - hibernate-jpa-2.0-api - - - - - - opensymphony - sitemesh - 2.4.2 - - - - org.hibernate - hibernate-validator - 4.0.2.GA - - - - javax.servlet - servlet-api - 2.5 - provided - - - javax.servlet.jsp - jsp-api - 2.1 - provided - - - javax.servlet - jstl - 1.2 - - - - org.codehaus.jackson - jackson-mapper-asl - 1.8.3 - - - - org.aspectj - aspectjrt - ${aspectj.version} - - - - org.hibernate.javax.persistence - hibernate-jpa-2.0-api - 1.0.0.Final - - - - - - org.neo4j - neo4j-kernel - ${neo4j.version} - test-jar - test - - - org.neo4j - neo4j-cypher - ${neo4j.version} - - - - junit - junit - 4.8.1 - test - - - - - - org.mortbay.jetty - jetty-maven-plugin - 7.1.2.v20100523 - - - / - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.1 - - 1.7 - 1.7 - - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - **/*Tests.java - **/*Test.java - - - **/Abstract*.java - - junit:junit - - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - 1.5 - - org.eclipse.ajdt.ui.ajnature - org.eclipse.jdt.core.javanature - org.springframework.ide.eclipse.core.springnature - - - - - - org.codehaus.mojo - aspectj-maven-plugin - 1.2 - - - org.aspectj - aspectjrt - ${aspectj.version} - - - org.aspectj - aspectjtools - ${aspectj.version} - - - - - - compile - test-compile - - - - - true - - - org.springframework - spring-aspects - - - org.springframework.data - spring-data-neo4j-aspects - - - 1.7 - 1.7 - - - - - - diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/controller/AuthController.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/controller/AuthController.java deleted file mode 100644 index 48d7d7c4d..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/controller/AuthController.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.neo4j.cineasts.controller; - - -import org.neo4j.cineasts.service.CineastsUserDetailsService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; - -/** - * Handles and retrieves the login or denied page depending on the URI template - */ -@Controller -@RequestMapping("/auth") -public class AuthController { - - private final static Logger logger = LoggerFactory.getLogger(AuthController.class); - - @Autowired - CineastsUserDetailsService userDetailsService; - @RequestMapping(value = "/login", method = RequestMethod.GET) - public String login(@RequestParam(value = "login_error", required = false) boolean error, Model model) { - logger.debug("Received request to show login page, error "+error); - if (error) { - model.addAttribute("error", "You have entered an invalid username or password!"); - } - return "/auth/loginpage"; - } - - @RequestMapping(value = "/register", method = RequestMethod.POST) - public String register( - @RequestParam(value = "j_username") String login, - @RequestParam(value = "j_displayname") String name, - @RequestParam(value = "j_password") String password, - Model model) { - - try { - userDetailsService.register(login,name,password); - return "forward:/user/"+login; - } catch(Exception e) { - model.addAttribute("j_username",login); - model.addAttribute("j_displayname",name); - model.addAttribute("error",e.getMessage()); - return "/auth/registerpage"; - } - } - - @RequestMapping(value = "/denied", method = RequestMethod.GET) - public String denied() { - logger.debug("Received request to show denied page"); - return "/auth/deniedpage"; - } - - @RequestMapping(value = "/registerpage", method = RequestMethod.GET) - public String registerPage() { - logger.debug("Received request to show register page"); - return "/auth/registerpage"; - } -} \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/controller/ImportController.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/controller/ImportController.java deleted file mode 100644 index 61aa74861..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/controller/ImportController.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.neo4j.cineasts.controller; - -import org.neo4j.cineasts.movieimport.MovieDbImportService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; - -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * @author mh - * @since 04.03.11 - */ -@Controller -public class ImportController { - - private MovieDbImportService importService; - private static final Logger log = LoggerFactory.getLogger(ImportController.class); - - @Autowired - public ImportController(MovieDbImportService importService) { - this.importService = importService; - } - - @RequestMapping(value = "/import/{ids}", method = RequestMethod.GET) - public String importMovie(@PathVariable String ids, Model model) { - long start=System.currentTimeMillis(); - final Map movies = importService.importMovies(extractRanges(ids)); - long duration = (System.currentTimeMillis() - start) / 1000; - model.addAttribute("duration", duration); - model.addAttribute("ids", ids); - model.addAttribute("movies", movies.entrySet()); - return "import/result"; - } - - - private Map extractRanges(String ids) { - Map ranges = new LinkedHashMap(); - StringBuilder errors = new StringBuilder(); - for (String token : ids.split(",")) { - try { - if (token.contains("-")) { - String[] range = token.split("-"); - ranges.put(Integer.parseInt(range[0]), Integer.parseInt(range[1])); - } else { - int id = Integer.parseInt(token); - ranges.put(id, id); - } - } catch (Exception e) { - errors.append(token).append(": ").append(e.getMessage()).append("\n"); - } - } - if (errors.length() > 0) { - throw new RuntimeException("Error parsing ids\n" + errors); - } - return ranges; - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/controller/MovieController.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/controller/MovieController.java deleted file mode 100644 index 83cee75fe..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/controller/MovieController.java +++ /dev/null @@ -1,126 +0,0 @@ -package org.neo4j.cineasts.controller; - -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.repository.MovieRepository; -import org.neo4j.cineasts.repository.PersonRepository; -import org.neo4j.cineasts.service.CineastsUserDetailsService; -import org.neo4j.cineasts.service.DatabasePopulator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.*; - -import java.util.Collection; -import java.util.Collections; - -/** - * @author mh - * @since 04.03.11 - */ -@Controller -public class MovieController { - - @Autowired - private MovieRepository movieRepository; - @Autowired - private PersonRepository personRepository; - @Autowired - private CineastsUserDetailsService userDetailsService; - @Autowired - private DatabasePopulator populator; - private static final Logger log = LoggerFactory.getLogger(MovieController.class); - - /** - * Only matches 'GET /movies/{id}}' requests for JSON content; a 404 is sent otherwise. - * TODO send a 406 if an unsupported representation, such as XML, is requested. See SPR-7353. - */ - @RequestMapping(value = "/movies/{id}", method = RequestMethod.GET, headers = "Accept=application/json") - public - @ResponseBody - Movie getMovie(@PathVariable String id) { - return movieRepository.findById(id); - } - - - @RequestMapping(value = "/movies/{movieId}", method = RequestMethod.GET, headers = "Accept=text/html") - public String singleMovieView(final Model model, @PathVariable String movieId) { - User user = addUser(model); - Movie movie = movieRepository.findById(movieId); - 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"; - } - - @RequestMapping(value = "/movies/{movieId}", method = RequestMethod.POST, headers = "Accept=text/html") - public String updateMovie(Model model, @PathVariable String movieId, @RequestParam(value = "rated",required = false) Integer stars, @RequestParam(value = "comment",required = false) String comment) { - Movie movie = movieRepository.findById(movieId); - User user = userDetailsService.getUserFromSession(); - userDetailsService.rate(user, movie, stars, comment); - return singleMovieView(model,movieId); - } - - private User addUser(Model model) { - User user = userDetailsService.getUserFromSession(); - model.addAttribute("user", user); - return user; - } - - @RequestMapping(value = "/movies", method = RequestMethod.GET, headers = "Accept=text/html") - public String findMovies(Model model, @RequestParam("q") String query) { - if (query!=null && !query.isEmpty()) { - Page movies = movieRepository.findByTitleLike(query, new PageRequest(0, 20)); - model.addAttribute("movies", movies.getContent()); - } else { - model.addAttribute("movies", Collections.emptyList()); - } - model.addAttribute("query", query); - addUser(model); - return "/movies/list"; - } - - @RequestMapping(value = "/actors/{id}", method = RequestMethod.GET, headers = "Accept=text/html") - public String singleActorView(Model model, @PathVariable String id) { - Person person = personRepository.findById(id); - model.addAttribute("actor", person); - model.addAttribute("id", id); - model.addAttribute("roles", person.getRoles()); - addUser(model); - return "/actors/show"; - } - - //@RequestMapping(value = "/admin/populate", method = RequestMethod.GET) - @RequestMapping(value = "/populate", method = RequestMethod.GET) - public String populateDatabase(Model model) { - Collection movies=populator.populateDatabase(); - model.addAttribute("movies",movies); - addUser(model); - return "/movies/list"; - } - - @RequestMapping(value = "/admin/clean", method = RequestMethod.GET) - public String clean(Model model) { - populator.cleanDb(); - return "movies/list"; - } - - @RequestMapping(value = "/", method = RequestMethod.GET) - public String index(Model model) { - addUser(model); - return "index"; - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/controller/UserController.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/controller/UserController.java deleted file mode 100644 index 05bb133c6..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/controller/UserController.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.neo4j.cineasts.controller; - - -import org.neo4j.cineasts.domain.User; -import org.neo4j.cineasts.repository.MovieRepository; -import org.neo4j.cineasts.service.CineastsUserDetailsService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; - -/** - * Handles and retrieves the login or denied page depending on the URI template - */ -@Controller -public class UserController { - - @Autowired CineastsUserDetailsService userDetailsService; - @Autowired - MovieRepository movieRepository; - - private final static Logger logger = LoggerFactory.getLogger(UserController.class); - - @RequestMapping(value = "/user", method = RequestMethod.GET) - public String profile(Model model) { - final User user = userDetailsService.getUserFromSession(); - model.addAttribute("user", user); - if (user!=null) { - model.addAttribute("recommendations", movieRepository.getRecommendations(user)); - } - return "/user/index"; - } - - @RequestMapping(value = "/user/{login}/friends", method = RequestMethod.POST) - public String addFriend(Model model, @PathVariable("login") String login) { - userDetailsService.addFriend(login); - return "forward:/user/"+login; - } - - @RequestMapping(value = "/user/{login}") - public String publicProfile(Model model, @PathVariable("login") String login) { - User profiled = userDetailsService.findUser(login); - User user = userDetailsService.getUserFromSession(); - - return publicProfile(model, profiled, user); - } - - private String publicProfile(Model model, User profiled, User user) { - if (profiled.equals(user)) return profile(model); - - model.addAttribute("profiled", profiled); - model.addAttribute("user", user); - model.addAttribute("isFriend", areFriends(profiled, user)); - return "/user/public"; - } - - private boolean areFriends(User user, User loggedIn) { - return user!=null && user.isFriend(loggedIn); - } -} \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/Movie.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/Movie.java deleted file mode 100644 index fdad46ad6..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/Movie.java +++ /dev/null @@ -1,228 +0,0 @@ -package org.neo4j.cineasts.domain; - -import org.neo4j.graphdb.Direction; -import org.neo4j.helpers.collection.IteratorUtil; -import org.springframework.data.neo4j.annotation.NodeEntity; -import org.springframework.data.neo4j.annotation.RelatedTo; -import org.springframework.data.neo4j.annotation.RelatedToVia; -import org.springframework.data.neo4j.annotation.Indexed; -import org.springframework.data.neo4j.support.index.IndexType; - -import java.util.*; - -import static org.neo4j.graphdb.Direction.INCOMING; - - -/** - * @author mh - * @since 04.03.11 - */ -@NodeEntity -public class Movie { - - @Indexed - String id; - - @Indexed(indexType=IndexType.FULLTEXT, indexName = "search") - String title; - - String description; - - @RelatedTo(type="DIRECTED", direction = INCOMING) - Person director; - - @RelatedTo(type = "ACTS_IN", direction = INCOMING) - Set actors; - - @RelatedToVia(elementClass = Role.class, type = "ACTS_IN", direction = INCOMING) - Iterable roles; - - @RelatedToVia(elementClass = Rating.class, type = "RATED", direction = INCOMING) - Iterable ratings; - private String language; - private String imdbId; - private String tagline; - private Date releaseDate; - private Integer runtime; - private String homepage; - private String trailer; - private String genre; - private String studio; - private Integer version; - private Date lastModified; - private String imageUrl; - - public Movie() { - } - - public Movie(String id, String title) { - this.id = id; - this.title = title; - } - - public Collection getActors() { - return actors; - } - - public Collection getRoles() { - return IteratorUtil.asCollection(roles); - } - - public int getYear() { - if (releaseDate==null) return 0; - Calendar cal = Calendar.getInstance(); - cal.setTime(releaseDate); - return cal.get(Calendar.YEAR); - } - - public String getId() { - return id; - } - - public String getTitle() { - return title; - } - - @Override - public String toString() { - return String.format("%s (%s) [%s]", title, releaseDate, id); - } - - public String getDescription() { - return description; - } - - public int getStars() { - Iterable allRatings = ratings; - - if (allRatings == null) return 0; - int stars=0, count=0; - for (Rating rating : allRatings) { - stars += rating.getStars(); - count++; - } - return count==0 ? 0 : stars / count; - } - - public Collection getRatings() { - Iterable allRatings = ratings; - return allRatings == null ? Collections.emptyList() : IteratorUtil.asCollection(allRatings); - } - - public Person getDirector() { - return director; - } - - public void setTitle(String title) { - this.title=title; - } - - public void setLanguage(String language) { - this.language = language; - } - - public void setImdbId(String imdbId) { - this.imdbId = imdbId; - } - - public void setTagline(String tagline) { - this.tagline = tagline; - } - - public void setDescription(String description) { - this.description = description; - } - - public void setReleaseDate(Date releaseDate) { - this.releaseDate = releaseDate; - } - - public void setRuntime(Integer runtime) { - this.runtime = runtime; - } - - public void setHomepage(String homepage) { - this.homepage = homepage; - } - - public void setTrailer(String trailer) { - this.trailer = trailer; - } - - public void setGenre(String genre) { - this.genre = genre; - } - - public void setStudio(String studio) { - this.studio = studio; - } - - public void setVersion(Integer version) { - this.version = version; - } - - public void setLastModified(Date lastModified) { - this.lastModified = lastModified; - } - - public void setImageUrl(String imageUrl) { - this.imageUrl = imageUrl; - } - - public String getLanguage() { - return language; - } - - public String getImdbId() { - return imdbId; - } - - public String getTagline() { - return tagline; - } - - public Date getReleaseDate() { - return releaseDate; - } - - public Integer getRuntime() { - return runtime; - } - - public String getHomepage() { - return homepage; - } - - public String getTrailer() { - return trailer; - } - - public String getGenre() { - return genre; - } - - public String getStudio() { - return studio; - } - - public Integer getVersion() { - return version; - } - - public Date getLastModified() { - return lastModified; - } - - public String getImageUrl() { - return imageUrl; - } - - public String getYoutubeId() { - String trailerUrl = trailer; - if (trailerUrl==null || !trailerUrl.contains("youtu")) return null; - String[] parts = trailerUrl.split("[=/]"); - int numberOfParts = parts.length; - return numberOfParts > 0 ? parts[numberOfParts-1] : null; - } -} - diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/MovieRecommendation.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/MovieRecommendation.java deleted file mode 100644 index 18a051dff..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/MovieRecommendation.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.neo4j.cineasts.domain; - -import org.springframework.data.neo4j.annotation.MapResult; -import org.springframework.data.neo4j.annotation.ResultColumn; - -/** -* @author mh -* @since 04.11.11 -*/ -@MapResult -public interface MovieRecommendation { - @ResultColumn("otherMovie") - Movie getMovie(); - - @ResultColumn("rating") - int getRating(); -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/Person.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/Person.java deleted file mode 100644 index c047e3bd8..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/Person.java +++ /dev/null @@ -1,126 +0,0 @@ -package org.neo4j.cineasts.domain; - -import org.springframework.data.neo4j.annotation.Indexed; -import org.springframework.data.neo4j.annotation.NodeEntity; -import org.springframework.data.neo4j.annotation.RelatedTo; -import org.springframework.data.neo4j.annotation.RelatedToVia; -import org.springframework.data.neo4j.support.index.IndexType; - -import java.util.Date; -import java.util.Set; - -/** - * @author mh - * @since 12.03.11 - */ -@NodeEntity -public class Person { - @Indexed(unique=true) - String id; - @Indexed(indexType=IndexType.FULLTEXT, indexName = "people") - String name; - private Date birthday; - private String birthplace; - private String biography; - private Integer version; - private Date lastModified; - private String profileImageUrl; - - public Person(String id, String name) { - this.id = id; - this.name = name; - } - - public Person() { - } - - public String getId() { - return id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public String toString() { - return String.format("%s [%s]", name, id); - } - - public void setBirthday(Date birthday) { - this.birthday = birthday; - } - - public void setBirthplace(String birthplace) { - this.birthplace = birthplace; - } - - public void setBiography(String biography) { - this.biography = biography; - } - - public void setVersion(Integer version) { - this.version = version; - } - - public void setLastModified(Date lastModified) { - this.lastModified = lastModified; - } - - public Date getBirthday() { - return birthday; - } - - public String getBirthplace() { - return birthplace; - } - - public String getBiography() { - return biography; - } - - public Integer getVersion() { - return version; - } - - public Date getLastModified() { - return lastModified; - } - - public void setProfileImageUrl(String profileImageUrl) { - this.profileImageUrl = profileImageUrl; - } - - public String getProfileImageUrl() { - return profileImageUrl; - } - - @RelatedTo(elementClass = Movie.class, type = "DIRECTED") - private Set directedMovies; - - public Set getDirectedMovies() { - return directedMovies; - } - - public void directed(Movie movie) { - this.directedMovies.add(movie); - } - - @RelatedToVia - Set roles; - - public Set getRoles() { - return roles; - } - - public Role playedIn(Movie movie, String roleName) { - final Role role = new Role(movie,this,roleName); - getRoles().add(role); - return role; - } - -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/Rating.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/Rating.java deleted file mode 100644 index ea14ea5f9..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/Rating.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.neo4j.cineasts.domain; - -import org.springframework.data.neo4j.annotation.EndNode; -import org.springframework.data.neo4j.annotation.RelationshipEntity; -import org.springframework.data.neo4j.annotation.StartNode; - -/** - * @author mh - * @since 04.03.11 - */ -@RelationshipEntity -public class Rating { - private static final int MAX_STARS = 5; - private static final int MIN_STARS = 0; - - @StartNode - User user; - @EndNode Movie movie; - - int stars; - String comment; - - public User getUser() { - return user; - } - - public Movie getMovie() { - return movie; - } - - public int getStars() { - return stars; - } - - public void setStars(int stars) { - this.stars = stars; - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - this.comment = comment; - } - - public Rating rate(int stars, String comment) { - if (stars>= MIN_STARS && stars <= MAX_STARS) this.stars=stars; - if (comment!=null && !comment.isEmpty()) this.comment = comment; - return this; - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/Role.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/Role.java deleted file mode 100644 index 964c23c0f..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/Role.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.neo4j.cineasts.domain; - -import org.springframework.data.neo4j.annotation.EndNode; -import org.springframework.data.neo4j.annotation.RelationshipEntity; -import org.springframework.data.neo4j.annotation.StartNode; - -/** - * @author mh - * @since 04.03.11 - */ -@RelationshipEntity(type = "ACTS_IN") -public class Role { - @EndNode Movie movie; - @StartNode Person actor; - - String name; - - public Role() { - } - - public Role(Movie movie, Person actor, String roleName) { - this.movie = movie; - this.actor = actor; - this.name = roleName; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Movie getMovie() { - return movie; - } - - public Person getActor() { - return actor; - } - - @Override - public String toString() { - return String.format("%s acts as %s in %s", actor, name, movie); - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/Roles.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/Roles.java deleted file mode 100644 index 3319ab32f..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/Roles.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.neo4j.cineasts.domain; - -/** -* @author mh -* @since 12.03.11 -*/ -public enum Roles { - ACTS_IN, DIRECTED -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/User.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/User.java deleted file mode 100644 index 8d362207a..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/domain/User.java +++ /dev/null @@ -1,117 +0,0 @@ -package org.neo4j.cineasts.domain; - -import org.neo4j.graphdb.Direction; -import org.neo4j.helpers.collection.IteratorUtil; -import org.springframework.data.neo4j.annotation.Indexed; -import org.springframework.data.neo4j.annotation.NodeEntity; -import org.springframework.data.neo4j.annotation.RelatedTo; -import org.springframework.data.neo4j.annotation.RelatedToVia; -import org.springframework.security.authentication.encoding.Md5PasswordEncoder; -import org.springframework.security.core.GrantedAuthority; - -import java.util.Collection; -import java.util.Set; - -@NodeEntity -public class User { - private static final String SALT = "cewuiqwzie"; - public static final String FRIEND = "FRIEND"; - public static final String RATED = "RATED"; - @Indexed - String login; - String name; - String password; - String info; - private Roles[] roles; - - public User() { - } - - public User(String login, String name, String password, Roles... roles) { - this.login = login; - this.name = name; - this.password = encode(password); - this.roles = roles; - } - - private String encode(String password) { - return new Md5PasswordEncoder().encodePassword(password, SALT); - } - - @RelatedToVia(elementClass = Rating.class, type = RATED) - Iterable ratings; - - @RelatedTo(elementClass = Movie.class, type = RATED) - Set favorites; - - - @RelatedTo(elementClass = User.class, type = FRIEND, direction = Direction.BOTH) - Set friends; - - public void addFriend(User friend) { - this.friends.add(friend); - } - - public Rating rate(Movie movie, int stars, String comment) { - return relateTo(movie, Rating.class, RATED).rate(stars, comment); - } - - public Collection getRatings() { - return IteratorUtil.asCollection(ratings); - } - - @Override - public String toString() { - return String.format("%s (%s)", name, login); - } - - public String getName() { - return name; - } - - public Set getFriends() { - return friends; - } - - public Roles[] getRole() { - return roles; - } - - - public String getLogin() { - return login; - } - - public String getPassword() { - return password; - } - - public String getInfo() { - return info; - } - public void setInfo(String info) { - this.info = info; - } - public void updatePassword(String old, String newPass1, String newPass2) { - if (!password.equals(encode(old))) throw new IllegalArgumentException("Existing Password invalid"); - if (!newPass1.equals(newPass2)) throw new IllegalArgumentException("New Passwords don't match"); - this.password = encode(newPass1); - } - - public void setName(String name) { - this.name = name; - } - - public boolean isFriend(User other) { - return other!=null && getFriends().contains(other); - } - - public enum Roles implements GrantedAuthority { - ROLE_USER, ROLE_ADMIN; - - @Override - public String getAuthority() { - return name(); - } - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieDbApiClient.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieDbApiClient.java deleted file mode 100644 index 0cf57e9ca..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieDbApiClient.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.neo4j.cineasts.movieimport; - - -import org.codehaus.jackson.map.ObjectMapper; - -import java.net.URL; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -public class MovieDbApiClient { - - private final String baseUrl = "http://api.themoviedb.org/"; - private final String apiKey; - protected final ObjectMapper mapper; - - public MovieDbApiClient(String apiKey) { - this.apiKey = apiKey; - mapper = new ObjectMapper(); - } - - public Map getMovie(String id) { - return loadJsonData(id, buildMovieUrl(id)); - } - - private Map loadJsonData(String id, String url) { - try { - List value = mapper.readValue(new URL(url), List.class); - if (value.isEmpty() || value.get(0).equals("Nothing found.")) return Collections.singletonMap("not_found",System.currentTimeMillis()); - return (Map) value.get(0); - } catch (Exception e) { - throw new RuntimeException("Failed to get data from " + url, e); - } - } - - private String buildMovieUrl(String movieId) { - return String.format("%s2.1/Movie.getInfo/en/json/%s/%s", baseUrl, apiKey, movieId); - } - - public Map getPerson(String id) { - return loadJsonData(id, buildPersonUrl(id)); - } - - private String buildPersonUrl(String personId) { - return String.format("%s2.1/Person.getInfo/en/json/%s/%s", baseUrl, apiKey, personId); - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieDbException.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieDbException.java deleted file mode 100644 index a1da5992b..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieDbException.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -public class MovieDbException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - public MovieDbException(String message) { - super(message); - } - - public MovieDbException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieDbImportService.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieDbImportService.java deleted file mode 100644 index 6f8250c96..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieDbImportService.java +++ /dev/null @@ -1,132 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -import org.neo4j.cineasts.domain.*; -import org.neo4j.cineasts.repository.MovieRepository; -import org.neo4j.cineasts.repository.PersonRepository; -import org.neo4j.cineasts.service.CineastsRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.Map; - -@Service -public class MovieDbImportService { - - private static final Logger logger = LoggerFactory.getLogger(MovieDbImportService.class); - MovieDbJsonMapper movieDbJsonMapper = new MovieDbJsonMapper(); - - @Autowired - MovieRepository movieRepository; - @Autowired - PersonRepository personRepository; - - @Autowired - MovieDbApiClient client; - - @Autowired - MovieDbLocalStorage localStorage; - - @Transactional - public Map importMovies(Map ranges) { - final Map movies=new LinkedHashMap(); - for (Map.Entry entry : ranges.entrySet()) { - for (int id = entry.getKey(); id <= entry.getValue(); id++) { - String result = importMovieFailsafe(id); - movies.put(id, result); - } - } - return movies; - } - - private String importMovieFailsafe(Integer id) { - try { - Movie movie = doImportMovie(String.valueOf(id)); - return movie.getTitle(); - } catch (Exception e) { - return e.getMessage(); - } - } - - @Transactional - public Movie importMovie(String movieId) { - return doImportMovie(movieId); - } - - private Movie doImportMovie(String movieId) { - logger.debug("Importing movie " + movieId); - - Movie movie = movieRepository.findById(movieId); - if (movie == null) { // Not found: Create fresh - movie = new Movie(movieId,null); - } - - Map data = loadMovieData(movieId); - if (data.containsKey("not_found")) throw new RuntimeException("Data for Movie "+movieId+" not found."); - movieDbJsonMapper.mapToMovie(data, movie); - movie.persist(); - relatePersonsToMovie(movie, data); - return movie; - } - - private Map loadMovieData(String movieId) { - if (localStorage.hasMovie(movieId)) { - return localStorage.loadMovie(movieId); - } - - Map data = client.getMovie(movieId); - localStorage.storeMovie(movieId, data); - return data; - } - - private void relatePersonsToMovie(Movie movie, Map data) { - Collection cast = (Collection) data.get("cast"); - for (Map entry : cast) { - String id = "" + entry.get("id"); - String jobName = (String) entry.get("job"); - Roles job = movieDbJsonMapper.mapToRole(jobName); - if (job==null) { - if (logger.isInfoEnabled()) logger.info("Could not add person with job "+jobName+" "+entry); - continue; - } - Person person = doImportPerson(id); - switch (job) { - case DIRECTED: - person.directed(movie); - break; - case ACTS_IN: - person.playedIn(movie, (String) entry.get("character")); - break; - } - } - } - - @Transactional - public Person importPerson(String personId) { - return doImportPerson(personId); - } - - private Person doImportPerson(String personId) { - logger.debug("Importing person " + personId); - Person person = personRepository.findById(personId); - if (person!=null) return person; - Map data = loadPersonData(personId); - if (data.containsKey("not_found")) throw new RuntimeException("Data for Person "+personId+" not found."); - Person newPerson=new Person(personId,null); - movieDbJsonMapper.mapToPerson(data, newPerson); - return newPerson.persist(); - } - - private Map loadPersonData(String personId) { - if (localStorage.hasPerson(personId)) { - return localStorage.loadPerson(personId); - } - Map data = client.getPerson(personId); - localStorage.storePerson(personId, data); - return localStorage.loadPerson(personId); - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieDbJsonMapper.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieDbJsonMapper.java deleted file mode 100644 index 6d83d6b90..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieDbJsonMapper.java +++ /dev/null @@ -1,708 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -import org.neo4j.cineasts.domain.Movie; -import org.neo4j.cineasts.domain.Person; -import org.neo4j.cineasts.domain.Roles; -import org.springframework.stereotype.Component; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.Map; - -@Component -public class MovieDbJsonMapper { - - public void mapToMovie(Map data, Movie movie) { - try { - movie.setTitle((String) data.get("name")); - movie.setLanguage((String) data.get("language")); - movie.setImdbId((String) data.get("imdb_id")); - movie.setTagline((String) data.get("tagline")); - movie.setDescription(limit((String) data.get("overview"), 500)); - movie.setReleaseDate(toDate(data, "released", "yyyy-MM-dd")); - movie.setRuntime((Integer) data.get("runtime")); - movie.setHomepage((String) data.get("homepage")); - movie.setTrailer((String) data.get("trailer")); - movie.setGenre(extractFirst(data, "genres", "name")); - movie.setStudio(extractFirst(data,"studios", "name")); - movie.setVersion((Integer)data.get("version")); - movie.setLastModified(toDate(data,"last_modified_at","yyyy-MM-dd HH:mm:ss")); - movie.setImageUrl(selectImageUrl((List) data.get("posters"), "poster", "mid")); - } catch (Exception e) { - throw new MovieDbException("Failed to map json for movie", e); - } - } - - private String selectImageUrl(List data, final String type, final String size) { - if (data==null) return null; - for (Map entry : data) { - Map image = (Map) entry.get("image"); - if (image.get("type").equals(type) && image.get("size").equals(size)) return (String) image.get("url"); - } - return null; - } - - - private String extractFirst(Map data, String field, String property) { - List inner = (List) data.get(field); - if (inner == null || inner.isEmpty()) return null; - return (String) inner.get(0).get(property); - } - - private Date toDate(Map data, String field, final String pattern) throws ParseException { - try { - String dateString = (String) data.get(field); - if (dateString == null || dateString.isEmpty()) return null; - return new SimpleDateFormat(pattern).parse(dateString); - } catch (Exception e) { - return null; - } - } - - /* - [{"popularity":3, -"translated":true, -"adult":false, -"language":"en", -"original_name":"[Rec]", -"name":"[Rec]", -"alternative_name":"[REC]", -"movie_type":"movie", -"id":8329, -"imdb_id":"tt1038988", -"url":"http://www.themoviedb.org/movie/8329", -"votes":11, -"rating":7.2, -"status":"Released", -"tagline":"One Witness. One Camera", -"certification":"R", -"overview":"\"REC\" turns on a young TV reporter and her cameraman who cover the night shift at the local fire station. Receiving a call from an old lady trapped in her house, -they reach her building to hear horrifying screams -- which begin a long nightmare and a uniquely dramatic TV report.", -"keywords":["terror", -"lebende leichen", -"obsession", -"camcorder", -"firemen", -"reality tv ", -"bite", -"cinematographer", -"attempt to escape", -"virus", -"lodger", -"live-reportage", -"schwerverletzt"], -"released":"2007-08-29", -"runtime":78, -"budget":0, -"revenue":0, -"homepage":"http://www.3l-filmverleih.de/rec", -"trailer":"http://www.youtube.com/watch?v=YQUkX_XowqI", -"genres":[{"type":"genre", -"url":"http://themoviedb.org/genre/horror", -"name":"Horror", -"id":27}], -"studios":[{"url":"http://www.themoviedb.org/company/2270", -"name":"Filmax Group", -"id":2270}], -"languages_spoken":[{"code":"es", -"name":"Spanish", -"native_name":"Espa\u00f1ol"}], -"countries":[{"code":"ES", -"name":"Spain", -"url":"http://www.themoviedb.org/country/es"}], -"posters":[{"image":{"type":"poster", -"size":"original", -"height":1000, -"width":706, -"url":"http://cf1.imgobject.com/posters/3a0/4cc8df415e73d650240003a0/rec-original.jpg", -"id":"4cc8df415e73d650240003a0"}}, -{"image":{"type":"poster", -"size":"mid", -"height":708, -"width":500, -"url":"http://cf1.imgobject.com/posters/3a0/4cc8df415e73d650240003a0/rec-mid.jpg", -"id":"4cc8df415e73d650240003a0"}}, -{"image":{"type":"poster", -"size":"cover", -"height":262, -"width":185, -"url":"http://cf1.imgobject.com/posters/3a0/4cc8df415e73d650240003a0/rec-cover.jpg", -"id":"4cc8df415e73d650240003a0"}}, -{"image":{"type":"poster", -"size":"thumb", -"height":130, -"width":92, -"url":"http://cf1.imgobject.com/posters/3a0/4cc8df415e73d650240003a0/rec-thumb.jpg", -"id":"4cc8df415e73d650240003a0"}}, -{"image":{"type":"poster", -"size":"original", -"height":1000, -"width":711, -"url":"http://cf1.imgobject.com/posters/1e7/4bc92117017a3c57fe00d1e7/rec-original.jpg", -"id":"4bc92117017a3c57fe00d1e7"}}, -{"image":{"type":"poster", -"size":"mid", -"height":703, -"width":500, -"url":"http://cf1.imgobject.com/posters/1e7/4bc92117017a3c57fe00d1e7/rec-mid.jpg", -"id":"4bc92117017a3c57fe00d1e7"}}, -{"image":{"type":"poster", -"size":"cover", -"height":260, -"width":185, -"url":"http://cf1.imgobject.com/posters/1e7/4bc92117017a3c57fe00d1e7/rec-cover.jpg", -"id":"4bc92117017a3c57fe00d1e7"}}, -{"image":{"type":"poster", -"size":"thumb", -"height":129, -"width":92, -"url":"http://cf1.imgobject.com/posters/1e7/4bc92117017a3c57fe00d1e7/rec-thumb.jpg", -"id":"4bc92117017a3c57fe00d1e7"}}, -{"image":{"type":"poster", -"size":"original", -"height":1500, -"width":1000, -"url":"http://cf1.imgobject.com/posters/1ec/4bc92118017a3c57fe00d1ec/rec-original.jpg", -"id":"4bc92118017a3c57fe00d1ec"}}, -{"image":{"type":"poster", -"size":"mid", -"height":750, -"width":500, -"url":"http://cf1.imgobject.com/posters/1ec/4bc92118017a3c57fe00d1ec/rec-mid.jpg", -"id":"4bc92118017a3c57fe00d1ec"}}, -{"image":{"type":"poster", -"size":"cover", -"height":278, -"width":185, -"url":"http://cf1.imgobject.com/posters/1ec/4bc92118017a3c57fe00d1ec/rec-cover.jpg", -"id":"4bc92118017a3c57fe00d1ec"}}, -{"image":{"type":"poster", -"size":"thumb", -"height":138, -"width":92, -"url":"http://cf1.imgobject.com/posters/1ec/4bc92118017a3c57fe00d1ec/rec-thumb.jpg", -"id":"4bc92118017a3c57fe00d1ec"}}, -{"image":{"type":"poster", -"size":"original", -"height":1429, -"width":1000, -"url":"http://cf1.imgobject.com/posters/1f1/4bc92118017a3c57fe00d1f1/rec-original.jpg", -"id":"4bc92118017a3c57fe00d1f1"}}, -{"image":{"type":"poster", -"size":"mid", -"height":715, -"width":500, -"url":"http://cf1.imgobject.com/posters/1f1/4bc92118017a3c57fe00d1f1/rec-mid.jpg", -"id":"4bc92118017a3c57fe00d1f1"}}, -{"image":{"type":"poster", -"size":"cover", -"height":265, -"width":185, -"url":"http://cf1.imgobject.com/posters/1f1/4bc92118017a3c57fe00d1f1/rec-cover.jpg", -"id":"4bc92118017a3c57fe00d1f1"}}, -{"image":{"type":"poster", -"size":"thumb", -"height":132, -"width":92, -"url":"http://cf1.imgobject.com/posters/1f1/4bc92118017a3c57fe00d1f1/rec-thumb.jpg", -"id":"4bc92118017a3c57fe00d1f1"}}, -{"image":{"type":"poster", -"size":"original", -"height":1125, -"width":800, -"url":"http://cf1.imgobject.com/posters/1f6/4bc92118017a3c57fe00d1f6/rec-original.jpg", -"id":"4bc92118017a3c57fe00d1f6"}}, -{"image":{"type":"poster", -"size":"mid", -"height":703, -"width":500, -"url":"http://cf1.imgobject.com/posters/1f6/4bc92118017a3c57fe00d1f6/rec-mid.jpg", -"id":"4bc92118017a3c57fe00d1f6"}}, -{"image":{"type":"poster", -"size":"cover", -"height":260, -"width":185, -"url":"http://cf1.imgobject.com/posters/1f6/4bc92118017a3c57fe00d1f6/rec-cover.jpg", -"id":"4bc92118017a3c57fe00d1f6"}}, -{"image":{"type":"poster", -"size":"thumb", -"height":129, -"width":92, -"url":"http://cf1.imgobject.com/posters/1f6/4bc92118017a3c57fe00d1f6/rec-thumb.jpg", -"id":"4bc92118017a3c57fe00d1f6"}}], -"backdrops":[{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/1df/4bc92117017a3c57fe00d1df/rec-original.jpg", -"id":"4bc92117017a3c57fe00d1df"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/1df/4bc92117017a3c57fe00d1df/rec-poster.jpg", -"id":"4bc92117017a3c57fe00d1df"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/1df/4bc92117017a3c57fe00d1df/rec-thumb.jpg", -"id":"4bc92117017a3c57fe00d1df"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/1d7/4bc92113017a3c57fe00d1d7/rec-original.jpg", -"id":"4bc92113017a3c57fe00d1d7"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/1d7/4bc92113017a3c57fe00d1d7/rec-poster.jpg", -"id":"4bc92113017a3c57fe00d1d7"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/1d7/4bc92113017a3c57fe00d1d7/rec-thumb.jpg", -"id":"4bc92113017a3c57fe00d1d7"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/1e3/4bc92117017a3c57fe00d1e3/rec-original.jpg", -"id":"4bc92117017a3c57fe00d1e3"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/1e3/4bc92117017a3c57fe00d1e3/rec-poster.jpg", -"id":"4bc92117017a3c57fe00d1e3"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/1e3/4bc92117017a3c57fe00d1e3/rec-thumb.jpg", -"id":"4bc92117017a3c57fe00d1e3"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/1d3/4bc92113017a3c57fe00d1d3/rec-original.jpg", -"id":"4bc92113017a3c57fe00d1d3"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/1d3/4bc92113017a3c57fe00d1d3/rec-poster.jpg", -"id":"4bc92113017a3c57fe00d1d3"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/1d3/4bc92113017a3c57fe00d1d3/rec-thumb.jpg", -"id":"4bc92113017a3c57fe00d1d3"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/1db/4bc92114017a3c57fe00d1db/rec-original.jpg", -"id":"4bc92114017a3c57fe00d1db"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/1db/4bc92114017a3c57fe00d1db/rec-poster.jpg", -"id":"4bc92114017a3c57fe00d1db"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/1db/4bc92114017a3c57fe00d1db/rec-thumb.jpg", -"id":"4bc92114017a3c57fe00d1db"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/6f4/4d0e39c25e73d637100016f4/rec-original.jpg", -"id":"4d0e39c25e73d637100016f4"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/6f4/4d0e39c25e73d637100016f4/rec-poster.jpg", -"id":"4d0e39c25e73d637100016f4"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/6f4/4d0e39c25e73d637100016f4/rec-thumb.jpg", -"id":"4d0e39c25e73d637100016f4"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/567/4d0e39dd5e73d6370a001567/rec-original.jpg", -"id":"4d0e39dd5e73d6370a001567"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/567/4d0e39dd5e73d6370a001567/rec-poster.jpg", -"id":"4d0e39dd5e73d6370a001567"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/567/4d0e39dd5e73d6370a001567/rec-thumb.jpg", -"id":"4d0e39dd5e73d6370a001567"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/58a/4d0e39fb5e73d6371c00158a/rec-original.jpg", -"id":"4d0e39fb5e73d6371c00158a"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/58a/4d0e39fb5e73d6371c00158a/rec-poster.jpg", -"id":"4d0e39fb5e73d6371c00158a"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/58a/4d0e39fb5e73d6371c00158a/rec-thumb.jpg", -"id":"4d0e39fb5e73d6371c00158a"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/5f4/4d0e3a185e73d6370e0015f4/rec-original.jpg", -"id":"4d0e3a185e73d6370e0015f4"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/5f4/4d0e3a185e73d6370e0015f4/rec-poster.jpg", -"id":"4d0e3a185e73d6370e0015f4"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/5f4/4d0e3a185e73d6370e0015f4/rec-thumb.jpg", -"id":"4d0e3a185e73d6370e0015f4"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/67f/4d0e3a395e73d6371600167f/rec-original.jpg", -"id":"4d0e3a395e73d6371600167f"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/67f/4d0e3a395e73d6371600167f/rec-poster.jpg", -"id":"4d0e3a395e73d6371600167f"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/67f/4d0e3a395e73d6371600167f/rec-thumb.jpg", -"id":"4d0e3a395e73d6371600167f"}}], -"cast":[{"name":"Manuela Velasco", -"job":"Actor", -"department":"Actors", -"character":"Angela Vidal", -"id":34793, -"order":0, -"cast_id":1, -"url":"http://www.themoviedb.org/person/34793", -"profile":"http://cf1.imgobject.com/profiles/390/4c0157fa017a3c702d001390/manuela-velasco-thumb.jpg"}, -{"name":"Carlos Lasarte", -"job":"Actor", -"department":"Actors", -"character":"C\u00e9sar", -"id":54519, -"order":2, -"cast_id":3, -"url":"http://www.themoviedb.org/person/54519", -"profile":"http://cf1.imgobject.com/profiles/ba6/4d27aa297b9aa134d3001ba6/carlos-lasarte-thumb.jpg"}, -{"name":"Pablo Rosso", -"job":"Actor", -"department":"Actors", -"character":"Marcos", -"id":54520, -"order":3, -"cast_id":4, -"url":"http://www.themoviedb.org/person/54520", -"profile":""}, -{"name":"David Vert", -"job":"Actor", -"department":"Actors", -"character":"Alex", -"id":54521, -"order":4, -"cast_id":5, -"url":"http://www.themoviedb.org/person/54521", -"profile":"http://cf1.imgobject.com/profiles/c7e/4d27aad57b9aa134cb001c7e/david-vert-thumb.jpg"}, -{"name":"Vicente Gil", -"job":"Actor", -"department":"Actors", -"character":"Polizist", -"id":54522, -"order":5, -"cast_id":6, -"url":"http://www.themoviedb.org/person/54522", -"profile":"http://cf1.imgobject.com/profiles/c86/4d27ab237b9aa134cb001c86/vicente-gil-thumb.jpg"}, -{"name":"Martha Carbonell", -"job":"Actor", -"department":"Actors", -"character":"Frau Izquierdo", -"id":54523, -"order":6, -"cast_id":7, -"url":"http://www.themoviedb.org/person/54523", -"profile":"http://cf1.imgobject.com/profiles/c90/4d27ab777b9aa134cb001c90/martha-carbonell-thumb.jpg"}, -{"name":"Carlos Vicente", -"job":"Actor", -"department":"Actors", -"character":"Guillem", -"id":54524, -"order":7, -"cast_id":8, -"url":"http://www.themoviedb.org/person/54524", -"profile":"http://cf1.imgobject.com/profiles/b0f/4d27abcc7b9aa134cf001b0f/carlos-vicente-thumb.jpg"}, -{"name":"Ferran Terraza", -"job":"Actor", -"department":"Actors", -"character":"Manu", -"id":54532, -"order":8, -"cast_id":22, -"url":"http://www.themoviedb.org/person/54532", -"profile":"http://cf1.imgobject.com/profiles/129/4c4bfbab7b9aa1237f000129/ferran-terraza-thumb.jpg"}, -{"name":"Jorge Yamam", -"job":"Actor", -"department":"Actors", -"character":"Sergio", -"id":147878, -"order":9, -"cast_id":23, -"url":"http://www.themoviedb.org/person/147878", -"profile":"http://cf1.imgobject.com/profiles/cbb/4d27ac677b9aa134dc001cbb/jorge-yamam-thumb.jpg"}, -{"name":"Jaume Balaguer\u00f3", -"job":"Director", -"department":"Directing", -"character":"", -"id":54525, -"order":0, -"cast_id":9, -"url":"http://www.themoviedb.org/person/54525", -"profile":""}, -{"name":"Paco Plaza", -"job":"Director", -"department":"Directing", -"character":"", -"id":54526, -"order":0, -"cast_id":10, -"url":"http://www.themoviedb.org/person/54526", -"profile":""}, -{"name":"Jaume Balaguer\u00f3", -"job":"Screenplay", -"department":"Writing", -"character":"", -"id":54525, -"order":0, -"cast_id":11, -"url":"http://www.themoviedb.org/person/54525", -"profile":""}, -{"name":"Paco Plaza", -"job":"Screenplay", -"department":"Writing", -"character":"", -"id":54526, -"order":0, -"cast_id":12, -"url":"http://www.themoviedb.org/person/54526", -"profile":""}, -{"name":"Luis Berdejo", -"job":"Screenplay", -"department":"Writing", -"character":"", -"id":54527, -"order":0, -"cast_id":13, -"url":"http://www.themoviedb.org/person/54527", -"profile":""}, -{"name":"Julio Fern\u00e1ndez", -"job":"Producer", -"department":"Production", -"character":"", -"id":17083, -"order":0, -"cast_id":14, -"url":"http://www.themoviedb.org/person/17083", -"profile":""}, -{"name":"Carlos Fern\u00e1ndez", -"job":"Executive Producer", -"department":"Production", -"character":"", -"id":37950, -"order":0, -"cast_id":15, -"url":"http://www.themoviedb.org/person/37950", -"profile":""}, -{"name":"Alberto Marini", -"job":"Producer", -"department":"Production", -"character":"", -"id":54528, -"order":0, -"cast_id":16, -"url":"http://www.themoviedb.org/person/54528", -"profile":""}, -{"name":"Pablo Rosso", -"job":"Director of Photography", -"department":"Camera", -"character":"", -"id":54520, -"order":0, -"cast_id":17, -"url":"http://www.themoviedb.org/person/54520", -"profile":""}, -{"name":"Gemma Fauria", -"job":"Set Designer", -"department":"Art", -"character":"", -"id":54529, -"order":0, -"cast_id":18, -"url":"http://www.themoviedb.org/person/54529", -"profile":""}, -{"name":"David Gallart", -"job":"Editor", -"department":"Editing", -"character":"", -"id":28500, -"order":0, -"cast_id":19, -"url":"http://www.themoviedb.org/person/28500", -"profile":""}, -{"name":"Xavier Mas", -"job":"Sound Designer", -"department":"Sound", -"character":"", -"id":54530, -"order":0, -"cast_id":20, -"url":"http://www.themoviedb.org/person/54530", -"profile":""}, -{"name":"Gl\u00f2ria Viguer", -"job":"Costume Design", -"department":"Costume \u0026 Make-Up", -"character":"", -"id":54531, -"order":0, -"cast_id":21, -"url":"http://www.themoviedb.org/person/54531", -"profile":""}], -"version":150, -"last_modified_at":"2011-02-20 23:16:57"}] - */ - - public void mapToPerson(Map data, Person person) { - try { - person.setName((String) data.get("name")); - person.setBirthday(toDate(data, "birthday", "yyyy-MM-dd")); - person.setBirthplace((String) data.get("birthplace")); - String biography = (String) data.get("biography"); - person.setBiography(limit(biography,500)); - person.setVersion((Integer) data.get("version")); - person.setProfileImageUrl(selectImageUrl((List) data.get("profile"), "profile", "profile")); - person.setLastModified(toDate(data,"last_modified_at","yyyy-MM-dd HH:mm:ss")); - } catch (Exception e) { - throw new MovieDbException("Failed to map json for person", e); - } - } - - private String limit(String text, int limit) { - if (text==null || text.length() < limit) return text; - return text.substring(0,limit); - } - -/* - [{"popularity":3, -"name":"Glenn Strange", -"known_as":[{"name":"George Glenn Strange"}, -{"name":"Glen Strange"}, -{"name":"Glen 'Peewee' Strange"}, -{"name":"Peewee Strange"}, -{"name":"'Peewee' Strange"}], -"id":30112, -"biography":"", -"known_movies":4, -"birthday":"1899-08-16", -"birthplace":"Weed, - New Mexico, - USA", -"url":"http://www.themoviedb.org/person/30112", -"filmography":[{"name":"Bud Abbott Lou Costello Meet Frankenstein", -"id":3073, -"job":"Actor", -"department":"Actors", -"character":"The Frankenstein Monster", -"cast_id":23, -"url":"http://www.themoviedb.org/movie/3073", -"poster":"http://cf1.imgobject.com/posters/4ca/4bc9185d017a3c57fe0094ca/bud-abbott-lou-costello-meet-frankenstein-cover.jpg", -"adult":false, -"release":"1948-06-15"}, -{"name":"Arizona Days (1937)", -"id":22367, -"job":"Actor", -"department":"Actors", -"character":"Henchman Pete ", -"cast_id":12, -"url":"http://www.themoviedb.org/movie/22367", -"poster":"", -"adult":false, -"release":"1937-01-30"}, -{"name":"House of Dracula", -"id":30793, -"job":"Actor", -"department":"Actors", -"character":"The Frankenstein Monster", -"cast_id":3, -"url":"http://www.themoviedb.org/movie/30793", -"poster":"http://cf1.imgobject.com/posters/7cf/4bc97660017a3c57fe0367cf/house-of-dracula-cover.jpg", -"adult":false, -"release":"1945-01-01"}, -{"name":"The Fargo Kid", -"id":38704, -"job":"Actor", -"department":"Actors", -"character":"Sheriff Dave", -"cast_id":24, -"url":"http://www.themoviedb.org/movie/38704", -"poster":"http://cf1.imgobject.com/posters/04e/4d74018a5e73d6021d00004e/the-fargo-kid-cover.jpg", -"adult":false, -"release":"1940-12-06"}], -"profile":[], -"version":19, -"last_modified_at":"2011-03-07 13:02:35"}] -*/ - - - public Roles mapToRole(String roleString) { - if (roleString.equals("Actor")) { - return Roles.ACTS_IN; - } - if (roleString.equals("Director")) { - return Roles.DIRECTED; - } - return null; - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieDbLocalStorage.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieDbLocalStorage.java deleted file mode 100644 index 199c47986..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieDbLocalStorage.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -import org.codehaus.jackson.map.ObjectMapper; - -import java.io.*; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -public class MovieDbLocalStorage { - - private String storagePath; - protected ObjectMapper mapper; - - public MovieDbLocalStorage(String storagePath) { - this.storagePath = storagePath; - ensureStorageDirectoryExists(); - mapper = new ObjectMapper(); - } - - private void ensureStorageDirectoryExists() { - File storageDirectory = new File(storagePath); - if (!storageDirectory.isDirectory()) { - if (!storageDirectory.mkdirs()) { - throw new RuntimeException("Failed to create storage dir"); - } - } - } - - public boolean hasMovie(String movieId) { - return fileForMovie(movieId).exists(); - } - - private File fileForMovie(String movieId) { - return new File(storagePath, String.format("movie_%s.json", movieId)); - } - - public Map loadMovie(String movieId) { - File storageFile = fileForMovie(movieId); - return loadJsonValue(storageFile); - } - - private Map loadJsonValue(File storageFile) { - try { - final Object value = mapper.readValue(storageFile, Object.class); - if (value instanceof List) { - List list = (List) value; - if (list.isEmpty() || list.get(0).equals("Nothing found.")) return Collections.singletonMap("not_found", System.currentTimeMillis()); - return asMap(list.get(0)); - } - return asMap(value); - } catch (Exception e) { - throw new MovieDbException("Failed to load JSON from storage for file " + storageFile.getPath(), e); - } - } - - private Map asMap(Object value) { - if (value instanceof Map) { - return (Map) value; - } - final String typeInformation = value == null ? "null" : value.getClass().getSimpleName(); - throw new MovieDbException("Wrong movie data format, expected Map/JSON-Object but was "+ typeInformation); - } - - public void storeMovie(String movieId, Object movieData) { - File storageFile = fileForMovie(movieId); - storeJsonValue(movieData, storageFile); - } - - private void storeJsonValue(Object jsonData, File storageFile) { - try { - mapper.writeValue(storageFile,jsonData); - } catch (Exception e) { - throw new MovieDbException("Failed to store JSON to storage for file " + storageFile.getPath(), e); - } - } - - public boolean hasPerson(String personId) { - return fileForPerson(personId).exists(); - } - - private File fileForPerson(String personId) { - return new File(storagePath, String.format("person_%s.json", personId)); - } - - public Map loadPerson(String personId) { - File storageFile = fileForPerson(personId); - return loadJsonValue(storageFile); - } - - public void storePerson(String personId, Object personJson) { - File storageFile = fileForPerson(personId); - storeJsonValue(personJson, storageFile); - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieImporter.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieImporter.java deleted file mode 100644 index 0fa2c0fe5..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/movieimport/MovieImporter.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -import org.springframework.context.support.FileSystemXmlApplicationContext; - -import java.util.Collections; -import java.util.Map; - -/** - * @author mh - * @since 04.10.11 - */ -public class MovieImporter { - - private final MovieDbImportService importer; - - public static void main(String[] args) { - final FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext("src/main/webapp/WEB-INF/applicationContext.xml"); - try { - final MovieDbImportService importer = ctx.getBean(MovieDbImportService.class); - final MovieImporter movieImporter = new MovieImporter(importer); - movieImporter.runImport(getMovieIdsToImport(args)); - } finally { - ctx.close(); - } - } - - public MovieImporter(MovieDbImportService importer) { - this.importer = importer; - } - - private void runImport(Map movieIdsToImport) { - final long start = System.currentTimeMillis(); - final Map result = importer.importMovies(movieIdsToImport); - final long time = System.currentTimeMillis() - start; - for (Map.Entry movie : result.entrySet()) { - System.out.println(movie.getKey() + "\t" + movie.getValue()); - } - System.out.println("Imported movies took "+ time+" ms."); - } - - private static Map getMovieIdsToImport(String[] args) { - if (args.length == 0) { - throw new IllegalArgumentException("Usage: MovieImporter 1 10000\nWorking Directory should be the cineasts directory with the json files in data/json."); - } - if (args.length == 1) { - return Collections.singletonMap(Integer.valueOf(args[0]), Integer.valueOf(args[0])); - } - return Collections.singletonMap(Integer.valueOf(args[0]), Integer.valueOf(args[1])); - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/repository/MovieRepository.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/repository/MovieRepository.java deleted file mode 100644 index ed09f6c91..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/repository/MovieRepository.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.neo4j.cineasts.repository; - -import org.neo4j.cineasts.domain.Movie; -import org.neo4j.cineasts.domain.MovieRecommendation; -import org.neo4j.cineasts.domain.User; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import org.springframework.data.neo4j.annotation.MapResult; -import org.springframework.data.neo4j.annotation.Query; -import org.springframework.data.neo4j.annotation.ResultColumn; -import org.springframework.data.neo4j.repository.GraphRepository; -import org.springframework.data.neo4j.repository.NamedIndexRepository; - -import java.util.List; - -/** - * @author mh - * @since 02.04.11 - */ -public interface MovieRepository extends GraphRepository, NamedIndexRepository { - Movie findById(String id); - - Page findByTitleLike(String title, Pageable page); - - @Query( "start user=node({0}) " + - " match user-[r:RATED]->movie<-[r2:RATED]-other-[r3:RATED]->otherMovie " + - " where r.stars >= 3 and r2.stars >= r.stars and r3.stars >= r.stars " + - " return otherMovie, avg(r3.stars) as rating, count(*) as cnt" + - " order by rating desc, cnt desc" + - " limit 10" ) - List getRecommendations( User user ); - -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/repository/PersonRepository.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/repository/PersonRepository.java deleted file mode 100644 index 65fbc3b2c..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/repository/PersonRepository.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.neo4j.cineasts.repository; - -import org.neo4j.cineasts.domain.Person; -import org.springframework.data.neo4j.repository.GraphRepository; - -/** - * @author mh - * @since 02.04.11 - */ -public interface PersonRepository extends GraphRepository { - Person findById(String id); -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/repository/UserRepository.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/repository/UserRepository.java deleted file mode 100644 index d879532be..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/repository/UserRepository.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.neo4j.cineasts.repository; - -import org.neo4j.cineasts.domain.User; -import org.springframework.data.neo4j.repository.GraphRepository; - -/** - * @author mh - * @since 02.04.11 - */ -public interface UserRepository extends GraphRepository { -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/CineastsRepository.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/CineastsRepository.java deleted file mode 100644 index da2933071..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/CineastsRepository.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.neo4j.cineasts.service; - -import org.neo4j.cineasts.repository.MovieRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -/** - * @author mh - * @since 04.03.11 - */ -@Repository -@Transactional -public class CineastsRepository { - - @Autowired private MovieRepository movieRepository; - - -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/CineastsUserDetails.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/CineastsUserDetails.java deleted file mode 100644 index 0bad6f7c3..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/CineastsUserDetails.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.neo4j.cineasts.service; - -import org.neo4j.cineasts.domain.User; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.userdetails.UserDetails; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - -/** -* @author mh -* @since 07.03.11 -*/ -public class CineastsUserDetails implements UserDetails { - private final User user; - - public CineastsUserDetails(User user) { - this.user = user; - } - - @Override - public Collection getAuthorities() { - User.Roles[] roles = user.getRole(); - if (roles ==null) return Collections.emptyList(); - return Arrays.asList(roles); - } - - @Override - public String getPassword() { - return user.getPassword(); - } - - @Override - public String getUsername() { - return user.getLogin(); - } - - @Override - public boolean isAccountNonExpired() { - return true; - } - - @Override - public boolean isAccountNonLocked() { - return true; - } - - @Override - public boolean isCredentialsNonExpired() { - return true; - } - - @Override - public boolean isEnabled() { - return true; - } - - public User getUser() { - return user; - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/CineastsUserDetailsService.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/CineastsUserDetailsService.java deleted file mode 100644 index 094dc040c..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/CineastsUserDetailsService.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.neo4j.cineasts.service; - -import org.neo4j.cineasts.domain.Movie; -import org.neo4j.cineasts.domain.User; -import org.neo4j.cineasts.repository.UserRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContext; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -/** - * @author mh - * @since 06.03.11 - */ -@Service -public class CineastsUserDetailsService implements UserDetailsService { - - @Autowired - private UserRepository userRepository; - - @Override - public UserDetails loadUserByUsername(String login) throws UsernameNotFoundException, DataAccessException { - final User user = findUser(login); - if (user==null) throw new UsernameNotFoundException("Username not found",login); - return new CineastsUserDetails(user); - } - - public User findUser(String login) { - return userRepository.findByPropertyValue("login",login); - } - - - public User getUserFromSession() { - SecurityContext context = SecurityContextHolder.getContext(); - Authentication authentication = context.getAuthentication(); - Object principal = authentication.getPrincipal(); - if (principal instanceof CineastsUserDetails) { - CineastsUserDetails userDetails = (CineastsUserDetails) principal; - return userDetails.getUser(); - } - return null; - } - - @Transactional - public User register(String login, String name, String password) { - User found = findUser(login); - if (found!=null) throw new RuntimeException("Login already taken: "+login); - if (name==null || name.isEmpty()) throw new RuntimeException("No name provided."); - if (password==null || password.isEmpty()) throw new RuntimeException("No password provided."); - User user=userRepository.save(new User(login,name,password,User.Roles.ROLE_USER)); - setUserInSession(user); - return user; - } - - private void setUserInSession(User user) { - SecurityContext context = SecurityContextHolder.getContext(); - CineastsUserDetails userDetails = new CineastsUserDetails(user); - UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, user.getPassword(),userDetails.getAuthorities()); - context.setAuthentication(authentication); - - } - - @Transactional - public void addFriend(String login) { - User friend = findUser(login); - User user = getUserFromSession(); - if (!user.equals(friend)) { - user.addFriend(friend); - } - } - - @Transactional - public void rate(User user, Movie movie, Integer stars, String comment) { - if (user == null || movie == null) return; - int stars1 = stars==null ? -1 : stars; - String comment1 = comment!=null ? comment.trim() : null; - user.rate(movie, stars1, comment1); - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/DatabasePopulator.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/DatabasePopulator.java deleted file mode 100644 index 00740c8b1..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/DatabasePopulator.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.neo4j.cineasts.service; - -import org.neo4j.cineasts.repository.MovieRepository; -import org.neo4j.kernel.AbstractGraphDatabase; -import org.neo4j.cineasts.domain.*; -import org.neo4j.cineasts.movieimport.MovieDbImportService; -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.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.List; - -import static java.util.Arrays.asList; - -/** - * @author mh - * @since 04.03.11 - */ -@Service -public class DatabasePopulator { - - @Autowired - Neo4jTemplate ctx; - @Autowired - MovieRepository movieRepository; - - @Autowired - MovieDbImportService importService; - private final static Logger log = LoggerFactory.getLogger(DatabasePopulator.class); - - @Transactional - public List populateDatabase() { - User me = new User("micha", "Micha", "password", User.Roles.ROLE_ADMIN,User.Roles.ROLE_USER).persist(); - User ollie = new User("ollie", "Olliver", "password",User.Roles.ROLE_USER).persist(); - me.addFriend(ollie); - List ids = asList(19995 , 194, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 13, 20526, 11, 1893, 1892, 1894, 168, 193, 200, 157, 152, 201, 154, 12155, 58, 285, 118, 22, 392, 5255, 568, 9800, 497, 101, 120, 121, 122); - List result=new ArrayList(ids.size()); - for (Integer id : ids) { - result.add(importService.importMovie(String.valueOf(id))); - } - - //me.rate(repository.getMovie("13"),5,"Inspiring"); - me.rate(movieRepository.findById("603"),5,"Best of the series"); - return result; - } - - @Transactional - public void cleanDb() { - new Neo4jDatabaseCleaner((AbstractGraphDatabase) ctx.getGraphDatabaseService()).cleanDb(); - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/FriendsMovieRecommendations.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/FriendsMovieRecommendations.java deleted file mode 100644 index 9f63b5b01..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/FriendsMovieRecommendations.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.neo4j.cineasts.service; - -import org.neo4j.cineasts.domain.Movie; -import org.neo4j.cineasts.domain.Rating; -import org.neo4j.cineasts.domain.User; -import org.neo4j.graphdb.traversal.Evaluators; -import org.neo4j.graphdb.traversal.TraversalDescription; -import org.neo4j.kernel.Traversal; -import org.neo4j.kernel.Uniqueness; -import org.springframework.data.neo4j.core.EntityPath; - -import java.util.HashMap; -import java.util.Map; - -import static org.neo4j.graphdb.DynamicRelationshipType.withName; - -/** - * @author mh - * @since 04.04.11 - */ -public class FriendsMovieRecommendations { - private final Map ratings = new HashMap(); - private final int ratingDistance; - - public static class MovieRating { - int stars; - int count; - public void update(Rating rating, int weight) { - this.stars += rating.getStars()*weight; - this.count += weight; - } - public int average() { - return count == 0 ? 0 : stars / count; - } - public String toString() { - return String.valueOf(average()); - } - - } - public FriendsMovieRecommendations(int ratingDistance) { - this.ratingDistance = ratingDistance; - } - - public Map getRecommendationsFor(User user) { - TraversalDescription traversal = Traversal.description().breadthFirst() - .uniqueness(Uniqueness.NODE_GLOBAL).relationships(withName(User.FRIEND)) - .evaluator(Evaluators.toDepth(ratingDistance)).evaluator(Evaluators.excludeStartPosition()); - - Iterable result = user.findAllPathsByTraversal(traversal); - Iterable> friends = (Iterable>)result; - for (EntityPath path : friends) { - int weight = ratingDistance - path.length(); - User friend = path.endEntity(); - aggregateRatings(friend,weight); - } - for (Rating rating : user.getRatings()) { - ratings.remove(rating.getMovie()); - } - return ratings; - } - - private void aggregateRatings(User friend, int weight) { - for (Rating rating : friend.getRatings()) { - obtainRating(rating.getMovie()).update(rating, weight); - } - } - - private MovieRating obtainRating(Movie movie) { - if (!ratings.containsKey(movie)) { - ratings.put(movie, new MovieRating()); - } - return ratings.get(movie); - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/MovieRecommendations.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/MovieRecommendations.java deleted file mode 100644 index ac262f5de..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/MovieRecommendations.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.neo4j.cineasts.service; - -import org.neo4j.cineasts.domain.Movie; -import org.neo4j.cineasts.domain.User; -import org.neo4j.cineasts.repository.MovieRepository; -import org.neo4j.graphdb.Path; -import org.neo4j.graphdb.Relationship; -import org.neo4j.graphdb.traversal.Evaluation; -import org.neo4j.graphdb.traversal.Evaluator; -import org.neo4j.graphdb.traversal.TraversalDescription; -import org.neo4j.kernel.Traversal; -import org.neo4j.kernel.Uniqueness; - -import java.util.HashMap; -import java.util.Map; - -import static org.neo4j.graphdb.Direction.OUTGOING; -import static org.neo4j.graphdb.DynamicRelationshipType.withName; - -/** -* @author mh -* @since 04.04.11 -*/ -class MovieRecommendations implements Evaluator { - private final Map ratings=new HashMap(); - private final int ratingDistance; - private MovieRepository movieRepository; - - public MovieRecommendations(MovieRepository movieRepository, int ratingDistance) { - this.movieRepository = movieRepository; - this.ratingDistance = ratingDistance; - } - - public Map getRecommendationsFor(User user) { - TraversalDescription traversal= Traversal.description().breadthFirst() - .uniqueness(Uniqueness.NODE_PATH) - .relationships(withName(User.FRIEND)) - .relationships(withName(User.RATED), OUTGOING) - .evaluator(this); - return averageRecommendations(user, traversal); - } - - private Map averageRecommendations(User user, TraversalDescription traversal) { // todo sort, limit - Map result=new HashMap(); - for (Movie movie : movieRepository.findAllByTraversal(user, traversal)) { - final int[] rating = ratings.get(movie.getNodeId()); - result.put(movie, rating[1]==0 ? 0 : rating[0]/rating[1]); - } - return result; - } - - @Override - public Evaluation evaluate(Path path) { - final int distance = path.length() - 1; - if (distance > ratingDistance) return Evaluation.EXCLUDE_AND_PRUNE; - Relationship rated = path.lastRelationship(); - if (rated != null && rated.getType().name().equals(User.RATED)) { - if (distance == 0) return Evaluation.EXCLUDE_AND_PRUNE; // my rated movies - updateRating(rated, distance); - return Evaluation.INCLUDE_AND_PRUNE; - } - System.out.println(); - return Evaluation.EXCLUDE_AND_CONTINUE; - } - - private void updateRating(Relationship rated, int distance) { - final long movieId = rated.getEndNode().getId(); - int[] rating = obtainRating(movieId); - - int weight = ratingDistance - distance; - final Integer stars = (Integer) rated.getProperty("stars", 0); - rating[0] += weight * stars; - rating[1] += weight; - } - - private int[] obtainRating(long movieId) { - if (!ratings.containsKey(movieId)) { - ratings.put(movieId,new int[2]); - } - return ratings.get(movieId); - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/Neo4jDatabaseCleaner.java b/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/Neo4jDatabaseCleaner.java deleted file mode 100644 index 9f71038f6..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/java/org/neo4j/cineasts/service/Neo4jDatabaseCleaner.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.neo4j.cineasts.service; - -import org.neo4j.graphdb.Direction; -import org.neo4j.graphdb.Node; -import org.neo4j.graphdb.Relationship; -import org.neo4j.graphdb.Transaction; -import org.neo4j.graphdb.index.IndexManager; -import org.neo4j.kernel.AbstractGraphDatabase; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -/** - * @author mh - * @since 02.03.11 - */ -public class Neo4jDatabaseCleaner { - private AbstractGraphDatabase graph; - - public Neo4jDatabaseCleaner(AbstractGraphDatabase graph) { - this.graph = graph; - } - - public Map cleanDb() { - Map result = new HashMap(); - Transaction tx = graph.beginTx(); - try { - removeNodes(result); - clearIndex(result); - tx.success(); - } finally { - tx.close(); - } - return result; - } - - private void removeNodes(Map result) { - Node refNode = graph.getReferenceNode(); - int nodes = 0, relationships = 0; - for (Node node : graph.getAllNodes()) { - for (Relationship rel : node.getRelationships(Direction.OUTGOING)) { - rel.delete(); - relationships++; - } - if (!refNode.equals(node)) { - node.delete(); - nodes++; - } - } - result.put("nodes", nodes); - result.put("relationships", relationships); - - } - - private void clearIndex(Map result) { - IndexManager indexManager = graph.index(); - result.put("node-indexes", Arrays.asList(indexManager.nodeIndexNames())); - result.put("relationship-indexes", Arrays.asList(indexManager.relationshipIndexNames())); - for (String ix : indexManager.nodeIndexNames()) { - indexManager.forNodes(ix).delete(); - } - for (String ix : indexManager.relationshipIndexNames()) { - indexManager.forRelationships(ix).delete(); - } - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/resources/log4j.properties b/spring-data-neo4j-examples/cineasts-aspects/src/main/resources/log4j.properties deleted file mode 100644 index 37867140a..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/resources/log4j.properties +++ /dev/null @@ -1,7 +0,0 @@ -log4j.rootLogger=warn, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout - -#log4j.category.org.springframework.web=DEBUG - diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/applicatioContext-security.xml b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/applicatioContext-security.xml deleted file mode 100644 index 9f1321d68..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/applicatioContext-security.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/applicationContext.xml b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/applicationContext.xml deleted file mode 100644 index c2ccf767e..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/applicationContext.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/decorators.xml b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/decorators.xml deleted file mode 100644 index 1dab375ce..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/decorators.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - / - - - /* - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml deleted file mode 100644 index 2f428fc98..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/actors/show.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/actors/show.jsp deleted file mode 100644 index fffb8c52e..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/actors/show.jsp +++ /dev/null @@ -1,36 +0,0 @@ -<%@ page session="false" %> -<%@ taglib uri="http://www.springframework.org/tags" prefix="s" %> -<%@ 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"--%> - - -
-
-
-
-

${actor.name}

-

Born in ${actor.birthplace}.

-
-
-
-
-

Biography

-

${actor.biography}

-

Roles

- - - -
-
- -

Actor cannot be found.

-
-
diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/auth/deniedpage.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/auth/deniedpage.jsp deleted file mode 100644 index 7057a169d..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/auth/deniedpage.jsp +++ /dev/null @@ -1,7 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" %> - - - Access denied - - Unfortunately you are not authorized to see this page. - diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/auth/loginpage.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/auth/loginpage.jsp deleted file mode 100644 index 4ac9ab507..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/auth/loginpage.jsp +++ /dev/null @@ -1,36 +0,0 @@ -<%@ page import="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> -<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %> - -<%@ page language="java" contentType="text/html; charset=UTF-8" -pageEncoding="UTF-8"%> - - - - - Login - - - -

Login

-
${error}
- -
-

- - -

-

- - -

-

- Remember me -

- -

- Register - - diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/auth/registerpage.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/auth/registerpage.jsp deleted file mode 100644 index 4a9c2d6e0..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/auth/registerpage.jsp +++ /dev/null @@ -1,37 +0,0 @@ -<%@ page import="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> -<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %> - -<%@ page language="java" contentType="text/html; charset=UTF-8" -pageEncoding="UTF-8"%> - - - - - Login - - - -

Login

-
${error}
- -
-

- - -

-

- - -

-

- - -

- -
-
- Login - - diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/decorators/frontpage.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/decorators/frontpage.jsp deleted file mode 100644 index 4d82b031f..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/decorators/frontpage.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" - prefix="decorator" %> -<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> - - - - - Cineasts.net - <decorator:title default="Welcome" /> - - - <%@ include file="/WEB-INF/views/includes/style.jsp" %> - <%@ include file="/WEB-INF/views/includes/js.jsp" %> - - - -
- -
- <%@ include file="/WEB-INF/views/includes/footer.jsp" %> - - diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/decorators/main.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/decorators/main.jsp deleted file mode 100644 index 96d6d65c6..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/decorators/main.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" - prefix="decorator" %> -<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> - - - - - Cineasts.net - <decorator:title default="Welcome" /> - - - <%@ include file="/WEB-INF/views/includes/style.jsp" %> - <%@ include file="/WEB-INF/views/includes/js.jsp" %> - - - -
- -
- <%@ include file="/WEB-INF/views/includes/footer.jsp" %> - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/import/result.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/import/result.jsp deleted file mode 100644 index 5c9f63b43..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/import/result.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ page session="false" %> -<%@ taglib uri="http://www.springframework.org/tags" prefix="s" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> - -

Results for importing movies: "${ids}"

- -

Imported of ${fn:length(movies)} movies took ${duration} seconds.

- -
- -
${entry.key}
-
${entry.value}
-
-
diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/footer.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/footer.jsp deleted file mode 100644 index 1ddcc0b6b..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/footer.jsp +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/header-frontpage.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/header-frontpage.jsp deleted file mode 100644 index c851575ab..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/header-frontpage.jsp +++ /dev/null @@ -1,3 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" session="false" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/header.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/header.jsp deleted file mode 100644 index c851575ab..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/header.jsp +++ /dev/null @@ -1,3 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" session="false" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/header_login.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/header_login.jsp deleted file mode 100644 index 39d5c4d3e..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/header_login.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" session="false" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - - diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/js.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/js.jsp deleted file mode 100644 index e69de29bb..000000000 diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/links.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/links.jsp deleted file mode 100644 index e69de29bb..000000000 diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/navigation.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/navigation.jsp deleted file mode 100644 index 484da2378..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/navigation.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" session="false" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - - diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/search.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/search.jsp deleted file mode 100644 index 0aebd4917..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/search.jsp +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/style.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/style.jsp deleted file mode 100644 index 1d77d9f54..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/includes/style.jsp +++ /dev/null @@ -1,4 +0,0 @@ - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/index.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/index.jsp deleted file mode 100644 index 049b8fe23..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/index.jsp +++ /dev/null @@ -1,11 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" session="false" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -
-

Welcome to Cineasts.net

-
-
- - -
-
-
\ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/movies/list.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/movies/list.jsp deleted file mode 100644 index 0aabbaaf0..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/movies/list.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@ page session="false" %> -<%@ taglib uri="http://www.springframework.org/tags" prefix="s" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - -

Results for "${query}"

- - - - - - -

No movies found for query "${query}".

-
-
diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/movies/show.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/movies/show.jsp deleted file mode 100644 index 9e47500bc..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/movies/show.jsp +++ /dev/null @@ -1,170 +0,0 @@ -<%@ page session="false" %> -<%@ taglib uri="http://www.springframework.org/tags" prefix="s" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> -<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> - - -${movie.title} - - - -
-
- <%--@elvariable id="movie" type="org.neo4j.cineasts.domain.Movie"--%> - - -
"/>
-
-

${movie.title} (${movie.year}) ${stars} stars

-
-

<${movie.tagline}

-
-
- -
-

Movie facts

- - - - - - - - - - - - - - - - - - - - - - - - - - -
Language${movie.language}
Runtime${movie.runtime} Minutes
Genre${movie.genre}
Other sitesTheMovieDb.org | - IMDb -
Buy DVDs & Books">Amazon | - ">CineButler -
In Cinemas">Google Movies -
-
- -
- -

Trailers

- - - - - - - - - -
-
- -
-

Release info

- -
    -
  • - - - - - - - - - - - - - - - -
    Released
    Homepage
    Studio${movie.studio}
    -
  • -
-
- -
-
-
-
-

Overview

-

${movie.description}

- -

Cast

- - -
-
- -

Reviews

- - -
"> -

Give - - - - to "${movie.title}" saying: - - - -

-
- -
- - - -
-
-
-
- -

No movie found

-

The movie you were looking for could not be found.

-
-
- diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/user/index.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/user/index.jsp deleted file mode 100644 index 9a852cc1e..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/user/index.jsp +++ /dev/null @@ -1,104 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%--@elvariable id="user" type="org.neo4j.cineasts.domain.User"--%> -<%--@elvariable id="recommendations" type="java.util.List"--%> -<%--@elvariable id="recommendation" type="org.neo4j.cineasts.domain.MovieRecommendation"--%> - - - Profile - - - -
-
-
" />
-
-

Hi ${user.name}!

-

${user.info}

-
-
-
- - - -

Your friends

-
    - -
  • - ">" /> -
    -

    ">

    -

    ${friend.info}

    -
    -
    -
  • -
    -
-
- -

You don't have any friends yet

-
-
-
-
-
-
-

Your rated movies

-
- -
-

${fn:length(ratings)}

-
- -
- -
-

Your recommendations

-
-
-

${fn:length(recommendations)}

-
- -
-
-
- - - diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/user/public.jsp b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/user/public.jsp deleted file mode 100644 index 9b46bae21..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/views/user/public.jsp +++ /dev/null @@ -1,86 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%--@elvariable id="user" type="org.neo4j.cineasts.domain.User"--%> - - - Profile for ${name} - - -
-
-
" />
-
-

${name}

-

${profiled.info}

-
-
-
- -

${name}'s friends

- - - - - -
    - -
  • - ">" /> -
    -

    ">

    -

    ${friend.info}

    -
    -
    -
  • -
    -
-
- - ${name} has no friends. - -
-
- -
- Add ${name} as a friend. -
-
-
-
- -
-
-
-

${name}'s rated movies

-
-
-

${fn:length(ratings)}

-
- - - -
-
-
- - diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/web.xml b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index f2420a9a0..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - contextConfigLocation - - /WEB-INF/applicatioContext-security.xml - /WEB-INF/applicationContext.xml - - - - - org.springframework.web.context.ContextLoaderListener - - - - sitemesh - - com.opensymphony.module.sitemesh.filter.PageFilter - - - - - springSecurityFilterChain - org.springframework.web.filter.DelegatingFilterProxy - - - - springSecurityFilterChain - /* - - - - sitemesh - /* - - - - dispatcherServlet - org.springframework.web.servlet.DispatcherServlet - 1 - - - - dispatcherServlet - / - - - - index.jsp - - - - 60 - - diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/actor-picture-frame.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/actor-picture-frame.png deleted file mode 100644 index cb58bc5a9..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/actor-picture-frame.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/cineasts.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/cineasts.png deleted file mode 100644 index e7778456b..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/cineasts.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/filmroll-horizontal.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/filmroll-horizontal.png deleted file mode 100644 index e4d71d2c2..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/filmroll-horizontal.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/filmroll-vertical-full.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/filmroll-vertical-full.png deleted file mode 100644 index 3270bbd07..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/filmroll-vertical-full.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/header-curtain.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/header-curtain.png deleted file mode 100644 index 5b23f8ec7..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/header-curtain.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/header-splash-bg.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/header-splash-bg.png deleted file mode 100644 index e4f78a20a..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/header-splash-bg.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo-splash.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo-splash.png deleted file mode 100644 index 2d1815a1e..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo-splash.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo.png deleted file mode 100644 index 98fbfde7c..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo/neo4j.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo/neo4j.png deleted file mode 100644 index c96c298ed..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo/neo4j.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo/springdata.jpg b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo/springdata.jpg deleted file mode 100644 index a45ae83da..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo/springdata.jpg and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo/springdatagraph.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo/springdatagraph.png deleted file mode 100644 index df46c007f..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo/springdatagraph.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo/springsource.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo/springsource.png deleted file mode 100644 index e573cde33..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/logo/springsource.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/movie-placeholder.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/movie-placeholder.png deleted file mode 100644 index cc73fce08..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/movie-placeholder.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/neo4j.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/neo4j.png deleted file mode 100644 index ee5cac71c..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/neo4j.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/profile-placeholder-small.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/profile-placeholder-small.png deleted file mode 100644 index 44dc7e19f..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/profile-placeholder-small.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/profile-placeholder.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/profile-placeholder.png deleted file mode 100644 index 66ff4f73d..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/profile-placeholder.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_0.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_0.png deleted file mode 100644 index bf5766366..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_0.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_1.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_1.png deleted file mode 100644 index 48730c132..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_1.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_2.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_2.png deleted file mode 100644 index b91aa3345..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_2.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_3.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_3.png deleted file mode 100644 index fe3eb1757..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_3.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_4.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_4.png deleted file mode 100644 index 2e55bb019..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_4.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_5.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_5.png deleted file mode 100644 index faddfa4a1..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rated_5.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rating-active.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rating-active.png deleted file mode 100644 index 50b708b33..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rating-active.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rating-disabled.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rating-disabled.png deleted file mode 100644 index 32cfa2c85..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/rating-disabled.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/searchbar-big-searchicon.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/searchbar-big-searchicon.png deleted file mode 100644 index eca23c8e7..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/searchbar-big-searchicon.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/searchbar-big.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/searchbar-big.png deleted file mode 100644 index faf80be44..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/searchbar-big.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/springdata.jpg b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/springdata.jpg deleted file mode 100644 index 90f4de574..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/springdata.jpg and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/springdatagraph.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/springdatagraph.png deleted file mode 100644 index 1718b3475..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/springdatagraph.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/springsource.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/springsource.png deleted file mode 100644 index 36b42b001..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/springsource.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/star.png b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/star.png deleted file mode 100644 index 983454b95..000000000 Binary files a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/images/star.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/resources/forms.css b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/resources/forms.css deleted file mode 100644 index 2f3103131..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/resources/forms.css +++ /dev/null @@ -1,13 +0,0 @@ -label { - display: block; - float: left; - width: 120px; -} - -/** - * Label for radio buttons, normal buttons and checkboxes. - */ -label.button-label { - display:inline; - float:none; -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/resources/grid.css b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/resources/grid.css deleted file mode 100644 index 881cf609a..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/resources/grid.css +++ /dev/null @@ -1,18 +0,0 @@ -.span-1 { width: 6.958%; float:left; margin-right:1.5%; } -.span-2 { width: 15.416%; float:left; margin-right:1.5%; } -.span-3 { width: 23.875%; float:left; margin-right:1.5%; } -.span-4 { width: 32.333%; float:left; margin-right:1.5%; } -.span-5 { width: 40.791%; float:left; margin-right:1.5%; } -.span-6 { width: 49.250%; float:left; margin-right:1.5%; } -.span-7 { width: 57.708%; float:left; margin-right:1.5%; } -.span-8 { width: 66.166%; float:left; margin-right:1.5%; } -.span-9 { width: 74.625%; float:left; margin-right:1.5%; } -.span-10 { width: 83.083%; float:left; margin-right:1.5%; } -.span-11 { width: 91.541%; float:left; margin-right:1.5%; } -.span-12 { width: 100%; float:left; margin-right:0%; } - -.span-third { width: 32%; float:left; margin-right:2%; } -.span-half { width: 49%; float:left; margin-right:2%; } -.span-all { width: 100%; float:left; clear:right; } - -.last { clear:right; margin-right:0; } diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/resources/style.css b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/resources/style.css deleted file mode 100644 index 316a5a2a5..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/resources/style.css +++ /dev/null @@ -1,328 +0,0 @@ - -@import url(typography.css); -@import url(forms.css); -@import url(grid.css); - -* { - outline-style: none; -} - -body { - margin:0; - padding:0; - background : #010100; -} - -a img { border:0; } - -/** - * MAIN COMPONENTS - */ - -#header { - background: url(../images/header-curtain.png) repeat-y bottom center #010100; - border-bottom: 1px solid #5C5C45; -} - -#logo img { - padding: 10px 10px 0; -} - -#header-topbar { - height: 49px; - padding: 0 0 0 10px; - background: url(../images/filmroll-horizontal.png) repeat-x bottom left transparent; -} - -#header-splash { - text-align:center; - background: url(../images/header-splash-bg.png) repeat-x bottom center; -} - -#logo-splash { - position:relative; - top:4px; -} - - -#header-menu { - float: right; - color: #DDDDDD; - height:28px; - background:#0b0f07; - padding: 10px 10px; -} - -.search { - float:left; - padding:0 10px; -} - -.navigation { - float:left; -} - -.navigation a { - color: #d8d8d8; - text-decoration:none; - padding: 0 0 0 5px; -} - -#content { - padding: 10px; -} - -#footer { - text-align:center; - color: #999999; - font-size: 12px; - padding: 10px; - clear:both; -} - -#footer img { - padding: 10px; -} -/** - * SEARCH RESULTS - */ - -.search-results > li { - border-top: 1px solid #666666; - padding: 10px; -} - -.search-result-details { -/* float:left; - padding: 0px 10px; - */ -} - -/** - * PROFILE, ACTOR AND MOVIE PAGES - */ - -.profile-header { - clear:both; -} - -.profile-image { - float:left; -} - -.profile-image img { - width: 100px; -} -.actor-image img, .profile-image img, .friend-image img, .thumbnail img { - border: 1px solid #4C5C2A !important; -} - -.thumbnail { - display:block; - /* float:left;*/ -} -.thumbnail img { - height: 100px; -} - -.actor-framed-image { - background: url(../images/actor-picture-frame.png) no-repeat; - width:166px; - height:214px; - padding: 6px 60px 16px; -} - -.actor-sidebar { - padding: 0 56px; -} - -.profile-header-details { - float: left; - padding: 0 10px; -} - -.profile-feed { - background: none repeat scroll 0 0 #252525; - border: 5px solid #CACF81; - padding: 10px; -} - -.facts { - width:50%; - float:left; -} - -.movie-content-outer, .actor-content-outer { - background: url(../images/filmroll-vertical-full.png) no-repeat top right; - padding-right: 38px; -} - -.movie-content, .actor-content { - background: url(../images/filmroll-vertical-full.png) no-repeat top left; - padding: 0 10px 0 48px; - min-height:690px; -} - -.actors-list li { - width:100px; - float:left; -} - -.actors-list img { - height:92px; - display:block; -} - -.friends-list li { - border-top:1px solid #333; - padding: 5px 0; -} - -.friends-list .friend-image { - float:left; -} - -.friend-image img { - height: 64px; -} -.friends-list .friend-info { - float:left; - padding: 0 5px; -} - -.friends-list h3, .search-results h3 { - border:none; - margin: 5px 0; -} - -.friends-list h3 a, .search-results h3 a { - text-decoration:none; - color: #99CC33; -} - -.rated-movies-list h3 { - margin: 0; - padding: 5px 0; - float: left; -} - -.rated-movies-list h3 a { - color: #99CC33; - text-decoration:none; -} - -.rated-movies-list li { - position:relative; - height:20px; - padding:8px 0; -} - -.rated-movies-list .rating { -/* position:absolute; - right:0; - top:5px; -*/ - float: right; -} - -/** - * BIG SEARCH - */ - -#big-search-wrap { - padding: 20px 0; - text-align: center; -} - -.big-search { - background: url("../images/searchbar-big.png") no-repeat scroll 0 0 transparent; - border: 0 none; - height: 50px; - width: 480px; - font-size: 22px; - padding: 0 10px; -} - -.big-search-submit { - background: url("../images/searchbar-big-searchicon.png") no-repeat scroll 0 0 transparent; - border: 0 none; - color: transparent; - cursor: pointer; - height: 40px; - left: -75px; - position: relative; - width: 41px; -} - -/** - * RATINGS - */ - -.rating-input li, .rating-input lh { - float:left; -} - -.rating { - display: block; - height: 20px; - width: 110px; -} - -.rating li { - height: 28px; - width: 22px; - display:block; - float:left; - padding:0 2px; -} - -.rating li.active { - background: url("/images/rating-active.png") no-repeat scroll center 0 transparent; -} - -.rating li.disabled { -/* background: url("/images/rating-disabled.png") no-repeat scroll center 0 transparent; */ -} - -/** - * TABLES - */ - -table th { - text-align: left; -} - -/** - * LISTS - */ - -ul { - list-style:none; - padding:0; -} - -lh { - font-weight:bold; -} - -/** - * UTILS - */ - -.break { - clear:both; -} - - -/** - * ERRORS - */ - -.error { - color:red; -} - -a { - text-decoration: none; - color: #99CC33; -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/resources/typography.css b/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/resources/typography.css deleted file mode 100644 index 7410d6f29..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/main/webapp/resources/typography.css +++ /dev/null @@ -1,32 +0,0 @@ - -body { - font-family:tahoma,verdana,sans-serif,serif; - color: #666666; - font-size:13px; -} - -h2 { - color: #314718; /*#99CC33;*/ - font-size: 16px; - text-transform: uppercase; -} - -h3 { - color: #314718; /*#ff6600;*/ - font-size: 14px; - text-transform: uppercase; - border-bottom: 1px solid #333333; -} - -h4 { - margin: 5px 0; -} - -.tiny-link { - color: #222; - font-size:12px; - text-decoration:none; -} -.tiny-link:hover { - text-decoration:underline; -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/test/java/org/neo4j/cineasts/domain/DomainTests.java b/spring-data-neo4j-examples/cineasts-aspects/src/test/java/org/neo4j/cineasts/domain/DomainTests.java deleted file mode 100644 index 5b8d4c169..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/test/java/org/neo4j/cineasts/domain/DomainTests.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.neo4j.cineasts.domain; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.neo4j.cineasts.repository.MovieRepository; -import org.neo4j.cineasts.repository.UserRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Iterator; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -/** - * @author mh - * @since 04.03.11 - */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration({"/movies-test-context.xml"}) -@Transactional -public class DomainTests { - - @Autowired - protected MovieRepository movieRepository; - @Autowired - protected UserRepository userRepository; - - @Before - public void setUp() throws Exception { - } - - @Test - public void actorCanPlayARoleInAMovie() { - Person tomHanks = new Person("1","Tom Hanks").persist(); - Movie forestGump = new Movie("1", "Forrest Gump").persist(); - - Role role = tomHanks.playedIn(forestGump, "Forrest"); - - Movie foundForestGump = this.movieRepository.findByPropertyValue(null, "id", "1"); - - assertEquals("created and looked up movie equal", forestGump, foundForestGump); - Role firstRole = foundForestGump.getRoles().iterator().next(); - assertEquals("role forrest",role, firstRole); - assertEquals("role forrest","Forrest", firstRole.getName()); - } - - @Test - public void canFindMovieByTitleQuery() { - Movie forestGump = new Movie("1", "Forrest Gump").persist(); - Iterator queryResults = movieRepository.findAllByQuery("search", "title", "Forre*").iterator(); - assertTrue("found movie by query",queryResults.hasNext()); - Movie foundMovie = queryResults.next(); - assertEquals("created and looked up movie equal", forestGump, foundMovie); - assertFalse("found only one movie by query", queryResults.hasNext()); - } - - @Test - public void userCanRateMovie() { - Movie movie= new Movie("1","Forrest Gump").persist(); - User user = new User("ich","Micha","password").persist(); - Rating awesome = user.rate(movie, 5, "Awesome"); - - User foundUser = userRepository.findByPropertyValue("login", "ich"); - Rating rating = foundUser.getRatings().iterator().next(); - assertEquals(awesome,rating); - assertEquals("Awesome",rating.getComment()); - assertEquals(5,rating.getStars()); - assertEquals(5,movie.getStars(),0); - } - @Test - public void canFindUserByLogin() { - User user = new User("ich","Micha","password").persist(); - User foundUser = userRepository.findByPropertyValue("login", "ich"); - assertEquals(user, foundUser); - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/test/java/org/neo4j/cineasts/movieimport/MovieDbApiClientTests.java b/spring-data-neo4j-examples/cineasts-aspects/src/test/java/org/neo4j/cineasts/movieimport/MovieDbApiClientTests.java deleted file mode 100644 index 451be3790..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/test/java/org/neo4j/cineasts/movieimport/MovieDbApiClientTests.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -import org.junit.Ignore; -import org.junit.Test; - -import java.util.Map; - -import static org.junit.Assert.assertEquals; - -/** - * @author mh - * @since 13.03.11 - */ -@Ignore -public class MovieDbApiClientTests { - private static final String API_KEY = "926d2a79e82920b62f03b1cb57e532e6"; - - @Test - public void testGetMovie() throws Exception { - Map movie = new MovieDbApiClient(API_KEY).getMovie("2"); - assertEquals(2,movie.get("id")); - } - - @Test - public void testGetPerson() throws Exception { - Map person = new MovieDbApiClient(API_KEY).getPerson("30112"); - assertEquals(30112,person.get("id")); - - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/test/java/org/neo4j/cineasts/movieimport/MovieDbImportServiceTests.java b/spring-data-neo4j-examples/cineasts-aspects/src/test/java/org/neo4j/cineasts/movieimport/MovieDbImportServiceTests.java deleted file mode 100644 index 966a3b5fc..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/test/java/org/neo4j/cineasts/movieimport/MovieDbImportServiceTests.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.neo4j.cineasts.domain.Movie; -import org.neo4j.cineasts.domain.Person; -import org.neo4j.cineasts.repository.MovieRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.transaction.annotation.Transactional; - -import static org.junit.Assert.assertEquals; - -/** - * @author mh - * @since 13.03.11 - */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration({"/movies-test-context.xml"}) -@Transactional -public class MovieDbImportServiceTests { - - @Autowired - MovieDbImportService importService; - - @Autowired - MovieRepository movieRepository; - - @Test - public void testImportMovie() throws Exception { - Movie movie = importService.importMovie("2"); - assertEquals("movie-id","2", movie.getId()); - assertEquals("movie-title","Ariel", movie.getTitle()); - } - - @Test - public void testImportMovieTwice() throws Exception { - Movie movie = importService.importMovie("2"); - Movie movie2 = importService.importMovie("2"); - final Movie foundMovie = movieRepository.findById("2"); - assertEquals("movie-id", movie, foundMovie); - } - - @Test - public void testImportPerson() throws Exception { - Person actor = importService.importPerson("105955"); - assertEquals("movie-id","105955", actor.getId()); - assertEquals("movie-title","George M. Williamson", actor.getName()); - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/test/java/org/neo4j/cineasts/movieimport/MovieDbLocalStorageTests.java b/spring-data-neo4j-examples/cineasts-aspects/src/test/java/org/neo4j/cineasts/movieimport/MovieDbLocalStorageTests.java deleted file mode 100644 index 9d11b84bf..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/test/java/org/neo4j/cineasts/movieimport/MovieDbLocalStorageTests.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -import org.junit.Before; -import org.junit.Test; - -import java.io.File; -import java.util.Collections; -import java.util.Map; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - * @author mh - * @since 13.03.11 - */ -public class MovieDbLocalStorageTests { - - - private static final String ID = "111"; - private static final Map DATA = Collections.singletonMap("id", ID); - protected MovieDbLocalStorage storage; - - @Before - public void setUp() throws Exception { - storage = new MovieDbLocalStorage("target/data"); - } - - @Test - public void testHasMovie() throws Exception { - storage.storeMovie(ID,DATA); - assertEquals(true, storage.hasMovie(ID)); - } - - @Test - public void testLoadMovie() throws Exception { - storage.storeMovie(ID,DATA); - assertEquals(DATA,storage.loadMovie(ID)); - } - - @Test - public void testStoreMovie() throws Exception { - storage.storeMovie(ID,DATA); - assertEquals(true, new File("target/data/movie_"+ID+".json").exists()); - } - - @Test - public void testHasPerson() throws Exception { - storage.storePerson(ID,DATA); - assertEquals(true, storage.hasPerson(ID)); - } - - @Test - public void testLoadPerson() throws Exception { - storage.storePerson(ID,DATA); - assertEquals(DATA,storage.loadPerson(ID)); - } - @Test - public void testLoadPersonFromList() throws Exception { - storage.storePerson(ID,asList(DATA)); - assertEquals(DATA,storage.loadPerson(ID)); - } - @Test - public void testLoadPersonFromInvalidList() throws Exception { - storage.storePerson(ID, asList("Nothing found.")); - final Map personData = storage.loadPerson(ID); - assertTrue("person unexpectedly found", personData.containsKey("not_found")); - } - - @Test - public void testStorePerson() throws Exception { - storage.storePerson(ID,DATA); - assertEquals(true, new File("target/data/person_"+ID+".json").exists()); - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/test/java/org/neo4j/cineasts/service/MoviesRepositoryTests.java b/spring-data-neo4j-examples/cineasts-aspects/src/test/java/org/neo4j/cineasts/service/MoviesRepositoryTests.java deleted file mode 100644 index 627ede915..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/test/java/org/neo4j/cineasts/service/MoviesRepositoryTests.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.neo4j.cineasts.service; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.neo4j.cineasts.domain.Movie; -import org.neo4j.cineasts.domain.MovieRecommendation; -import org.neo4j.cineasts.domain.Rating; -import org.neo4j.cineasts.domain.User; -import org.neo4j.cineasts.repository.MovieRepository; -import org.neo4j.helpers.collection.IteratorUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.PageRequest; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.transaction.annotation.Transactional; - -import java.util.HashSet; -import java.util.List; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - * @author mh - * @since 04.03.11 - */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration({"/movies-test-context.xml"}) -@Transactional -public class MoviesRepositoryTests { - @Autowired - MovieRepository movieRepository; - - @Test - public void testGetMovie() throws Exception { - Movie movie = new Movie("1", "Test-Movie").persist(); - Movie found = movieRepository.findById("1"); - assertEquals("movie found by id", movie, found); - - } - @Test - public void testGetMovieRecommendations() throws Exception { - Movie movie = new Movie("1", "Test-Movie").persist(); - Movie movie2 = new Movie("2", "Test-Movie2").persist(); - User user=new User("me","me","me").persist(); - user.rate(movie,3,"me"); - User friend=new User("friend","friend","friend").persist(); - friend.rate(movie,5,"friend"); - friend.rate(movie2,3,"friend2"); - assertEquals(2,movieRepository.count()); - final List recommendations = movieRepository.getRecommendations(user); - assertEquals("one recommendation", 1, recommendations.size()); - assertEquals("one recommendation", movie2, recommendations.get(0).getMovie()); - assertEquals("one recommendation", 3, recommendations.get(0).getRating()); - } - @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()); - } - - @Test - public void testFindTwoMovies() throws Exception { - Movie movie1 = new Movie("1", "Test-Movie1").persist(); - Movie movie2 = new Movie("2", "Test-Movie2").persist(); - Movie movie3 = new Movie("3", "Another-Movie3").persist(); - List found = movieRepository.findByTitleLike("Test*", new PageRequest(0, 2)).getContent(); - assertEquals("2 movies found", 2, found.size()); - assertEquals("2 correct movies found by query", new HashSet(asList(movie1, movie2)), new HashSet(found)); - } - - @Test - public void testFindTwoMoviesButRestrictToOne() throws Exception { - Movie movie1 = new Movie("1", "Test-Movie1").persist(); - Movie movie2 = new Movie("2", "Test-Movie2").persist(); - Movie movie3 = new Movie("3", "Another-Movie3").persist(); - List found = movieRepository.findByTitleLike("Test*", new PageRequest(0, 1)).getContent(); - assertEquals("1 movie found",1,found.size()); - assertTrue("1 correct movie found by query", found.get(0).getTitle().startsWith("Test")); - } -} diff --git a/spring-data-neo4j-examples/cineasts-aspects/src/test/resources/movies-test-context.xml b/spring-data-neo4j-examples/cineasts-aspects/src/test/resources/movies-test-context.xml deleted file mode 100644 index 4fb867d8b..000000000 --- a/spring-data-neo4j-examples/cineasts-aspects/src/test/resources/movies-test-context.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-rest/.gitignore b/spring-data-neo4j-examples/cineasts-rest/.gitignore deleted file mode 100644 index 490bd87be..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -.DS_Store -*.ipr -*.iws -*.iml -*.zip -data -target -*.log -tmp -.classpath -.project -.settings diff --git a/spring-data-neo4j-examples/cineasts-rest/Readme.md b/spring-data-neo4j-examples/cineasts-rest/Readme.md deleted file mode 100644 index 57c196e9c..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/Readme.md +++ /dev/null @@ -1,16 +0,0 @@ -![Cineasts.net Logo](https://github.com/jexp/cineasts/raw/master/cineasts.png) -Cineasts.net -============ - -This project is the demo/tutorial application for the [Spring Data Neo4j](https://github.com/SpringSource/spring-data-neo4j) library which provides convenient access to the [Neo4j](http://neo4j.org) graph database. - -This tutorial creates a complete web application built on top of Spring Data Neo4j. - -It uses a domain that should be familiar to most - movies. So for cineasts.net we decided to add a social -touch to the whole movie rating business, allowing friends to share their ratings and get recommendations -for new friends and movies. - -The tutorial is presented as a colloquial description of the steps necessary to create the application. -It provides the configuration and code examples that are needed to understand what's happening. - -The complete tutorial is contained in this projects [github wiki](https://github.com/jexp/cineasts/wiki). \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-rest/cineasts.png b/spring-data-neo4j-examples/cineasts-rest/cineasts.png deleted file mode 100644 index e7778456b..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/cineasts.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/pom.xml b/spring-data-neo4j-examples/cineasts-rest/pom.xml deleted file mode 100644 index cbbff01c1..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/pom.xml +++ /dev/null @@ -1,442 +0,0 @@ - - 4.0.0 - - org.neo4j - cineasts-rest - 2.2.0.BUILD-SNAPSHOT - war - - Cineasts over REST - - - UTF-8 - 3.1.3.RELEASE - 1.6.1 - 1.8.1 - ${project.version} - 1.7.1 - 1.4 - - - - - Sun - http://download.java.net/maven/2 - - - spring-libs-release - http://repo.springsource.org/libs-release - - false - - - - neo4j-public-release-repository - http://m2.neo4j.org/releases - - false - - - - - - - - spring-maven-release - Spring Maven Release Repository - http://maven.springframework.org/release - - - spring-maven-milestone - Spring Maven Milestone Repository - http://maven.springframework.org/milestone - - - - - - org.springframework.data - spring-data-neo4j-rest - ${spring-data-neo4j.version} - test-jar - test - - - - - org.springframework - spring-core - ${spring.version} - - - commons-logging - commons-logging - - - - - org.springframework - spring-test - ${spring.version} - test - - - commons-logging - commons-logging - - - - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-aop - ${spring.version} - - - org.springframework - spring-aspects - ${spring.version} - - - org.springframework - spring-tx - ${spring.version} - - - - org.springframework - spring-webmvc - ${spring.version} - - - commons-logging - commons-logging - - - - - - org.springframework.security - spring-security-web - ${spring.version} - - - org.springframework.security - spring-security-config - ${spring.version} - - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - jcl-over-slf4j - ${slf4j.version} - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - runtime - - - log4j - log4j - 1.2.16 - runtime - - - - org.springframework.data - spring-data-neo4j-aspects - ${spring-data-neo4j.version} - - - org.hibernate.javax.persistence - hibernate-jpa-2.0-api - - - - - - org.springframework.data - spring-data-neo4j-rest - ${spring-data-neo4j.version} - - - - opensymphony - sitemesh - 2.4.2 - - - - org.hibernate - hibernate-validator - 4.0.2.GA - - - - javax.servlet - servlet-api - 2.5 - provided - - - javax.servlet.jsp - jsp-api - 2.1 - provided - - - javax.servlet - jstl - 1.2 - - - - org.codehaus.jackson - jackson-mapper-asl - 1.8.3 - - - - org.aspectj - aspectjrt - ${aspectj.version} - - - - org.hibernate.javax.persistence - hibernate-jpa-2.0-api - 1.0.0.Final - - - - - - org.neo4j - neo4j-kernel - ${neo4j.version} - test-jar - test - - - - org.neo4j - neo4j-kernel - ${neo4j.version} - - - - org.neo4j - neo4j-cypher - ${neo4j.version} - - - - com.sun.jersey - jersey-client - ${jersey.version} - - - com.sun.jersey - jersey-server - ${jersey.version} - test - - - - org.neo4j.app - neo4j-server - ${neo4j.version} - test - - - org.slf4j - log4j-over-slf4j - - - - org.neo4j - neo4j - - - org.mortbay.jetty - jetty - - - com.sun.jersey - jersey-server - - - org.codehaus.jackson - jackson-jaxrs - - - org.codehaus.jackson - jackson-mapper-asl - - - de.huxhorn.lilith - de.huxhorn.lilith.3rdparty.rrd4j - - - com.sun.jersey.contribs - jersey-multipart - - - org.apache.felix - org.apache.felix.main - - - org.apache.felix - org.apache.felix.fileinstall - - - - org.slf4j - slf4j-jdk14 - - - - - - org.neo4j.server.plugin - neo4j-cypher-plugin - ${neo4j.version} - test - - - junit - junit - 4.8.1 - test - - - - org.mortbay.jetty - jetty - 6.1.25 - test - - - - - - - org.mortbay.jetty - jetty-maven-plugin - 7.1.2.v20100523 - - - / - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.1 - - 1.7 - 1.7 - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.12.1 - - once - true - - **/*Tests.java - **/*Test.java - - - **/Abstract*.java - - junit:junit - - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - 1.5 - - org.eclipse.ajdt.ui.ajnature - org.eclipse.jdt.core.javanature - org.springframework.ide.eclipse.core.springnature - - - - - - org.codehaus.mojo - aspectj-maven-plugin - 1.2 - - - org.aspectj - aspectjrt - ${aspectj.version} - - - org.aspectj - aspectjtools - ${aspectj.version} - - - - - - compile - test-compile - - - - - true - - - org.springframework - spring-aspects - - - org.springframework.data - spring-data-neo4j-aspects - - - 1.7 - 1.7 - - - - - - diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/controller/AuthController.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/controller/AuthController.java deleted file mode 100644 index 48d7d7c4d..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/controller/AuthController.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.neo4j.cineasts.controller; - - -import org.neo4j.cineasts.service.CineastsUserDetailsService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; - -/** - * Handles and retrieves the login or denied page depending on the URI template - */ -@Controller -@RequestMapping("/auth") -public class AuthController { - - private final static Logger logger = LoggerFactory.getLogger(AuthController.class); - - @Autowired - CineastsUserDetailsService userDetailsService; - @RequestMapping(value = "/login", method = RequestMethod.GET) - public String login(@RequestParam(value = "login_error", required = false) boolean error, Model model) { - logger.debug("Received request to show login page, error "+error); - if (error) { - model.addAttribute("error", "You have entered an invalid username or password!"); - } - return "/auth/loginpage"; - } - - @RequestMapping(value = "/register", method = RequestMethod.POST) - public String register( - @RequestParam(value = "j_username") String login, - @RequestParam(value = "j_displayname") String name, - @RequestParam(value = "j_password") String password, - Model model) { - - try { - userDetailsService.register(login,name,password); - return "forward:/user/"+login; - } catch(Exception e) { - model.addAttribute("j_username",login); - model.addAttribute("j_displayname",name); - model.addAttribute("error",e.getMessage()); - return "/auth/registerpage"; - } - } - - @RequestMapping(value = "/denied", method = RequestMethod.GET) - public String denied() { - logger.debug("Received request to show denied page"); - return "/auth/deniedpage"; - } - - @RequestMapping(value = "/registerpage", method = RequestMethod.GET) - public String registerPage() { - logger.debug("Received request to show register page"); - return "/auth/registerpage"; - } -} \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/controller/ImportController.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/controller/ImportController.java deleted file mode 100644 index 61aa74861..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/controller/ImportController.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.neo4j.cineasts.controller; - -import org.neo4j.cineasts.movieimport.MovieDbImportService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; - -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * @author mh - * @since 04.03.11 - */ -@Controller -public class ImportController { - - private MovieDbImportService importService; - private static final Logger log = LoggerFactory.getLogger(ImportController.class); - - @Autowired - public ImportController(MovieDbImportService importService) { - this.importService = importService; - } - - @RequestMapping(value = "/import/{ids}", method = RequestMethod.GET) - public String importMovie(@PathVariable String ids, Model model) { - long start=System.currentTimeMillis(); - final Map movies = importService.importMovies(extractRanges(ids)); - long duration = (System.currentTimeMillis() - start) / 1000; - model.addAttribute("duration", duration); - model.addAttribute("ids", ids); - model.addAttribute("movies", movies.entrySet()); - return "import/result"; - } - - - private Map extractRanges(String ids) { - Map ranges = new LinkedHashMap(); - StringBuilder errors = new StringBuilder(); - for (String token : ids.split(",")) { - try { - if (token.contains("-")) { - String[] range = token.split("-"); - ranges.put(Integer.parseInt(range[0]), Integer.parseInt(range[1])); - } else { - int id = Integer.parseInt(token); - ranges.put(id, id); - } - } catch (Exception e) { - errors.append(token).append(": ").append(e.getMessage()).append("\n"); - } - } - if (errors.length() > 0) { - throw new RuntimeException("Error parsing ids\n" + errors); - } - return ranges; - } -} 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 deleted file mode 100644 index 86edb0607..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/controller/MovieController.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.neo4j.cineasts.controller; - -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.repository.MovieRepository; -import org.neo4j.cineasts.service.CineastsRepository; -import org.neo4j.cineasts.service.CineastsUserDetailsService; -import org.neo4j.cineasts.service.DatabasePopulator; -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.domain.Page; -import org.springframework.data.neo4j.support.Neo4jTemplate; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.*; - -import java.util.Collection; -import java.util.List; - -/** - * @author mh - * @since 04.03.11 - */ -@Controller -public class MovieController { - - private CineastsRepository cineastsRepository; - private CineastsUserDetailsService userDetailsService; - private final Neo4jTemplate template; - private DatabasePopulator populator; - private static final Logger log = LoggerFactory.getLogger(MovieController.class); - - @Autowired - public MovieController(CineastsRepository cineastsRepository, DatabasePopulator populator, CineastsUserDetailsService userDetailsService, Neo4jTemplate template) { - this.cineastsRepository = cineastsRepository; - this.populator = populator; - this.userDetailsService = userDetailsService; - this.template = template; - } - - // for web service (JSON) clients - - /** - * Only matches 'GET /moviies/{id}}' requests for JSON content; a 404 is sent otherwise. - * TODO send a 406 if an unsupported representation, such as XML, is requested. See SPR-7353. - */ - @RequestMapping(value = "/movies/{id}", method = RequestMethod.GET, headers = "Accept=application/json") - public - @ResponseBody - Movie getMovie(@PathVariable String id) { - return cineastsRepository.getMovie(id); - } - - @RequestMapping(value = "/movies/{movieId}", method = RequestMethod.GET, headers = "Accept=text/html") - public String singleMovieView(final Model model, @PathVariable String movieId) { - User user = addUser(model); - MovieRepository.MovieData movieData = cineastsRepository.getMovieData( movieId ); - model.addAttribute("id", movieId); - 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"; - } - - @RequestMapping(value = "/movies/{movieId}", method = RequestMethod.POST, headers = "Accept=text/html") - public String updateMovie(Model model, @PathVariable String movieId, @RequestParam(value = "rated",required = false) Integer stars, @RequestParam(value = "comment",required = false) String comment) { - Movie movie = cineastsRepository.getMovie(movieId); - User user = userDetailsService.getUserFromSession(); - cineastsRepository.rateMovie(movie,user, stars==null ? -1 : stars,comment!=null ? comment.trim() : null); - return singleMovieView(model,movieId); - } - - private User addUser(Model model) { - User user = userDetailsService.getUserFromSession(); - model.addAttribute("user", user); - return user; - } - - @RequestMapping(value = "/movies", method = RequestMethod.GET, headers = "Accept=text/html") - public String findMovies(Model model, @RequestParam("q") String query) { - Page movies = cineastsRepository.findMovies( query, 20 ); - model.addAttribute("movies", movies.iterator()); - model.addAttribute("query", query); - addUser(model); - return "/movies/list"; - } - - @RequestMapping(value = "/actors/{id}", method = RequestMethod.GET, headers = "Accept=text/html") - public String singleActorView(Model model, @PathVariable String id) { - Person person = cineastsRepository.getPerson(id); - model.addAttribute("actor", person); - model.addAttribute("id", id); - model.addAttribute("roles", IteratorUtil.asCollection(person.getRoles())); - addUser(model); - return "/actors/show"; - } - - //@RequestMapping(value = "/admin/populate", method = RequestMethod.GET) - @RequestMapping(value = "/populate", method = RequestMethod.GET) - public String populateDatabase(Model model) { - Collection movies=populator.populateDatabase(); - model.addAttribute("movies",movies); - addUser(model); - return "/movies/list"; - } - - @RequestMapping(value = "/admin/clean", method = RequestMethod.GET) - public String clean(Model model) { - populator.cleanDb(); - return "movies/list"; - } - - @RequestMapping(value = "/", method = RequestMethod.GET) - public String index(Model model) { - addUser(model); - return "index"; - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/controller/UserController.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/controller/UserController.java deleted file mode 100644 index a8111a9fd..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/controller/UserController.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.neo4j.cineasts.controller; - - -import org.neo4j.cineasts.domain.User; -import org.neo4j.cineasts.service.CineastsRepository; -import org.neo4j.cineasts.service.CineastsUserDetailsService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; - -/** - * Handles and retrieves the login or denied page depending on the URI template - */ -@Controller -public class UserController { - - @Autowired CineastsUserDetailsService userDetailsService; - @Autowired CineastsRepository repository; - - private final static Logger logger = LoggerFactory.getLogger(UserController.class); - - @RequestMapping(value = "/user", method = RequestMethod.GET) - public String profile(Model model) { - final User user = userDetailsService.getUserFromSession(); - model.addAttribute("user", user); - model.addAttribute("recommendations", repository.recommendMovies(user)); - return "/user/index"; - } - - @RequestMapping(value = "/user/{login}/friends", method = RequestMethod.POST) - public String addFriend(Model model, @PathVariable("login") String login) { - userDetailsService.addFriend(login); - return "forward:/user/"+login; - } - - @RequestMapping(value = "/user/{login}") - public String publicProfile(Model model, @PathVariable("login") String login) { - User profiled = userDetailsService.findUser(login); - User user = userDetailsService.getUserFromSession(); - - return publicProfile(model, profiled, user); - } - - private String publicProfile(Model model, User profiled, User user) { - if (profiled.equals(user)) return profile(model); - - model.addAttribute("profiled", profiled); - model.addAttribute("user", user); - model.addAttribute("isFriend", areFriends(profiled, user)); - return "/user/public"; - } - - private boolean areFriends(User user, User loggedIn) { - return user!=null && user.isFriend(loggedIn); - } -} \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/Movie.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/Movie.java deleted file mode 100644 index aa855e443..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/Movie.java +++ /dev/null @@ -1,225 +0,0 @@ -package org.neo4j.cineasts.domain; - -import org.neo4j.helpers.collection.IteratorUtil; -import org.springframework.data.neo4j.annotation.*; -import org.springframework.data.neo4j.support.index.IndexType; - -import java.util.*; - -import static org.neo4j.graphdb.Direction.INCOMING; - - -/** - * @author mh - * @since 04.03.11 - */ -@NodeEntity -public class Movie { - - @Indexed - String id; - - @Indexed(indexType=IndexType.FULLTEXT, indexName = "search") - String title; - - String description; - - @RelatedTo(type="DIRECTED", direction = INCOMING) - Person director; - - @RelatedTo(elementClass = Person.class, type = "ACTS_IN", direction = INCOMING) - Set actors; - - @RelatedToVia(elementClass = Role.class, type = "ACTS_IN", direction = INCOMING) - Iterable roles; - - @Query("start movie=node({self}) match movie<-[rating:RATED]-() return rating") - Iterable ratings; - - private String language; - private String imdbId; - private String tagline; - private Date releaseDate; - private Integer runtime; - private String homepage; - private String trailer; - private String genre; - private String studio; - private Integer version; - private Date lastModified; - private String imageUrl; - - public Movie() { - } - - public Movie(String id, String title) { - this.id = id; - this.title = title; - } - - public Collection getActors() { - return actors; - } - - public Collection getRoles() { - return IteratorUtil.asCollection(roles); - } - - public int getYear() { - if (releaseDate==null) return 0; - Calendar cal = Calendar.getInstance(); - cal.setTime(releaseDate); - return cal.get(Calendar.YEAR); - } - - public String getId() { - return id; - } - - public String getTitle() { - return title; - } - - @Override - public String toString() { - return String.format("%s (%s) [%s]", title, releaseDate, id); - } - - public String getDescription() { - return description; - } - - public int getStars() { - Iterable allRatings = ratings; - - if (allRatings == null) return 0; - int stars=0, count=0; - for (Rating rating : allRatings) { - stars += rating.getStars(); - count++; - } - return count==0 ? 0 : stars / count; - } - - public Collection getRatings() { - Iterable allRatings = ratings; - return allRatings == null ? Collections.emptyList() : IteratorUtil.asCollection(allRatings); - } - - public Person getDirector() { - return director; - } - - public void setTitle(String title) { - this.title=title; - } - - public void setLanguage(String language) { - this.language = language; - } - - public void setImdbId(String imdbId) { - this.imdbId = imdbId; - } - - public void setTagline(String tagline) { - this.tagline = tagline; - } - - public void setDescription(String description) { - this.description = description; - } - - public void setReleaseDate(Date releaseDate) { - this.releaseDate = releaseDate; - } - - public void setRuntime(Integer runtime) { - this.runtime = runtime; - } - - public void setHomepage(String homepage) { - this.homepage = homepage; - } - - public void setTrailer(String trailer) { - this.trailer = trailer; - } - - public void setGenre(String genre) { - this.genre = genre; - } - - public void setStudio(String studio) { - this.studio = studio; - } - - public void setVersion(Integer version) { - this.version = version; - } - - public void setLastModified(Date lastModified) { - this.lastModified = lastModified; - } - - public void setImageUrl(String imageUrl) { - this.imageUrl = imageUrl; - } - - public String getLanguage() { - return language; - } - - public String getImdbId() { - return imdbId; - } - - public String getTagline() { - return tagline; - } - - public Date getReleaseDate() { - return releaseDate; - } - - public Integer getRuntime() { - return runtime; - } - - public String getHomepage() { - return homepage; - } - - public String getTrailer() { - return trailer; - } - - public String getGenre() { - return genre; - } - - public String getStudio() { - return studio; - } - - public Integer getVersion() { - return version; - } - - public Date getLastModified() { - return lastModified; - } - - public String getImageUrl() { - return imageUrl; - } - - public String getYoutubeId() { - String trailerUrl = trailer; - if (trailerUrl==null || !trailerUrl.contains("youtu")) return null; - String[] parts = trailerUrl.split("[=/]"); - int numberOfParts = parts.length; - return numberOfParts > 0 ? parts[numberOfParts-1] : null; - } -} - diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/Person.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/Person.java deleted file mode 100644 index 650e65f92..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/Person.java +++ /dev/null @@ -1,127 +0,0 @@ -package org.neo4j.cineasts.domain; - -import org.springframework.data.neo4j.annotation.*; -import org.springframework.data.neo4j.support.index.IndexType; - -import java.util.Date; -import java.util.Set; - -@NodeEntity -public class Person { - @Indexed(unique=true) - String id; - @Indexed(indexType=IndexType.FULLTEXT, indexName = "people") - String name; - private Date birthday; - private String birthplace; - private String biography; - private Integer version; - private Date lastModified; - private String profileImageUrl; - - public Person(String id, String name) { - this.id = id; - this.name = name; - } - - public Person() { - } - - public String getId() { - return id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public String toString() { - return String.format("%s [%s]", name, id); - } - - public void setBirthday(Date birthday) { - this.birthday = birthday; - } - - public void setBirthplace(String birthplace) { - this.birthplace = birthplace; - } - - public void setBiography(String biography) { - this.biography = biography; - } - - public void setVersion(Integer version) { - this.version = version; - } - - public void setLastModified(Date lastModified) { - this.lastModified = lastModified; - } - - public Date getBirthday() { - return birthday; - } - - public String getBirthplace() { - return birthplace; - } - - public String getBiography() { - return biography; - } - - public Integer getVersion() { - return version; - } - - public Date getLastModified() { - return lastModified; - } - - public void setProfileImageUrl(String profileImageUrl) { - this.profileImageUrl = profileImageUrl; - } - - public String getProfileImageUrl() { - return profileImageUrl; - } - - @RelatedTo(elementClass = Movie.class, type = "DIRECTED") - private Set directedMovies; - - public Set getDirectedMovies() { - return directedMovies; - } - - public void directed(Movie movie) { - this.directedMovies.add(movie); - } - - @RelatedToVia(elementClass = Role.class, type = "ACTS_IN") - Iterable roles; - - public Iterable getRoles() { - return roles; - } - - public Role playedIn(Movie movie, String roleName) { - Role role = relateTo(movie, Role.class, "ACTS_IN"); - role.setName(roleName); - return role; - } - - @Query(value = "start person=node({self}) match person-->movie<--co_actor return distinct co_actor") - private Iterable coActors; - - // Co-Actors - - public Iterable getCoActors() { - return coActors; - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/Rating.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/Rating.java deleted file mode 100644 index ea14ea5f9..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/Rating.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.neo4j.cineasts.domain; - -import org.springframework.data.neo4j.annotation.EndNode; -import org.springframework.data.neo4j.annotation.RelationshipEntity; -import org.springframework.data.neo4j.annotation.StartNode; - -/** - * @author mh - * @since 04.03.11 - */ -@RelationshipEntity -public class Rating { - private static final int MAX_STARS = 5; - private static final int MIN_STARS = 0; - - @StartNode - User user; - @EndNode Movie movie; - - int stars; - String comment; - - public User getUser() { - return user; - } - - public Movie getMovie() { - return movie; - } - - public int getStars() { - return stars; - } - - public void setStars(int stars) { - this.stars = stars; - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - this.comment = comment; - } - - public Rating rate(int stars, String comment) { - if (stars>= MIN_STARS && stars <= MAX_STARS) this.stars=stars; - if (comment!=null && !comment.isEmpty()) this.comment = comment; - return this; - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/Role.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/Role.java deleted file mode 100644 index e5a4dac27..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/Role.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.neo4j.cineasts.domain; - -import org.springframework.data.neo4j.annotation.EndNode; -import org.springframework.data.neo4j.annotation.RelationshipEntity; -import org.springframework.data.neo4j.annotation.StartNode; - -/** - * @author mh - * @since 04.03.11 - */ -@RelationshipEntity -public class Role { - @EndNode Movie movie; - @StartNode Person actor; - - String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Movie getMovie() { - return movie; - } - - public Person getActor() { - return actor; - } - - @Override - public String toString() { - return String.format("%s acts as %s in %s", actor, name, movie); - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/Roles.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/Roles.java deleted file mode 100644 index 3319ab32f..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/Roles.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.neo4j.cineasts.domain; - -/** -* @author mh -* @since 12.03.11 -*/ -public enum Roles { - ACTS_IN, DIRECTED -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/User.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/User.java deleted file mode 100644 index 8d362207a..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/domain/User.java +++ /dev/null @@ -1,117 +0,0 @@ -package org.neo4j.cineasts.domain; - -import org.neo4j.graphdb.Direction; -import org.neo4j.helpers.collection.IteratorUtil; -import org.springframework.data.neo4j.annotation.Indexed; -import org.springframework.data.neo4j.annotation.NodeEntity; -import org.springframework.data.neo4j.annotation.RelatedTo; -import org.springframework.data.neo4j.annotation.RelatedToVia; -import org.springframework.security.authentication.encoding.Md5PasswordEncoder; -import org.springframework.security.core.GrantedAuthority; - -import java.util.Collection; -import java.util.Set; - -@NodeEntity -public class User { - private static final String SALT = "cewuiqwzie"; - public static final String FRIEND = "FRIEND"; - public static final String RATED = "RATED"; - @Indexed - String login; - String name; - String password; - String info; - private Roles[] roles; - - public User() { - } - - public User(String login, String name, String password, Roles... roles) { - this.login = login; - this.name = name; - this.password = encode(password); - this.roles = roles; - } - - private String encode(String password) { - return new Md5PasswordEncoder().encodePassword(password, SALT); - } - - @RelatedToVia(elementClass = Rating.class, type = RATED) - Iterable ratings; - - @RelatedTo(elementClass = Movie.class, type = RATED) - Set favorites; - - - @RelatedTo(elementClass = User.class, type = FRIEND, direction = Direction.BOTH) - Set friends; - - public void addFriend(User friend) { - this.friends.add(friend); - } - - public Rating rate(Movie movie, int stars, String comment) { - return relateTo(movie, Rating.class, RATED).rate(stars, comment); - } - - public Collection getRatings() { - return IteratorUtil.asCollection(ratings); - } - - @Override - public String toString() { - return String.format("%s (%s)", name, login); - } - - public String getName() { - return name; - } - - public Set getFriends() { - return friends; - } - - public Roles[] getRole() { - return roles; - } - - - public String getLogin() { - return login; - } - - public String getPassword() { - return password; - } - - public String getInfo() { - return info; - } - public void setInfo(String info) { - this.info = info; - } - public void updatePassword(String old, String newPass1, String newPass2) { - if (!password.equals(encode(old))) throw new IllegalArgumentException("Existing Password invalid"); - if (!newPass1.equals(newPass2)) throw new IllegalArgumentException("New Passwords don't match"); - this.password = encode(newPass1); - } - - public void setName(String name) { - this.name = name; - } - - public boolean isFriend(User other) { - return other!=null && getFriends().contains(other); - } - - public enum Roles implements GrantedAuthority { - ROLE_USER, ROLE_ADMIN; - - @Override - public String getAuthority() { - return name(); - } - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieDbApiClient.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieDbApiClient.java deleted file mode 100644 index f07fc9753..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieDbApiClient.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -import org.codehaus.jackson.map.ObjectMapper; - -import java.net.URL; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -public class MovieDbApiClient { - - private final String baseUrl = "http://api.themoviedb.org/"; - private final String apiKey; - protected final ObjectMapper mapper; - - public MovieDbApiClient(String apiKey) { - this.apiKey = apiKey; - mapper = new ObjectMapper(); - } - - public Map getMovie(String id) { - return loadJsonData(id, buildMovieUrl(id)); - } - - private Map loadJsonData(String id, String url) { - try { - List value = mapper.readValue(new URL(url), List.class); - if (value.isEmpty() || value.get(0).equals("Nothing found.")) return Collections.singletonMap("not_found",System.currentTimeMillis()); - return (Map) value.get(0); - } catch (Exception e) { - throw new RuntimeException("Failed to get data from " + url, e); - } - } - - private String buildMovieUrl(String movieId) { - return String.format("%s2.1/Movie.getInfo/en/json/%s/%s", baseUrl, apiKey, movieId); - } - - public Map getPerson(String id) { - return loadJsonData(id, buildPersonUrl(id)); - } - - private String buildPersonUrl(String personId) { - return String.format("%s2.1/Person.getInfo/en/json/%s/%s", baseUrl, apiKey, personId); - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieDbException.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieDbException.java deleted file mode 100644 index a1da5992b..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieDbException.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -public class MovieDbException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - public MovieDbException(String message) { - super(message); - } - - public MovieDbException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieDbImportService.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieDbImportService.java deleted file mode 100644 index bb9ed3de6..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieDbImportService.java +++ /dev/null @@ -1,128 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -import org.neo4j.cineasts.domain.*; -import org.neo4j.cineasts.service.CineastsRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.Map; - -@Service -public class MovieDbImportService { - - private static final Logger logger = LoggerFactory.getLogger(MovieDbImportService.class); - MovieDbJsonMapper movieDbJsonMapper = new MovieDbJsonMapper(); - - @Autowired - CineastsRepository moviesRepository; - - @Autowired - MovieDbApiClient client; - - @Autowired - MovieDbLocalStorage localStorage; - - @Transactional - public Map importMovies(Map ranges) { - final Map movies=new LinkedHashMap(); - for (Map.Entry entry : ranges.entrySet()) { - for (int id = entry.getKey(); id <= entry.getValue(); id++) { - String result = importMovieFailsafe(id); - movies.put(id, result); - } - } - return movies; - } - - private String importMovieFailsafe(Integer id) { - try { - Movie movie = doImportMovie(String.valueOf(id)); - return movie.getTitle(); - } catch (Exception e) { - return e.getMessage(); - } - } - - @Transactional - public Movie importMovie(String movieId) { - return doImportMovie(movieId); - } - - private Movie doImportMovie(String movieId) { - logger.debug("Importing movie " + movieId); - - Movie movie = moviesRepository.getMovie(movieId); - if (movie == null) { // Not found: Create fresh - movie = new Movie(movieId,null); - } - - Map data = loadMovieData(movieId); - if (data.containsKey("not_found")) throw new RuntimeException("Data for Movie "+movieId+" not found."); - movieDbJsonMapper.mapToMovie(data, movie); - movie.persist(); - relatePersonsToMovie(movie, data); - return movie; - } - - private Map loadMovieData(String movieId) { - if (localStorage.hasMovie(movieId)) { - return localStorage.loadMovie(movieId); - } - - Map data = client.getMovie(movieId); - localStorage.storeMovie(movieId, data); - return data; - } - - private void relatePersonsToMovie(Movie movie, Map data) { - Collection cast = (Collection) data.get("cast"); - for (Map entry : cast) { - String id = "" + entry.get("id"); - String jobName = (String) entry.get("job"); - Roles job = movieDbJsonMapper.mapToRole(jobName); - if (job==null) { - if (logger.isInfoEnabled()) logger.info("Could not add person with job "+jobName+" "+entry); - continue; - } - Person person = doImportPerson(id); - switch (job) { - case DIRECTED: - person.directed(movie); - break; - case ACTS_IN: - person.playedIn(movie, (String) entry.get("character")); - break; - } - } - } - - @Transactional - public Person importPerson(String personId) { - return doImportPerson(personId); - } - - private Person doImportPerson(String personId) { - logger.debug("Importing person " + personId); - Person person = moviesRepository.getPerson(personId); - if (person!=null) return person; - Map data = loadPersonData(personId); - if (data.containsKey("not_found")) throw new RuntimeException("Data for Person "+personId+" not found."); - Person newPerson=new Person(personId,null); - movieDbJsonMapper.mapToPerson(data, newPerson); - return newPerson.persist(); - } - - private Map loadPersonData(String personId) { - if (localStorage.hasPerson(personId)) { - return localStorage.loadPerson(personId); - } - Map data = client.getPerson(personId); - localStorage.storePerson(personId, data); - return localStorage.loadPerson(personId); - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieDbJsonMapper.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieDbJsonMapper.java deleted file mode 100644 index 6d83d6b90..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieDbJsonMapper.java +++ /dev/null @@ -1,708 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -import org.neo4j.cineasts.domain.Movie; -import org.neo4j.cineasts.domain.Person; -import org.neo4j.cineasts.domain.Roles; -import org.springframework.stereotype.Component; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.Map; - -@Component -public class MovieDbJsonMapper { - - public void mapToMovie(Map data, Movie movie) { - try { - movie.setTitle((String) data.get("name")); - movie.setLanguage((String) data.get("language")); - movie.setImdbId((String) data.get("imdb_id")); - movie.setTagline((String) data.get("tagline")); - movie.setDescription(limit((String) data.get("overview"), 500)); - movie.setReleaseDate(toDate(data, "released", "yyyy-MM-dd")); - movie.setRuntime((Integer) data.get("runtime")); - movie.setHomepage((String) data.get("homepage")); - movie.setTrailer((String) data.get("trailer")); - movie.setGenre(extractFirst(data, "genres", "name")); - movie.setStudio(extractFirst(data,"studios", "name")); - movie.setVersion((Integer)data.get("version")); - movie.setLastModified(toDate(data,"last_modified_at","yyyy-MM-dd HH:mm:ss")); - movie.setImageUrl(selectImageUrl((List) data.get("posters"), "poster", "mid")); - } catch (Exception e) { - throw new MovieDbException("Failed to map json for movie", e); - } - } - - private String selectImageUrl(List data, final String type, final String size) { - if (data==null) return null; - for (Map entry : data) { - Map image = (Map) entry.get("image"); - if (image.get("type").equals(type) && image.get("size").equals(size)) return (String) image.get("url"); - } - return null; - } - - - private String extractFirst(Map data, String field, String property) { - List inner = (List) data.get(field); - if (inner == null || inner.isEmpty()) return null; - return (String) inner.get(0).get(property); - } - - private Date toDate(Map data, String field, final String pattern) throws ParseException { - try { - String dateString = (String) data.get(field); - if (dateString == null || dateString.isEmpty()) return null; - return new SimpleDateFormat(pattern).parse(dateString); - } catch (Exception e) { - return null; - } - } - - /* - [{"popularity":3, -"translated":true, -"adult":false, -"language":"en", -"original_name":"[Rec]", -"name":"[Rec]", -"alternative_name":"[REC]", -"movie_type":"movie", -"id":8329, -"imdb_id":"tt1038988", -"url":"http://www.themoviedb.org/movie/8329", -"votes":11, -"rating":7.2, -"status":"Released", -"tagline":"One Witness. One Camera", -"certification":"R", -"overview":"\"REC\" turns on a young TV reporter and her cameraman who cover the night shift at the local fire station. Receiving a call from an old lady trapped in her house, -they reach her building to hear horrifying screams -- which begin a long nightmare and a uniquely dramatic TV report.", -"keywords":["terror", -"lebende leichen", -"obsession", -"camcorder", -"firemen", -"reality tv ", -"bite", -"cinematographer", -"attempt to escape", -"virus", -"lodger", -"live-reportage", -"schwerverletzt"], -"released":"2007-08-29", -"runtime":78, -"budget":0, -"revenue":0, -"homepage":"http://www.3l-filmverleih.de/rec", -"trailer":"http://www.youtube.com/watch?v=YQUkX_XowqI", -"genres":[{"type":"genre", -"url":"http://themoviedb.org/genre/horror", -"name":"Horror", -"id":27}], -"studios":[{"url":"http://www.themoviedb.org/company/2270", -"name":"Filmax Group", -"id":2270}], -"languages_spoken":[{"code":"es", -"name":"Spanish", -"native_name":"Espa\u00f1ol"}], -"countries":[{"code":"ES", -"name":"Spain", -"url":"http://www.themoviedb.org/country/es"}], -"posters":[{"image":{"type":"poster", -"size":"original", -"height":1000, -"width":706, -"url":"http://cf1.imgobject.com/posters/3a0/4cc8df415e73d650240003a0/rec-original.jpg", -"id":"4cc8df415e73d650240003a0"}}, -{"image":{"type":"poster", -"size":"mid", -"height":708, -"width":500, -"url":"http://cf1.imgobject.com/posters/3a0/4cc8df415e73d650240003a0/rec-mid.jpg", -"id":"4cc8df415e73d650240003a0"}}, -{"image":{"type":"poster", -"size":"cover", -"height":262, -"width":185, -"url":"http://cf1.imgobject.com/posters/3a0/4cc8df415e73d650240003a0/rec-cover.jpg", -"id":"4cc8df415e73d650240003a0"}}, -{"image":{"type":"poster", -"size":"thumb", -"height":130, -"width":92, -"url":"http://cf1.imgobject.com/posters/3a0/4cc8df415e73d650240003a0/rec-thumb.jpg", -"id":"4cc8df415e73d650240003a0"}}, -{"image":{"type":"poster", -"size":"original", -"height":1000, -"width":711, -"url":"http://cf1.imgobject.com/posters/1e7/4bc92117017a3c57fe00d1e7/rec-original.jpg", -"id":"4bc92117017a3c57fe00d1e7"}}, -{"image":{"type":"poster", -"size":"mid", -"height":703, -"width":500, -"url":"http://cf1.imgobject.com/posters/1e7/4bc92117017a3c57fe00d1e7/rec-mid.jpg", -"id":"4bc92117017a3c57fe00d1e7"}}, -{"image":{"type":"poster", -"size":"cover", -"height":260, -"width":185, -"url":"http://cf1.imgobject.com/posters/1e7/4bc92117017a3c57fe00d1e7/rec-cover.jpg", -"id":"4bc92117017a3c57fe00d1e7"}}, -{"image":{"type":"poster", -"size":"thumb", -"height":129, -"width":92, -"url":"http://cf1.imgobject.com/posters/1e7/4bc92117017a3c57fe00d1e7/rec-thumb.jpg", -"id":"4bc92117017a3c57fe00d1e7"}}, -{"image":{"type":"poster", -"size":"original", -"height":1500, -"width":1000, -"url":"http://cf1.imgobject.com/posters/1ec/4bc92118017a3c57fe00d1ec/rec-original.jpg", -"id":"4bc92118017a3c57fe00d1ec"}}, -{"image":{"type":"poster", -"size":"mid", -"height":750, -"width":500, -"url":"http://cf1.imgobject.com/posters/1ec/4bc92118017a3c57fe00d1ec/rec-mid.jpg", -"id":"4bc92118017a3c57fe00d1ec"}}, -{"image":{"type":"poster", -"size":"cover", -"height":278, -"width":185, -"url":"http://cf1.imgobject.com/posters/1ec/4bc92118017a3c57fe00d1ec/rec-cover.jpg", -"id":"4bc92118017a3c57fe00d1ec"}}, -{"image":{"type":"poster", -"size":"thumb", -"height":138, -"width":92, -"url":"http://cf1.imgobject.com/posters/1ec/4bc92118017a3c57fe00d1ec/rec-thumb.jpg", -"id":"4bc92118017a3c57fe00d1ec"}}, -{"image":{"type":"poster", -"size":"original", -"height":1429, -"width":1000, -"url":"http://cf1.imgobject.com/posters/1f1/4bc92118017a3c57fe00d1f1/rec-original.jpg", -"id":"4bc92118017a3c57fe00d1f1"}}, -{"image":{"type":"poster", -"size":"mid", -"height":715, -"width":500, -"url":"http://cf1.imgobject.com/posters/1f1/4bc92118017a3c57fe00d1f1/rec-mid.jpg", -"id":"4bc92118017a3c57fe00d1f1"}}, -{"image":{"type":"poster", -"size":"cover", -"height":265, -"width":185, -"url":"http://cf1.imgobject.com/posters/1f1/4bc92118017a3c57fe00d1f1/rec-cover.jpg", -"id":"4bc92118017a3c57fe00d1f1"}}, -{"image":{"type":"poster", -"size":"thumb", -"height":132, -"width":92, -"url":"http://cf1.imgobject.com/posters/1f1/4bc92118017a3c57fe00d1f1/rec-thumb.jpg", -"id":"4bc92118017a3c57fe00d1f1"}}, -{"image":{"type":"poster", -"size":"original", -"height":1125, -"width":800, -"url":"http://cf1.imgobject.com/posters/1f6/4bc92118017a3c57fe00d1f6/rec-original.jpg", -"id":"4bc92118017a3c57fe00d1f6"}}, -{"image":{"type":"poster", -"size":"mid", -"height":703, -"width":500, -"url":"http://cf1.imgobject.com/posters/1f6/4bc92118017a3c57fe00d1f6/rec-mid.jpg", -"id":"4bc92118017a3c57fe00d1f6"}}, -{"image":{"type":"poster", -"size":"cover", -"height":260, -"width":185, -"url":"http://cf1.imgobject.com/posters/1f6/4bc92118017a3c57fe00d1f6/rec-cover.jpg", -"id":"4bc92118017a3c57fe00d1f6"}}, -{"image":{"type":"poster", -"size":"thumb", -"height":129, -"width":92, -"url":"http://cf1.imgobject.com/posters/1f6/4bc92118017a3c57fe00d1f6/rec-thumb.jpg", -"id":"4bc92118017a3c57fe00d1f6"}}], -"backdrops":[{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/1df/4bc92117017a3c57fe00d1df/rec-original.jpg", -"id":"4bc92117017a3c57fe00d1df"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/1df/4bc92117017a3c57fe00d1df/rec-poster.jpg", -"id":"4bc92117017a3c57fe00d1df"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/1df/4bc92117017a3c57fe00d1df/rec-thumb.jpg", -"id":"4bc92117017a3c57fe00d1df"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/1d7/4bc92113017a3c57fe00d1d7/rec-original.jpg", -"id":"4bc92113017a3c57fe00d1d7"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/1d7/4bc92113017a3c57fe00d1d7/rec-poster.jpg", -"id":"4bc92113017a3c57fe00d1d7"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/1d7/4bc92113017a3c57fe00d1d7/rec-thumb.jpg", -"id":"4bc92113017a3c57fe00d1d7"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/1e3/4bc92117017a3c57fe00d1e3/rec-original.jpg", -"id":"4bc92117017a3c57fe00d1e3"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/1e3/4bc92117017a3c57fe00d1e3/rec-poster.jpg", -"id":"4bc92117017a3c57fe00d1e3"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/1e3/4bc92117017a3c57fe00d1e3/rec-thumb.jpg", -"id":"4bc92117017a3c57fe00d1e3"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/1d3/4bc92113017a3c57fe00d1d3/rec-original.jpg", -"id":"4bc92113017a3c57fe00d1d3"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/1d3/4bc92113017a3c57fe00d1d3/rec-poster.jpg", -"id":"4bc92113017a3c57fe00d1d3"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/1d3/4bc92113017a3c57fe00d1d3/rec-thumb.jpg", -"id":"4bc92113017a3c57fe00d1d3"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/1db/4bc92114017a3c57fe00d1db/rec-original.jpg", -"id":"4bc92114017a3c57fe00d1db"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/1db/4bc92114017a3c57fe00d1db/rec-poster.jpg", -"id":"4bc92114017a3c57fe00d1db"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/1db/4bc92114017a3c57fe00d1db/rec-thumb.jpg", -"id":"4bc92114017a3c57fe00d1db"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/6f4/4d0e39c25e73d637100016f4/rec-original.jpg", -"id":"4d0e39c25e73d637100016f4"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/6f4/4d0e39c25e73d637100016f4/rec-poster.jpg", -"id":"4d0e39c25e73d637100016f4"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/6f4/4d0e39c25e73d637100016f4/rec-thumb.jpg", -"id":"4d0e39c25e73d637100016f4"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/567/4d0e39dd5e73d6370a001567/rec-original.jpg", -"id":"4d0e39dd5e73d6370a001567"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/567/4d0e39dd5e73d6370a001567/rec-poster.jpg", -"id":"4d0e39dd5e73d6370a001567"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/567/4d0e39dd5e73d6370a001567/rec-thumb.jpg", -"id":"4d0e39dd5e73d6370a001567"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/58a/4d0e39fb5e73d6371c00158a/rec-original.jpg", -"id":"4d0e39fb5e73d6371c00158a"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/58a/4d0e39fb5e73d6371c00158a/rec-poster.jpg", -"id":"4d0e39fb5e73d6371c00158a"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/58a/4d0e39fb5e73d6371c00158a/rec-thumb.jpg", -"id":"4d0e39fb5e73d6371c00158a"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/5f4/4d0e3a185e73d6370e0015f4/rec-original.jpg", -"id":"4d0e3a185e73d6370e0015f4"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/5f4/4d0e3a185e73d6370e0015f4/rec-poster.jpg", -"id":"4d0e3a185e73d6370e0015f4"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/5f4/4d0e3a185e73d6370e0015f4/rec-thumb.jpg", -"id":"4d0e3a185e73d6370e0015f4"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/67f/4d0e3a395e73d6371600167f/rec-original.jpg", -"id":"4d0e3a395e73d6371600167f"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/67f/4d0e3a395e73d6371600167f/rec-poster.jpg", -"id":"4d0e3a395e73d6371600167f"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/67f/4d0e3a395e73d6371600167f/rec-thumb.jpg", -"id":"4d0e3a395e73d6371600167f"}}], -"cast":[{"name":"Manuela Velasco", -"job":"Actor", -"department":"Actors", -"character":"Angela Vidal", -"id":34793, -"order":0, -"cast_id":1, -"url":"http://www.themoviedb.org/person/34793", -"profile":"http://cf1.imgobject.com/profiles/390/4c0157fa017a3c702d001390/manuela-velasco-thumb.jpg"}, -{"name":"Carlos Lasarte", -"job":"Actor", -"department":"Actors", -"character":"C\u00e9sar", -"id":54519, -"order":2, -"cast_id":3, -"url":"http://www.themoviedb.org/person/54519", -"profile":"http://cf1.imgobject.com/profiles/ba6/4d27aa297b9aa134d3001ba6/carlos-lasarte-thumb.jpg"}, -{"name":"Pablo Rosso", -"job":"Actor", -"department":"Actors", -"character":"Marcos", -"id":54520, -"order":3, -"cast_id":4, -"url":"http://www.themoviedb.org/person/54520", -"profile":""}, -{"name":"David Vert", -"job":"Actor", -"department":"Actors", -"character":"Alex", -"id":54521, -"order":4, -"cast_id":5, -"url":"http://www.themoviedb.org/person/54521", -"profile":"http://cf1.imgobject.com/profiles/c7e/4d27aad57b9aa134cb001c7e/david-vert-thumb.jpg"}, -{"name":"Vicente Gil", -"job":"Actor", -"department":"Actors", -"character":"Polizist", -"id":54522, -"order":5, -"cast_id":6, -"url":"http://www.themoviedb.org/person/54522", -"profile":"http://cf1.imgobject.com/profiles/c86/4d27ab237b9aa134cb001c86/vicente-gil-thumb.jpg"}, -{"name":"Martha Carbonell", -"job":"Actor", -"department":"Actors", -"character":"Frau Izquierdo", -"id":54523, -"order":6, -"cast_id":7, -"url":"http://www.themoviedb.org/person/54523", -"profile":"http://cf1.imgobject.com/profiles/c90/4d27ab777b9aa134cb001c90/martha-carbonell-thumb.jpg"}, -{"name":"Carlos Vicente", -"job":"Actor", -"department":"Actors", -"character":"Guillem", -"id":54524, -"order":7, -"cast_id":8, -"url":"http://www.themoviedb.org/person/54524", -"profile":"http://cf1.imgobject.com/profiles/b0f/4d27abcc7b9aa134cf001b0f/carlos-vicente-thumb.jpg"}, -{"name":"Ferran Terraza", -"job":"Actor", -"department":"Actors", -"character":"Manu", -"id":54532, -"order":8, -"cast_id":22, -"url":"http://www.themoviedb.org/person/54532", -"profile":"http://cf1.imgobject.com/profiles/129/4c4bfbab7b9aa1237f000129/ferran-terraza-thumb.jpg"}, -{"name":"Jorge Yamam", -"job":"Actor", -"department":"Actors", -"character":"Sergio", -"id":147878, -"order":9, -"cast_id":23, -"url":"http://www.themoviedb.org/person/147878", -"profile":"http://cf1.imgobject.com/profiles/cbb/4d27ac677b9aa134dc001cbb/jorge-yamam-thumb.jpg"}, -{"name":"Jaume Balaguer\u00f3", -"job":"Director", -"department":"Directing", -"character":"", -"id":54525, -"order":0, -"cast_id":9, -"url":"http://www.themoviedb.org/person/54525", -"profile":""}, -{"name":"Paco Plaza", -"job":"Director", -"department":"Directing", -"character":"", -"id":54526, -"order":0, -"cast_id":10, -"url":"http://www.themoviedb.org/person/54526", -"profile":""}, -{"name":"Jaume Balaguer\u00f3", -"job":"Screenplay", -"department":"Writing", -"character":"", -"id":54525, -"order":0, -"cast_id":11, -"url":"http://www.themoviedb.org/person/54525", -"profile":""}, -{"name":"Paco Plaza", -"job":"Screenplay", -"department":"Writing", -"character":"", -"id":54526, -"order":0, -"cast_id":12, -"url":"http://www.themoviedb.org/person/54526", -"profile":""}, -{"name":"Luis Berdejo", -"job":"Screenplay", -"department":"Writing", -"character":"", -"id":54527, -"order":0, -"cast_id":13, -"url":"http://www.themoviedb.org/person/54527", -"profile":""}, -{"name":"Julio Fern\u00e1ndez", -"job":"Producer", -"department":"Production", -"character":"", -"id":17083, -"order":0, -"cast_id":14, -"url":"http://www.themoviedb.org/person/17083", -"profile":""}, -{"name":"Carlos Fern\u00e1ndez", -"job":"Executive Producer", -"department":"Production", -"character":"", -"id":37950, -"order":0, -"cast_id":15, -"url":"http://www.themoviedb.org/person/37950", -"profile":""}, -{"name":"Alberto Marini", -"job":"Producer", -"department":"Production", -"character":"", -"id":54528, -"order":0, -"cast_id":16, -"url":"http://www.themoviedb.org/person/54528", -"profile":""}, -{"name":"Pablo Rosso", -"job":"Director of Photography", -"department":"Camera", -"character":"", -"id":54520, -"order":0, -"cast_id":17, -"url":"http://www.themoviedb.org/person/54520", -"profile":""}, -{"name":"Gemma Fauria", -"job":"Set Designer", -"department":"Art", -"character":"", -"id":54529, -"order":0, -"cast_id":18, -"url":"http://www.themoviedb.org/person/54529", -"profile":""}, -{"name":"David Gallart", -"job":"Editor", -"department":"Editing", -"character":"", -"id":28500, -"order":0, -"cast_id":19, -"url":"http://www.themoviedb.org/person/28500", -"profile":""}, -{"name":"Xavier Mas", -"job":"Sound Designer", -"department":"Sound", -"character":"", -"id":54530, -"order":0, -"cast_id":20, -"url":"http://www.themoviedb.org/person/54530", -"profile":""}, -{"name":"Gl\u00f2ria Viguer", -"job":"Costume Design", -"department":"Costume \u0026 Make-Up", -"character":"", -"id":54531, -"order":0, -"cast_id":21, -"url":"http://www.themoviedb.org/person/54531", -"profile":""}], -"version":150, -"last_modified_at":"2011-02-20 23:16:57"}] - */ - - public void mapToPerson(Map data, Person person) { - try { - person.setName((String) data.get("name")); - person.setBirthday(toDate(data, "birthday", "yyyy-MM-dd")); - person.setBirthplace((String) data.get("birthplace")); - String biography = (String) data.get("biography"); - person.setBiography(limit(biography,500)); - person.setVersion((Integer) data.get("version")); - person.setProfileImageUrl(selectImageUrl((List) data.get("profile"), "profile", "profile")); - person.setLastModified(toDate(data,"last_modified_at","yyyy-MM-dd HH:mm:ss")); - } catch (Exception e) { - throw new MovieDbException("Failed to map json for person", e); - } - } - - private String limit(String text, int limit) { - if (text==null || text.length() < limit) return text; - return text.substring(0,limit); - } - -/* - [{"popularity":3, -"name":"Glenn Strange", -"known_as":[{"name":"George Glenn Strange"}, -{"name":"Glen Strange"}, -{"name":"Glen 'Peewee' Strange"}, -{"name":"Peewee Strange"}, -{"name":"'Peewee' Strange"}], -"id":30112, -"biography":"", -"known_movies":4, -"birthday":"1899-08-16", -"birthplace":"Weed, - New Mexico, - USA", -"url":"http://www.themoviedb.org/person/30112", -"filmography":[{"name":"Bud Abbott Lou Costello Meet Frankenstein", -"id":3073, -"job":"Actor", -"department":"Actors", -"character":"The Frankenstein Monster", -"cast_id":23, -"url":"http://www.themoviedb.org/movie/3073", -"poster":"http://cf1.imgobject.com/posters/4ca/4bc9185d017a3c57fe0094ca/bud-abbott-lou-costello-meet-frankenstein-cover.jpg", -"adult":false, -"release":"1948-06-15"}, -{"name":"Arizona Days (1937)", -"id":22367, -"job":"Actor", -"department":"Actors", -"character":"Henchman Pete ", -"cast_id":12, -"url":"http://www.themoviedb.org/movie/22367", -"poster":"", -"adult":false, -"release":"1937-01-30"}, -{"name":"House of Dracula", -"id":30793, -"job":"Actor", -"department":"Actors", -"character":"The Frankenstein Monster", -"cast_id":3, -"url":"http://www.themoviedb.org/movie/30793", -"poster":"http://cf1.imgobject.com/posters/7cf/4bc97660017a3c57fe0367cf/house-of-dracula-cover.jpg", -"adult":false, -"release":"1945-01-01"}, -{"name":"The Fargo Kid", -"id":38704, -"job":"Actor", -"department":"Actors", -"character":"Sheriff Dave", -"cast_id":24, -"url":"http://www.themoviedb.org/movie/38704", -"poster":"http://cf1.imgobject.com/posters/04e/4d74018a5e73d6021d00004e/the-fargo-kid-cover.jpg", -"adult":false, -"release":"1940-12-06"}], -"profile":[], -"version":19, -"last_modified_at":"2011-03-07 13:02:35"}] -*/ - - - public Roles mapToRole(String roleString) { - if (roleString.equals("Actor")) { - return Roles.ACTS_IN; - } - if (roleString.equals("Director")) { - return Roles.DIRECTED; - } - return null; - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieDbLocalStorage.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieDbLocalStorage.java deleted file mode 100644 index 199c47986..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieDbLocalStorage.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -import org.codehaus.jackson.map.ObjectMapper; - -import java.io.*; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -public class MovieDbLocalStorage { - - private String storagePath; - protected ObjectMapper mapper; - - public MovieDbLocalStorage(String storagePath) { - this.storagePath = storagePath; - ensureStorageDirectoryExists(); - mapper = new ObjectMapper(); - } - - private void ensureStorageDirectoryExists() { - File storageDirectory = new File(storagePath); - if (!storageDirectory.isDirectory()) { - if (!storageDirectory.mkdirs()) { - throw new RuntimeException("Failed to create storage dir"); - } - } - } - - public boolean hasMovie(String movieId) { - return fileForMovie(movieId).exists(); - } - - private File fileForMovie(String movieId) { - return new File(storagePath, String.format("movie_%s.json", movieId)); - } - - public Map loadMovie(String movieId) { - File storageFile = fileForMovie(movieId); - return loadJsonValue(storageFile); - } - - private Map loadJsonValue(File storageFile) { - try { - final Object value = mapper.readValue(storageFile, Object.class); - if (value instanceof List) { - List list = (List) value; - if (list.isEmpty() || list.get(0).equals("Nothing found.")) return Collections.singletonMap("not_found", System.currentTimeMillis()); - return asMap(list.get(0)); - } - return asMap(value); - } catch (Exception e) { - throw new MovieDbException("Failed to load JSON from storage for file " + storageFile.getPath(), e); - } - } - - private Map asMap(Object value) { - if (value instanceof Map) { - return (Map) value; - } - final String typeInformation = value == null ? "null" : value.getClass().getSimpleName(); - throw new MovieDbException("Wrong movie data format, expected Map/JSON-Object but was "+ typeInformation); - } - - public void storeMovie(String movieId, Object movieData) { - File storageFile = fileForMovie(movieId); - storeJsonValue(movieData, storageFile); - } - - private void storeJsonValue(Object jsonData, File storageFile) { - try { - mapper.writeValue(storageFile,jsonData); - } catch (Exception e) { - throw new MovieDbException("Failed to store JSON to storage for file " + storageFile.getPath(), e); - } - } - - public boolean hasPerson(String personId) { - return fileForPerson(personId).exists(); - } - - private File fileForPerson(String personId) { - return new File(storagePath, String.format("person_%s.json", personId)); - } - - public Map loadPerson(String personId) { - File storageFile = fileForPerson(personId); - return loadJsonValue(storageFile); - } - - public void storePerson(String personId, Object personJson) { - File storageFile = fileForPerson(personId); - storeJsonValue(personJson, storageFile); - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieImporter.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieImporter.java deleted file mode 100644 index 0fa2c0fe5..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/movieimport/MovieImporter.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -import org.springframework.context.support.FileSystemXmlApplicationContext; - -import java.util.Collections; -import java.util.Map; - -/** - * @author mh - * @since 04.10.11 - */ -public class MovieImporter { - - private final MovieDbImportService importer; - - public static void main(String[] args) { - final FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext("src/main/webapp/WEB-INF/applicationContext.xml"); - try { - final MovieDbImportService importer = ctx.getBean(MovieDbImportService.class); - final MovieImporter movieImporter = new MovieImporter(importer); - movieImporter.runImport(getMovieIdsToImport(args)); - } finally { - ctx.close(); - } - } - - public MovieImporter(MovieDbImportService importer) { - this.importer = importer; - } - - private void runImport(Map movieIdsToImport) { - final long start = System.currentTimeMillis(); - final Map result = importer.importMovies(movieIdsToImport); - final long time = System.currentTimeMillis() - start; - for (Map.Entry movie : result.entrySet()) { - System.out.println(movie.getKey() + "\t" + movie.getValue()); - } - System.out.println("Imported movies took "+ time+" ms."); - } - - private static Map getMovieIdsToImport(String[] args) { - if (args.length == 0) { - throw new IllegalArgumentException("Usage: MovieImporter 1 10000\nWorking Directory should be the cineasts directory with the json files in data/json."); - } - if (args.length == 1) { - return Collections.singletonMap(Integer.valueOf(args[0]), Integer.valueOf(args[0])); - } - return Collections.singletonMap(Integer.valueOf(args[0]), Integer.valueOf(args[1])); - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/repository/MovieRepository.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/repository/MovieRepository.java deleted file mode 100644 index 408d6eb7e..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/repository/MovieRepository.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.neo4j.cineasts.repository; - -import org.neo4j.cineasts.domain.Movie; -import org.neo4j.cineasts.domain.User; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import org.springframework.data.neo4j.annotation.MapResult; -import org.springframework.data.neo4j.annotation.Query; -import org.springframework.data.neo4j.annotation.ResultColumn; -import org.springframework.data.neo4j.repository.GraphRepository; -import org.springframework.data.neo4j.repository.NamedIndexRepository; - -import java.util.List; - -public interface MovieRepository extends GraphRepository, NamedIndexRepository { - - Movie findById( String id ); - - Page findByTitleLike( String title, Pageable page ); - - @Query( "start user=node({0}) " + - " match user-[r:RATED]->movie<-[r2:RATED]-other-[r3:RATED]->otherMovie " + - " where r.stars >= 3 and r2.stars >= r.stars and r3.stars >= r.stars " + - " return otherMovie, avg(r3.stars) as rating, count(*) as cnt" + - " order by rating desc, cnt desc" + - " limit 10" ) - List getRecommendations( User user ); - - @MapResult - interface MovieRecommendation { - @ResultColumn( "otherMovie" ) - Movie getMovie(); - - @ResultColumn( "rating" ) - int getRating(); - } - - @Query( "START movie=node:Movie(id={0}) MATCH movie-[rating?:rating]->() RETURN movie, AVG(rating.stars)" ) - MovieData getMovieData( String movieId ); - - @MapResult - interface MovieData { - @ResultColumn( "movie" ) - Movie getMovie(); - - @ResultColumn( "avg(rating.stars)" ) - Integer getAverageRating(); - } -} \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/repository/PersonRepository.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/repository/PersonRepository.java deleted file mode 100644 index d9b22975d..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/repository/PersonRepository.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.neo4j.cineasts.repository; - -import org.neo4j.cineasts.domain.Person; -import org.springframework.data.neo4j.annotation.Query; -import org.springframework.data.neo4j.repository.GraphRepository; - -/** - * @author mh - * @since 02.04.11 - */ -public interface PersonRepository extends GraphRepository { - @Query(value = "START me=node({0}), friend=node({1} MATCH p=me-[:friend*2..6]-friend RETURN nodes(p)") - Iterable> getPathsBetween(Person a, Person b); - - Person findById(String id); -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/repository/UserRepository.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/repository/UserRepository.java deleted file mode 100644 index d879532be..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/repository/UserRepository.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.neo4j.cineasts.repository; - -import org.neo4j.cineasts.domain.User; -import org.springframework.data.neo4j.repository.GraphRepository; - -/** - * @author mh - * @since 02.04.11 - */ -public interface UserRepository extends GraphRepository { -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/CineastsRepository.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/CineastsRepository.java deleted file mode 100644 index 4e2baa0c5..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/CineastsRepository.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.neo4j.cineasts.service; - -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.repository.MovieRepository; -import org.neo4j.cineasts.repository.PersonRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -@Repository -@Transactional -public class CineastsRepository { - - @Autowired - private PersonRepository personRepository; - @Autowired - private MovieRepository movieRepository; - - - public Movie getMovie( String id ) { - return movieRepository.findById( id ); - } - - public Page findMovies( String query, int max ) { - return movieRepository.findByTitleLike( query, new PageRequest( 0, max ) ); - } - - public Person getPerson( String id ) { - return personRepository.findById( id ); - } - - public Rating rateMovie( Movie movie, User user, int stars, String comment ) { - if( user == null || movie == null ) return null; - return user.rate( movie, stars, comment ); - } - - public List recommendMovies( User user ) { - return movieRepository.getRecommendations( user ); - } - - public MovieRepository.MovieData getMovieData( String movieId ) { - return movieRepository.getMovieData( movieId ); - } -} \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/CineastsUserDetails.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/CineastsUserDetails.java deleted file mode 100644 index 0bad6f7c3..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/CineastsUserDetails.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.neo4j.cineasts.service; - -import org.neo4j.cineasts.domain.User; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.userdetails.UserDetails; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - -/** -* @author mh -* @since 07.03.11 -*/ -public class CineastsUserDetails implements UserDetails { - private final User user; - - public CineastsUserDetails(User user) { - this.user = user; - } - - @Override - public Collection getAuthorities() { - User.Roles[] roles = user.getRole(); - if (roles ==null) return Collections.emptyList(); - return Arrays.asList(roles); - } - - @Override - public String getPassword() { - return user.getPassword(); - } - - @Override - public String getUsername() { - return user.getLogin(); - } - - @Override - public boolean isAccountNonExpired() { - return true; - } - - @Override - public boolean isAccountNonLocked() { - return true; - } - - @Override - public boolean isCredentialsNonExpired() { - return true; - } - - @Override - public boolean isEnabled() { - return true; - } - - public User getUser() { - return user; - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/CineastsUserDetailsService.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/CineastsUserDetailsService.java deleted file mode 100644 index 3f4e81a67..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/CineastsUserDetailsService.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.neo4j.cineasts.service; - -import org.neo4j.cineasts.domain.User; -import org.neo4j.cineasts.repository.UserRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContext; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -/** - * @author mh - * @since 06.03.11 - */ -@Service -public class CineastsUserDetailsService implements UserDetailsService { - - @Autowired - private UserRepository userRepository; - - @Override - public UserDetails loadUserByUsername(String login) throws UsernameNotFoundException, DataAccessException { - final User user = findUser(login); - if (user==null) throw new UsernameNotFoundException("Username not found",login); - return new CineastsUserDetails(user); - } - - public User findUser(String login) { - return userRepository.findByPropertyValue("login",login); - } - - - public User getUserFromSession() { - SecurityContext context = SecurityContextHolder.getContext(); - Authentication authentication = context.getAuthentication(); - Object principal = authentication.getPrincipal(); - if (principal instanceof CineastsUserDetails) { - CineastsUserDetails userDetails = (CineastsUserDetails) principal; - return userDetails.getUser(); - } - return null; - } - - @Transactional - public User register(String login, String name, String password) { - User found = findUser(login); - if (found!=null) throw new RuntimeException("Login already taken: "+login); - if (name==null || name.isEmpty()) throw new RuntimeException("No name provided."); - if (password==null || password.isEmpty()) throw new RuntimeException("No password provided."); - User user=userRepository.save(new User(login,name,password,User.Roles.ROLE_USER)); - setUserInSession(user); - return user; - } - - private void setUserInSession(User user) { - SecurityContext context = SecurityContextHolder.getContext(); - CineastsUserDetails userDetails = new CineastsUserDetails(user); - UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, user.getPassword(),userDetails.getAuthorities()); - context.setAuthentication(authentication); - - } - - @Transactional - public void addFriend(String login) { - User friend = findUser(login); - User user = getUserFromSession(); - if (!user.equals(friend)) { - user.addFriend(friend); - } - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/DatabasePopulator.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/DatabasePopulator.java deleted file mode 100644 index 4ce0ff9b4..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/DatabasePopulator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.neo4j.cineasts.service; - -import org.neo4j.kernel.AbstractGraphDatabase; -import org.neo4j.cineasts.domain.*; -import org.neo4j.cineasts.movieimport.MovieDbImportService; -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.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.List; - -import static java.util.Arrays.asList; - -/** - * @author mh - * @since 04.03.11 - */ -@Service -public class DatabasePopulator { - - @Autowired - Neo4jTemplate template; - @Autowired - CineastsRepository repository; - - @Autowired - MovieDbImportService importService; - private final static Logger log = LoggerFactory.getLogger(DatabasePopulator.class); - - @Transactional - public List populateDatabase() { - User me = new User("micha", "Micha", "password", User.Roles.ROLE_ADMIN,User.Roles.ROLE_USER).persist(); - User ollie = new User("ollie", "Olliver", "password",User.Roles.ROLE_USER).persist(); - me.addFriend(ollie); - List ids = asList(19995 , 194, 600, 601, 602, 603); //, 604, 605, 606, 607, 608, 609, 13, 20526, 11, 1893, 1892, 1894, 168, 193, 200, 157, 152, 201, 154, 12155, 58, 285, 118, 22, 392, 5255, 568, 9800, 497, 101, 120, 121, 122); - List result=new ArrayList(ids.size()); - for (Integer id : ids) { - result.add(importService.importMovie(String.valueOf(id))); - } - - //me.rate(repository.getMovie("13"),5,"Inspiring"); - me.rate(repository.getMovie("603"),5,"Best of the series"); - return result; - } - - @Transactional - public void cleanDb() { - new Neo4jDatabaseCleaner((AbstractGraphDatabase) template.getGraphDatabaseService()).cleanDb(); - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/FriendsMovieRecommendations.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/FriendsMovieRecommendations.java deleted file mode 100644 index 9f63b5b01..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/FriendsMovieRecommendations.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.neo4j.cineasts.service; - -import org.neo4j.cineasts.domain.Movie; -import org.neo4j.cineasts.domain.Rating; -import org.neo4j.cineasts.domain.User; -import org.neo4j.graphdb.traversal.Evaluators; -import org.neo4j.graphdb.traversal.TraversalDescription; -import org.neo4j.kernel.Traversal; -import org.neo4j.kernel.Uniqueness; -import org.springframework.data.neo4j.core.EntityPath; - -import java.util.HashMap; -import java.util.Map; - -import static org.neo4j.graphdb.DynamicRelationshipType.withName; - -/** - * @author mh - * @since 04.04.11 - */ -public class FriendsMovieRecommendations { - private final Map ratings = new HashMap(); - private final int ratingDistance; - - public static class MovieRating { - int stars; - int count; - public void update(Rating rating, int weight) { - this.stars += rating.getStars()*weight; - this.count += weight; - } - public int average() { - return count == 0 ? 0 : stars / count; - } - public String toString() { - return String.valueOf(average()); - } - - } - public FriendsMovieRecommendations(int ratingDistance) { - this.ratingDistance = ratingDistance; - } - - public Map getRecommendationsFor(User user) { - TraversalDescription traversal = Traversal.description().breadthFirst() - .uniqueness(Uniqueness.NODE_GLOBAL).relationships(withName(User.FRIEND)) - .evaluator(Evaluators.toDepth(ratingDistance)).evaluator(Evaluators.excludeStartPosition()); - - Iterable result = user.findAllPathsByTraversal(traversal); - Iterable> friends = (Iterable>)result; - for (EntityPath path : friends) { - int weight = ratingDistance - path.length(); - User friend = path.endEntity(); - aggregateRatings(friend,weight); - } - for (Rating rating : user.getRatings()) { - ratings.remove(rating.getMovie()); - } - return ratings; - } - - private void aggregateRatings(User friend, int weight) { - for (Rating rating : friend.getRatings()) { - obtainRating(rating.getMovie()).update(rating, weight); - } - } - - private MovieRating obtainRating(Movie movie) { - if (!ratings.containsKey(movie)) { - ratings.put(movie, new MovieRating()); - } - return ratings.get(movie); - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/MovieRecommendations.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/MovieRecommendations.java deleted file mode 100644 index ac262f5de..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/MovieRecommendations.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.neo4j.cineasts.service; - -import org.neo4j.cineasts.domain.Movie; -import org.neo4j.cineasts.domain.User; -import org.neo4j.cineasts.repository.MovieRepository; -import org.neo4j.graphdb.Path; -import org.neo4j.graphdb.Relationship; -import org.neo4j.graphdb.traversal.Evaluation; -import org.neo4j.graphdb.traversal.Evaluator; -import org.neo4j.graphdb.traversal.TraversalDescription; -import org.neo4j.kernel.Traversal; -import org.neo4j.kernel.Uniqueness; - -import java.util.HashMap; -import java.util.Map; - -import static org.neo4j.graphdb.Direction.OUTGOING; -import static org.neo4j.graphdb.DynamicRelationshipType.withName; - -/** -* @author mh -* @since 04.04.11 -*/ -class MovieRecommendations implements Evaluator { - private final Map ratings=new HashMap(); - private final int ratingDistance; - private MovieRepository movieRepository; - - public MovieRecommendations(MovieRepository movieRepository, int ratingDistance) { - this.movieRepository = movieRepository; - this.ratingDistance = ratingDistance; - } - - public Map getRecommendationsFor(User user) { - TraversalDescription traversal= Traversal.description().breadthFirst() - .uniqueness(Uniqueness.NODE_PATH) - .relationships(withName(User.FRIEND)) - .relationships(withName(User.RATED), OUTGOING) - .evaluator(this); - return averageRecommendations(user, traversal); - } - - private Map averageRecommendations(User user, TraversalDescription traversal) { // todo sort, limit - Map result=new HashMap(); - for (Movie movie : movieRepository.findAllByTraversal(user, traversal)) { - final int[] rating = ratings.get(movie.getNodeId()); - result.put(movie, rating[1]==0 ? 0 : rating[0]/rating[1]); - } - return result; - } - - @Override - public Evaluation evaluate(Path path) { - final int distance = path.length() - 1; - if (distance > ratingDistance) return Evaluation.EXCLUDE_AND_PRUNE; - Relationship rated = path.lastRelationship(); - if (rated != null && rated.getType().name().equals(User.RATED)) { - if (distance == 0) return Evaluation.EXCLUDE_AND_PRUNE; // my rated movies - updateRating(rated, distance); - return Evaluation.INCLUDE_AND_PRUNE; - } - System.out.println(); - return Evaluation.EXCLUDE_AND_CONTINUE; - } - - private void updateRating(Relationship rated, int distance) { - final long movieId = rated.getEndNode().getId(); - int[] rating = obtainRating(movieId); - - int weight = ratingDistance - distance; - final Integer stars = (Integer) rated.getProperty("stars", 0); - rating[0] += weight * stars; - rating[1] += weight; - } - - private int[] obtainRating(long movieId) { - if (!ratings.containsKey(movieId)) { - ratings.put(movieId,new int[2]); - } - return ratings.get(movieId); - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/Neo4jDatabaseCleaner.java b/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/Neo4jDatabaseCleaner.java deleted file mode 100644 index 9f71038f6..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/java/org/neo4j/cineasts/service/Neo4jDatabaseCleaner.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.neo4j.cineasts.service; - -import org.neo4j.graphdb.Direction; -import org.neo4j.graphdb.Node; -import org.neo4j.graphdb.Relationship; -import org.neo4j.graphdb.Transaction; -import org.neo4j.graphdb.index.IndexManager; -import org.neo4j.kernel.AbstractGraphDatabase; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -/** - * @author mh - * @since 02.03.11 - */ -public class Neo4jDatabaseCleaner { - private AbstractGraphDatabase graph; - - public Neo4jDatabaseCleaner(AbstractGraphDatabase graph) { - this.graph = graph; - } - - public Map cleanDb() { - Map result = new HashMap(); - Transaction tx = graph.beginTx(); - try { - removeNodes(result); - clearIndex(result); - tx.success(); - } finally { - tx.close(); - } - return result; - } - - private void removeNodes(Map result) { - Node refNode = graph.getReferenceNode(); - int nodes = 0, relationships = 0; - for (Node node : graph.getAllNodes()) { - for (Relationship rel : node.getRelationships(Direction.OUTGOING)) { - rel.delete(); - relationships++; - } - if (!refNode.equals(node)) { - node.delete(); - nodes++; - } - } - result.put("nodes", nodes); - result.put("relationships", relationships); - - } - - private void clearIndex(Map result) { - IndexManager indexManager = graph.index(); - result.put("node-indexes", Arrays.asList(indexManager.nodeIndexNames())); - result.put("relationship-indexes", Arrays.asList(indexManager.relationshipIndexNames())); - for (String ix : indexManager.nodeIndexNames()) { - indexManager.forNodes(ix).delete(); - } - for (String ix : indexManager.relationshipIndexNames()) { - indexManager.forRelationships(ix).delete(); - } - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/resources/log4j.properties b/spring-data-neo4j-examples/cineasts-rest/src/main/resources/log4j.properties deleted file mode 100644 index 37867140a..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/resources/log4j.properties +++ /dev/null @@ -1,7 +0,0 @@ -log4j.rootLogger=warn, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout - -#log4j.category.org.springframework.web=DEBUG - diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/applicationContext-security.xml b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/applicationContext-security.xml deleted file mode 100644 index 8266a217b..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/applicationContext-security.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file 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 deleted file mode 100644 index 87a0a4c0a..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/applicationContext.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/decorators.xml b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/decorators.xml deleted file mode 100644 index 1dab375ce..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/decorators.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - / - - - /* - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml deleted file mode 100644 index 2f428fc98..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file 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 deleted file mode 100644 index fffb8c52e..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/actors/show.jsp +++ /dev/null @@ -1,36 +0,0 @@ -<%@ page session="false" %> -<%@ taglib uri="http://www.springframework.org/tags" prefix="s" %> -<%@ 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"--%> - - -
-
-
-
-

${actor.name}

-

Born in ${actor.birthplace}.

-
-
-
-
-

Biography

-

${actor.biography}

-

Roles

- - - -
-
- -

Actor cannot be found.

-
-
diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/auth/deniedpage.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/auth/deniedpage.jsp deleted file mode 100644 index 7057a169d..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/auth/deniedpage.jsp +++ /dev/null @@ -1,7 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" %> - - - Access denied - - Unfortunately you are not authorized to see this page. - diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/auth/loginpage.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/auth/loginpage.jsp deleted file mode 100644 index 4ac9ab507..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/auth/loginpage.jsp +++ /dev/null @@ -1,36 +0,0 @@ -<%@ page import="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> -<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %> - -<%@ page language="java" contentType="text/html; charset=UTF-8" -pageEncoding="UTF-8"%> - - - - - Login - - - -

Login

-
${error}
- -
-

- - -

-

- - -

-

- Remember me -

- -

- Register - - diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/auth/registerpage.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/auth/registerpage.jsp deleted file mode 100644 index 4a9c2d6e0..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/auth/registerpage.jsp +++ /dev/null @@ -1,37 +0,0 @@ -<%@ page import="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> -<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %> - -<%@ page language="java" contentType="text/html; charset=UTF-8" -pageEncoding="UTF-8"%> - - - - - Login - - - -

Login

-
${error}
- -
-

- - -

-

- - -

-

- - -

- -
-
- Login - - diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/decorators/frontpage.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/decorators/frontpage.jsp deleted file mode 100644 index 4d82b031f..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/decorators/frontpage.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" - prefix="decorator" %> -<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> - - - - - Cineasts.net - <decorator:title default="Welcome" /> - - - <%@ include file="/WEB-INF/views/includes/style.jsp" %> - <%@ include file="/WEB-INF/views/includes/js.jsp" %> - - - -
- -
- <%@ include file="/WEB-INF/views/includes/footer.jsp" %> - - diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/decorators/main.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/decorators/main.jsp deleted file mode 100644 index 96d6d65c6..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/decorators/main.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" - prefix="decorator" %> -<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> - - - - - Cineasts.net - <decorator:title default="Welcome" /> - - - <%@ include file="/WEB-INF/views/includes/style.jsp" %> - <%@ include file="/WEB-INF/views/includes/js.jsp" %> - - - -
- -
- <%@ include file="/WEB-INF/views/includes/footer.jsp" %> - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/import/result.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/import/result.jsp deleted file mode 100644 index 5c9f63b43..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/import/result.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ page session="false" %> -<%@ taglib uri="http://www.springframework.org/tags" prefix="s" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> - -

Results for importing movies: "${ids}"

- -

Imported of ${fn:length(movies)} movies took ${duration} seconds.

- -
- -
${entry.key}
-
${entry.value}
-
-
diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/footer.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/footer.jsp deleted file mode 100644 index 1ddcc0b6b..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/footer.jsp +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/header-frontpage.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/header-frontpage.jsp deleted file mode 100644 index c851575ab..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/header-frontpage.jsp +++ /dev/null @@ -1,3 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" session="false" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/header.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/header.jsp deleted file mode 100644 index c851575ab..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/header.jsp +++ /dev/null @@ -1,3 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" session="false" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/header_login.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/header_login.jsp deleted file mode 100644 index 844a034fe..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/header_login.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" session="false" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - - diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/js.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/js.jsp deleted file mode 100644 index e69de29bb..000000000 diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/links.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/links.jsp deleted file mode 100644 index e69de29bb..000000000 diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/navigation.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/navigation.jsp deleted file mode 100644 index 81c2a4e9b..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/navigation.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" session="false" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - - diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/search.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/search.jsp deleted file mode 100644 index 0aebd4917..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/search.jsp +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/style.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/style.jsp deleted file mode 100644 index 1d77d9f54..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/includes/style.jsp +++ /dev/null @@ -1,4 +0,0 @@ - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/index.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/index.jsp deleted file mode 100644 index 049b8fe23..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/index.jsp +++ /dev/null @@ -1,11 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" session="false" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -
-

Welcome to Cineasts.net

-
-
- - -
-
-
\ No newline at end of file diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/movies/list.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/movies/list.jsp deleted file mode 100644 index 0aabbaaf0..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/movies/list.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@ page session="false" %> -<%@ taglib uri="http://www.springframework.org/tags" prefix="s" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - -

Results for "${query}"

- - - - - - -

No movies found for query "${query}".

-
-
diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/movies/show.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/movies/show.jsp deleted file mode 100644 index 9e47500bc..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/movies/show.jsp +++ /dev/null @@ -1,170 +0,0 @@ -<%@ page session="false" %> -<%@ taglib uri="http://www.springframework.org/tags" prefix="s" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> -<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> - - -${movie.title} - - - -
-
- <%--@elvariable id="movie" type="org.neo4j.cineasts.domain.Movie"--%> - - -
"/>
-
-

${movie.title} (${movie.year}) ${stars} stars

-
-

<${movie.tagline}

-
-
- -
-

Movie facts

- - - - - - - - - - - - - - - - - - - - - - - - - - -
Language${movie.language}
Runtime${movie.runtime} Minutes
Genre${movie.genre}
Other sitesTheMovieDb.org | - IMDb -
Buy DVDs & Books">Amazon | - ">CineButler -
In Cinemas">Google Movies -
-
- -
- -

Trailers

- - - - - - - - - -
-
- -
-

Release info

- -
    -
  • - - - - - - - - - - - - - - - -
    Released
    Homepage
    Studio${movie.studio}
    -
  • -
-
- -
-
-
-
-

Overview

-

${movie.description}

- -

Cast

- - -
-
- -

Reviews

- - -
"> -

Give - - - - to "${movie.title}" saying: - - - -

-
- -
- - - -
-
-
-
- -

No movie found

-

The movie you were looking for could not be found.

-
-
- diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/user/index.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/user/index.jsp deleted file mode 100644 index 700045c24..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/user/index.jsp +++ /dev/null @@ -1,103 +0,0 @@ -<%--@elvariable id="recommendations" type="java.util.Map"--%> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%--@elvariable id="user" type="org.neo4j.cineasts.domain.User"--%> - - - Profile - - - -
-
-
" />
-
-

Hi ${user.name}!

-

${user.info}

-
-
-
- - - -

Your friends

-
    - -
  • - ">" /> -
    -

    ">

    -

    ${friend.info}

    -
    -
    -
  • -
    -
-
- -

You don't have any friends yet

-
-
-
-
-
-
-

Your rated movies

-
- -
-

${fn:length(ratings)}

-
- -
- -
-

Your recommendations

-
-
-

${fn:length(recommendations)}

-
- -
-
-
- - - diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/user/public.jsp b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/user/public.jsp deleted file mode 100644 index 9b46bae21..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/views/user/public.jsp +++ /dev/null @@ -1,86 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%--@elvariable id="user" type="org.neo4j.cineasts.domain.User"--%> - - - Profile for ${name} - - -
-
-
" />
-
-

${name}

-

${profiled.info}

-
-
-
- -

${name}'s friends

- - - - - -
    - -
  • - ">" /> -
    -

    ">

    -

    ${friend.info}

    -
    -
    -
  • -
    -
-
- - ${name} has no friends. - -
-
- -
- Add ${name} as a friend. -
-
-
-
- -
-
-
-

${name}'s rated movies

-
-
-

${fn:length(ratings)}

-
- - - -
-
-
- - diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/web.xml b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 7200fc201..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - contextConfigLocation - - /WEB-INF/applicationContext-security.xml - /WEB-INF/applicationContext.xml - - - - - org.springframework.web.context.ContextLoaderListener - - - - sitemesh - - com.opensymphony.module.sitemesh.filter.PageFilter - - - - - springSecurityFilterChain - org.springframework.web.filter.DelegatingFilterProxy - - - - springSecurityFilterChain - /* - - - - sitemesh - /* - - - - dispatcherServlet - org.springframework.web.servlet.DispatcherServlet - 1 - - - - dispatcherServlet - / - - - - index.jsp - - - - 60 - - diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/actor-picture-frame.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/actor-picture-frame.png deleted file mode 100644 index cb58bc5a9..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/actor-picture-frame.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/cineasts.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/cineasts.png deleted file mode 100644 index e7778456b..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/cineasts.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/filmroll-horizontal.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/filmroll-horizontal.png deleted file mode 100644 index e4d71d2c2..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/filmroll-horizontal.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/filmroll-vertical-full.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/filmroll-vertical-full.png deleted file mode 100644 index 3270bbd07..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/filmroll-vertical-full.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/header-curtain.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/header-curtain.png deleted file mode 100644 index 5b23f8ec7..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/header-curtain.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/header-splash-bg.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/header-splash-bg.png deleted file mode 100644 index e4f78a20a..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/header-splash-bg.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo-splash.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo-splash.png deleted file mode 100644 index 2d1815a1e..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo-splash.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo.png deleted file mode 100644 index 98fbfde7c..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo/neo4j.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo/neo4j.png deleted file mode 100644 index c96c298ed..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo/neo4j.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo/springdata.jpg b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo/springdata.jpg deleted file mode 100644 index a45ae83da..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo/springdata.jpg and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo/springdatagraph.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo/springdatagraph.png deleted file mode 100644 index df46c007f..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo/springdatagraph.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo/springsource.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo/springsource.png deleted file mode 100644 index e573cde33..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/logo/springsource.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/movie-placeholder.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/movie-placeholder.png deleted file mode 100644 index cc73fce08..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/movie-placeholder.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/neo4j.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/neo4j.png deleted file mode 100644 index ee5cac71c..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/neo4j.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/profile-placeholder-small.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/profile-placeholder-small.png deleted file mode 100644 index 44dc7e19f..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/profile-placeholder-small.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/profile-placeholder.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/profile-placeholder.png deleted file mode 100644 index 66ff4f73d..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/profile-placeholder.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_0.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_0.png deleted file mode 100644 index bf5766366..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_0.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_1.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_1.png deleted file mode 100644 index 48730c132..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_1.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_2.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_2.png deleted file mode 100644 index b91aa3345..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_2.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_3.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_3.png deleted file mode 100644 index fe3eb1757..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_3.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_4.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_4.png deleted file mode 100644 index 2e55bb019..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_4.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_5.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_5.png deleted file mode 100644 index faddfa4a1..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rated_5.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rating-active.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rating-active.png deleted file mode 100644 index 50b708b33..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rating-active.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rating-disabled.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rating-disabled.png deleted file mode 100644 index 32cfa2c85..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/rating-disabled.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/searchbar-big-searchicon.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/searchbar-big-searchicon.png deleted file mode 100644 index eca23c8e7..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/searchbar-big-searchicon.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/searchbar-big.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/searchbar-big.png deleted file mode 100644 index faf80be44..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/searchbar-big.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/springdata.jpg b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/springdata.jpg deleted file mode 100644 index 90f4de574..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/springdata.jpg and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/springdatagraph.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/springdatagraph.png deleted file mode 100644 index 1718b3475..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/springdatagraph.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/springsource.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/springsource.png deleted file mode 100644 index 36b42b001..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/springsource.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/star.png b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/star.png deleted file mode 100644 index 983454b95..000000000 Binary files a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/images/star.png and /dev/null differ diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/resources/forms.css b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/resources/forms.css deleted file mode 100644 index 2f3103131..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/resources/forms.css +++ /dev/null @@ -1,13 +0,0 @@ -label { - display: block; - float: left; - width: 120px; -} - -/** - * Label for radio buttons, normal buttons and checkboxes. - */ -label.button-label { - display:inline; - float:none; -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/resources/grid.css b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/resources/grid.css deleted file mode 100644 index 881cf609a..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/resources/grid.css +++ /dev/null @@ -1,18 +0,0 @@ -.span-1 { width: 6.958%; float:left; margin-right:1.5%; } -.span-2 { width: 15.416%; float:left; margin-right:1.5%; } -.span-3 { width: 23.875%; float:left; margin-right:1.5%; } -.span-4 { width: 32.333%; float:left; margin-right:1.5%; } -.span-5 { width: 40.791%; float:left; margin-right:1.5%; } -.span-6 { width: 49.250%; float:left; margin-right:1.5%; } -.span-7 { width: 57.708%; float:left; margin-right:1.5%; } -.span-8 { width: 66.166%; float:left; margin-right:1.5%; } -.span-9 { width: 74.625%; float:left; margin-right:1.5%; } -.span-10 { width: 83.083%; float:left; margin-right:1.5%; } -.span-11 { width: 91.541%; float:left; margin-right:1.5%; } -.span-12 { width: 100%; float:left; margin-right:0%; } - -.span-third { width: 32%; float:left; margin-right:2%; } -.span-half { width: 49%; float:left; margin-right:2%; } -.span-all { width: 100%; float:left; clear:right; } - -.last { clear:right; margin-right:0; } diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/resources/style.css b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/resources/style.css deleted file mode 100644 index 316a5a2a5..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/resources/style.css +++ /dev/null @@ -1,328 +0,0 @@ - -@import url(typography.css); -@import url(forms.css); -@import url(grid.css); - -* { - outline-style: none; -} - -body { - margin:0; - padding:0; - background : #010100; -} - -a img { border:0; } - -/** - * MAIN COMPONENTS - */ - -#header { - background: url(../images/header-curtain.png) repeat-y bottom center #010100; - border-bottom: 1px solid #5C5C45; -} - -#logo img { - padding: 10px 10px 0; -} - -#header-topbar { - height: 49px; - padding: 0 0 0 10px; - background: url(../images/filmroll-horizontal.png) repeat-x bottom left transparent; -} - -#header-splash { - text-align:center; - background: url(../images/header-splash-bg.png) repeat-x bottom center; -} - -#logo-splash { - position:relative; - top:4px; -} - - -#header-menu { - float: right; - color: #DDDDDD; - height:28px; - background:#0b0f07; - padding: 10px 10px; -} - -.search { - float:left; - padding:0 10px; -} - -.navigation { - float:left; -} - -.navigation a { - color: #d8d8d8; - text-decoration:none; - padding: 0 0 0 5px; -} - -#content { - padding: 10px; -} - -#footer { - text-align:center; - color: #999999; - font-size: 12px; - padding: 10px; - clear:both; -} - -#footer img { - padding: 10px; -} -/** - * SEARCH RESULTS - */ - -.search-results > li { - border-top: 1px solid #666666; - padding: 10px; -} - -.search-result-details { -/* float:left; - padding: 0px 10px; - */ -} - -/** - * PROFILE, ACTOR AND MOVIE PAGES - */ - -.profile-header { - clear:both; -} - -.profile-image { - float:left; -} - -.profile-image img { - width: 100px; -} -.actor-image img, .profile-image img, .friend-image img, .thumbnail img { - border: 1px solid #4C5C2A !important; -} - -.thumbnail { - display:block; - /* float:left;*/ -} -.thumbnail img { - height: 100px; -} - -.actor-framed-image { - background: url(../images/actor-picture-frame.png) no-repeat; - width:166px; - height:214px; - padding: 6px 60px 16px; -} - -.actor-sidebar { - padding: 0 56px; -} - -.profile-header-details { - float: left; - padding: 0 10px; -} - -.profile-feed { - background: none repeat scroll 0 0 #252525; - border: 5px solid #CACF81; - padding: 10px; -} - -.facts { - width:50%; - float:left; -} - -.movie-content-outer, .actor-content-outer { - background: url(../images/filmroll-vertical-full.png) no-repeat top right; - padding-right: 38px; -} - -.movie-content, .actor-content { - background: url(../images/filmroll-vertical-full.png) no-repeat top left; - padding: 0 10px 0 48px; - min-height:690px; -} - -.actors-list li { - width:100px; - float:left; -} - -.actors-list img { - height:92px; - display:block; -} - -.friends-list li { - border-top:1px solid #333; - padding: 5px 0; -} - -.friends-list .friend-image { - float:left; -} - -.friend-image img { - height: 64px; -} -.friends-list .friend-info { - float:left; - padding: 0 5px; -} - -.friends-list h3, .search-results h3 { - border:none; - margin: 5px 0; -} - -.friends-list h3 a, .search-results h3 a { - text-decoration:none; - color: #99CC33; -} - -.rated-movies-list h3 { - margin: 0; - padding: 5px 0; - float: left; -} - -.rated-movies-list h3 a { - color: #99CC33; - text-decoration:none; -} - -.rated-movies-list li { - position:relative; - height:20px; - padding:8px 0; -} - -.rated-movies-list .rating { -/* position:absolute; - right:0; - top:5px; -*/ - float: right; -} - -/** - * BIG SEARCH - */ - -#big-search-wrap { - padding: 20px 0; - text-align: center; -} - -.big-search { - background: url("../images/searchbar-big.png") no-repeat scroll 0 0 transparent; - border: 0 none; - height: 50px; - width: 480px; - font-size: 22px; - padding: 0 10px; -} - -.big-search-submit { - background: url("../images/searchbar-big-searchicon.png") no-repeat scroll 0 0 transparent; - border: 0 none; - color: transparent; - cursor: pointer; - height: 40px; - left: -75px; - position: relative; - width: 41px; -} - -/** - * RATINGS - */ - -.rating-input li, .rating-input lh { - float:left; -} - -.rating { - display: block; - height: 20px; - width: 110px; -} - -.rating li { - height: 28px; - width: 22px; - display:block; - float:left; - padding:0 2px; -} - -.rating li.active { - background: url("/images/rating-active.png") no-repeat scroll center 0 transparent; -} - -.rating li.disabled { -/* background: url("/images/rating-disabled.png") no-repeat scroll center 0 transparent; */ -} - -/** - * TABLES - */ - -table th { - text-align: left; -} - -/** - * LISTS - */ - -ul { - list-style:none; - padding:0; -} - -lh { - font-weight:bold; -} - -/** - * UTILS - */ - -.break { - clear:both; -} - - -/** - * ERRORS - */ - -.error { - color:red; -} - -a { - text-decoration: none; - color: #99CC33; -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/resources/typography.css b/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/resources/typography.css deleted file mode 100644 index 7410d6f29..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/main/webapp/resources/typography.css +++ /dev/null @@ -1,32 +0,0 @@ - -body { - font-family:tahoma,verdana,sans-serif,serif; - color: #666666; - font-size:13px; -} - -h2 { - color: #314718; /*#99CC33;*/ - font-size: 16px; - text-transform: uppercase; -} - -h3 { - color: #314718; /*#ff6600;*/ - font-size: 14px; - text-transform: uppercase; - border-bottom: 1px solid #333333; -} - -h4 { - margin: 5px 0; -} - -.tiny-link { - color: #222; - font-size:12px; - text-decoration:none; -} -.tiny-link:hover { - text-decoration:underline; -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/test/java/org/neo4j/cineasts/domain/DomainTests.java b/spring-data-neo4j-examples/cineasts-rest/src/test/java/org/neo4j/cineasts/domain/DomainTests.java deleted file mode 100644 index 751d5add6..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/test/java/org/neo4j/cineasts/domain/DomainTests.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.neo4j.cineasts.domain; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.neo4j.cineasts.repository.MovieRepository; -import org.neo4j.cineasts.repository.UserRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.neo4j.rest.support.RestTestBase; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; - -import static org.junit.Assert.*; -import static org.junit.matchers.JUnitMatchers.hasItem; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration({"/movies-test-context.xml"}) -@Transactional -public class DomainTests extends RestTestBase { - - @Autowired - protected MovieRepository movieRepository; - @Autowired - protected UserRepository userRepository; - - @Test - public void actorCanPlayARoleInAMovie() { - Person tomHanks = new Person("1", "Tom Hanks").persist(); - Movie forestGump = new Movie("1", "Forrest Gump").persist(); - - Role role = tomHanks.playedIn(forestGump, "Forrest"); - - Movie foundForestGump = this.movieRepository.findByPropertyValue(null, "id", "1"); - - assertEquals("created and looked up movie equal", forestGump, foundForestGump); - Role firstRole = foundForestGump.getRoles().iterator().next(); - assertEquals("role forrest", role, firstRole); - assertEquals("role forrest", "Forrest", firstRole.getName()); - } - - @Test - public void canFindMovieByTitleQuery() { - Movie forestGump = new Movie("1", "Forrest Gump").persist(); - Iterator queryResults = movieRepository.findAllByQuery("search", "title", "Forre*").iterator(); - assertTrue("found movie by query", queryResults.hasNext()); - Movie foundMovie = queryResults.next(); - assertEquals("created and looked up movie equal", forestGump, foundMovie); - assertFalse("found only one movie by query", queryResults.hasNext()); - } - - @Test - public void userCanRateMovie() { - Movie movie = new Movie("1", "Forrest Gump").persist(); - User user = new User("ich", "Micha", "password").persist(); - Rating awesome = user.rate(movie, 5, "Awesome"); - - User foundUser = userRepository.findByPropertyValue("login", "ich"); - Rating rating = user.getRatings().iterator().next(); - assertEquals(awesome, rating); - assertEquals("Awesome", rating.getComment()); - assertEquals(5, rating.getStars()); - assertEquals(5, movie.getStars(), 0); - } - - @Test - public void shouldBeAbleToFindCoActorsThroughCypher() throws Exception { - Movie citizenKane = new Movie("1", "Citizen Kane").persist(); - Person orson = new Person("1", "Orson Wells").persist(); - Person dorothy = new Person("2", "Dorothy Comingore").persist(); - Person joseph = new Person("3", "Joseph Cotten").persist(); - orson.playedIn(citizenKane, "Charles Foster Kane"); - dorothy.playedIn(citizenKane, "Susan Alexander Kane"); - joseph.playedIn(citizenKane, "Jedediah Leland"); - - Iterable coActors = orson.getCoActors(); - - assertThat(coActors, hasItem(dorothy)); - assertThat(coActors, hasItem(joseph)); - } - - @Test - public void canFindUserByLogin() { - User user = new User("ich", "Micha", "password").persist(); - User foundUser = userRepository.findByPropertyValue("login", "ich"); - assertEquals(user, foundUser); - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/test/java/org/neo4j/cineasts/movieimport/MovieDbApiClientTests.java b/spring-data-neo4j-examples/cineasts-rest/src/test/java/org/neo4j/cineasts/movieimport/MovieDbApiClientTests.java deleted file mode 100644 index 451be3790..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/test/java/org/neo4j/cineasts/movieimport/MovieDbApiClientTests.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -import org.junit.Ignore; -import org.junit.Test; - -import java.util.Map; - -import static org.junit.Assert.assertEquals; - -/** - * @author mh - * @since 13.03.11 - */ -@Ignore -public class MovieDbApiClientTests { - private static final String API_KEY = "926d2a79e82920b62f03b1cb57e532e6"; - - @Test - public void testGetMovie() throws Exception { - Map movie = new MovieDbApiClient(API_KEY).getMovie("2"); - assertEquals(2,movie.get("id")); - } - - @Test - public void testGetPerson() throws Exception { - Map person = new MovieDbApiClient(API_KEY).getPerson("30112"); - assertEquals(30112,person.get("id")); - - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/test/java/org/neo4j/cineasts/movieimport/MovieDbImportServiceTests.java b/spring-data-neo4j-examples/cineasts-rest/src/test/java/org/neo4j/cineasts/movieimport/MovieDbImportServiceTests.java deleted file mode 100644 index 8e7b44daf..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/test/java/org/neo4j/cineasts/movieimport/MovieDbImportServiceTests.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.neo4j.cineasts.domain.Movie; -import org.neo4j.cineasts.domain.Person; -import org.neo4j.cineasts.service.CineastsRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.neo4j.rest.support.RestTestBase; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.transaction.annotation.Transactional; - -import static org.junit.Assert.assertEquals; - -/** - * @author mh - * @since 13.03.11 - */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration({"/movies-test-context.xml"}) -@Transactional -@Ignore("Should not be run nilly-willy - talks with http://api.themoviedb.org") -public class MovieDbImportServiceTests extends RestTestBase { - - @Autowired - MovieDbImportService importService; - - @Autowired - CineastsRepository cineastsRepository; - - @Test - public void testImportMovie() throws Exception { - Movie movie = importService.importMovie("2"); - assertEquals("movie-id","2", movie.getId()); - assertEquals("movie-title","Ariel", movie.getTitle()); - } - - @Test - public void testImportMovieTwice() throws Exception { - Movie movie = importService.importMovie("2"); - Movie movie2 = importService.importMovie("2"); - final Movie foundMovie = cineastsRepository.getMovie("2"); - assertEquals("movie-id", movie, foundMovie); - } - - @Test - public void testImportPerson() throws Exception { - Person actor = importService.importPerson("105955"); - assertEquals("movie-id","105955", actor.getId()); - assertEquals("movie-title","George M. Williamson", actor.getName()); - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/test/java/org/neo4j/cineasts/movieimport/MovieDbLocalStorageTests.java b/spring-data-neo4j-examples/cineasts-rest/src/test/java/org/neo4j/cineasts/movieimport/MovieDbLocalStorageTests.java deleted file mode 100644 index 9d11b84bf..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/test/java/org/neo4j/cineasts/movieimport/MovieDbLocalStorageTests.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.neo4j.cineasts.movieimport; - -import org.junit.Before; -import org.junit.Test; - -import java.io.File; -import java.util.Collections; -import java.util.Map; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - * @author mh - * @since 13.03.11 - */ -public class MovieDbLocalStorageTests { - - - private static final String ID = "111"; - private static final Map DATA = Collections.singletonMap("id", ID); - protected MovieDbLocalStorage storage; - - @Before - public void setUp() throws Exception { - storage = new MovieDbLocalStorage("target/data"); - } - - @Test - public void testHasMovie() throws Exception { - storage.storeMovie(ID,DATA); - assertEquals(true, storage.hasMovie(ID)); - } - - @Test - public void testLoadMovie() throws Exception { - storage.storeMovie(ID,DATA); - assertEquals(DATA,storage.loadMovie(ID)); - } - - @Test - public void testStoreMovie() throws Exception { - storage.storeMovie(ID,DATA); - assertEquals(true, new File("target/data/movie_"+ID+".json").exists()); - } - - @Test - public void testHasPerson() throws Exception { - storage.storePerson(ID,DATA); - assertEquals(true, storage.hasPerson(ID)); - } - - @Test - public void testLoadPerson() throws Exception { - storage.storePerson(ID,DATA); - assertEquals(DATA,storage.loadPerson(ID)); - } - @Test - public void testLoadPersonFromList() throws Exception { - storage.storePerson(ID,asList(DATA)); - assertEquals(DATA,storage.loadPerson(ID)); - } - @Test - public void testLoadPersonFromInvalidList() throws Exception { - storage.storePerson(ID, asList("Nothing found.")); - final Map personData = storage.loadPerson(ID); - assertTrue("person unexpectedly found", personData.containsKey("not_found")); - } - - @Test - public void testStorePerson() throws Exception { - storage.storePerson(ID,DATA); - assertEquals(true, new File("target/data/person_"+ID+".json").exists()); - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/test/java/org/neo4j/cineasts/service/MoviesRepositoryTests.java b/spring-data-neo4j-examples/cineasts-rest/src/test/java/org/neo4j/cineasts/service/MoviesRepositoryTests.java deleted file mode 100644 index 74d1d7b9d..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/test/java/org/neo4j/cineasts/service/MoviesRepositoryTests.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.neo4j.cineasts.service; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.neo4j.cineasts.domain.Movie; -import org.neo4j.helpers.collection.IteratorUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Page; -import org.springframework.data.neo4j.rest.support.RestTestBase; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Collection; -import java.util.HashSet; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; -import static org.junit.matchers.JUnitMatchers.hasItem; -import static org.neo4j.helpers.collection.IteratorUtil.asCollection; - -/** - * @author mh - * @since 04.03.11 - */ -@RunWith( SpringJUnit4ClassRunner.class ) -@ContextConfiguration( { "/movies-test-context.xml" } ) -@Transactional -public class MoviesRepositoryTests extends RestTestBase { - @Autowired - CineastsRepository repository; - - @Test - public void testGetMovie() throws Exception { - Movie movie = new Movie( "1", "Test-Movie" ).persist(); - Movie found = repository.getMovie( "1" ); - assertEquals( "movie found by id", movie, found ); - - } - - @Test - public void testFindTwoMovies() throws Exception { - Movie movie1 = new Movie( "1", "Test-Movie1" ).persist(); - Movie movie2 = new Movie( "2", "Test-Movie2" ).persist(); - Movie movie3 = new Movie( "3", "Another-Movie3" ).persist(); - Page found = repository.findMovies( "Test*", 2 ); - - Collection movies = asCollection( found ); - - assertEquals( "2 movies found", 2, movies.size() ); - assertThat( found, hasItem( movie1 ) ); - assertThat( found, hasItem(movie2) ); - } - - @Test - public void testFindTwoMoviesButRestrictToOne() throws Exception { - Movie movie1 = new Movie( "1", "Test-Movie1" ).persist(); - Movie movie2 = new Movie( "2", "Test-Movie2" ).persist(); - Movie movie3 = new Movie( "3", "Another-Movie3" ).persist(); - Page found = repository.findMovies( "Test*", 1 ); - - Collection movies = asCollection( found ); - - assertEquals( "1 movie found", 1, movies.size() ); - assertTrue( "1 correct movie found by query", movies.iterator().next().getTitle().startsWith( "Test" ) ); - } -} diff --git a/spring-data-neo4j-examples/cineasts-rest/src/test/resources/movies-test-context.xml b/spring-data-neo4j-examples/cineasts-rest/src/test/resources/movies-test-context.xml deleted file mode 100644 index a65e8fc59..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/test/resources/movies-test-context.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/spring-data-neo4j-examples/cineasts-rest/src/test/resources/test-db.properties b/spring-data-neo4j-examples/cineasts-rest/src/test/resources/test-db.properties deleted file mode 100644 index 64291a371..000000000 --- a/spring-data-neo4j-examples/cineasts-rest/src/test/resources/test-db.properties +++ /dev/null @@ -1 +0,0 @@ -org.neo4j.server.database.location=target/test-db diff --git a/spring-data-neo4j-examples/cineasts/Readme.md b/spring-data-neo4j-examples/cineasts/Readme.md index 57c196e9c..f3dcede20 100644 --- a/spring-data-neo4j-examples/cineasts/Readme.md +++ b/spring-data-neo4j-examples/cineasts/Readme.md @@ -13,4 +13,10 @@ for new friends and movies. The tutorial is presented as a colloquial description of the steps necessary to create the application. It provides the configuration and code examples that are needed to understand what's happening. -The complete tutorial is contained in this projects [github wiki](https://github.com/jexp/cineasts/wiki). \ No newline at end of file +The complete tutorial is contained in this projects [github wiki](https://github.com/jexp/cineasts/wiki). + +This example contains the different variants of configuration via maven and spring profiles. + +* for neo4j-embedded with simple mapping run `mvn install jetty:run` +* for neo4j-embedded with advanced mapping run `mvn -Paspects install jetty:run` +* for neo4j-server with simple mapping run `mvn -Prest install jetty:run` diff --git a/spring-data-neo4j-examples/cineasts/pom.xml b/spring-data-neo4j-examples/cineasts/pom.xml index f1f29226f..e6c06e245 100644 --- a/spring-data-neo4j-examples/cineasts/pom.xml +++ b/spring-data-neo4j-examples/cineasts/pom.xml @@ -4,60 +4,25 @@ org.neo4j.examples cineasts - 2.2.0.BUILD-SNAPSHOT + 3.2.1.RELEASE war Cineasts.net UTF-8 - 3.1.0.RELEASE - 1.6.1 + 4.0.7.RELEASE + 1.7.10 ${project.version} - 1.6.12 - 1.8.1 + 2.1.5 + - - spring-maven-release - Spring Maven Release Repository - http://maven.springframework.org/release - - - spring-maven-snapshot - Spring Maven Snapshot Repository - - true - - http://maven.springframework.org/snapshot - - - spring-maven-milestone - Spring Maven Milestone Repository - http://maven.springframework.org/milestone - neo4j-release-repository Neo4j Maven 2 release repository http://m2.neo4j.org/releases - - true - - - false - - - - neo4j-snapshot-repository - Neo4j Maven 2 snapshot repository - http://m2.neo4j.org/snapshots - - true - - - false - jboss-public-repo @@ -66,32 +31,82 @@ - - - spring-maven-release - Spring Maven Release Repository - http://maven.springframework.org/release - - - spring-maven-milestone - Spring Maven Milestone Repository - http://maven.springframework.org/milestone - - + + + rest + + -Dspring.profiles.active=rest + + + + org.springframework.data + spring-data-neo4j-rest + ${spring-data-neo4j.version} + + + + + + org.codehaus.mojo + properties-maven-plugin + 1.0-alpha-2 + + + + set-system-properties + + + + + spring.profiles.active + rest + + + + + + + + + + + aspects + + 1.8.4 + + + + org.springframework.data + spring-data-neo4j-aspects + ${spring-data-neo4j.version} + + + org.aspectj + aspectjrt + ${aspectj.version} + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + 2.8 + + 1.5 + + org.eclipse.jdt.core.javanature + org.springframework.ide.eclipse.core.springnature + + + + + + + - - org.springframework - spring-core - ${spring.version} - - - commons-logging - commons-logging - - - org.springframework spring-test @@ -105,27 +120,6 @@ - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-aop - ${spring.version} - - - org.springframework - spring-aspects - ${spring.version} - - - org.springframework - spring-tx - ${spring.version} - - org.springframework spring-webmvc @@ -141,12 +135,12 @@ org.springframework.security spring-security-web - ${spring.version} + 3.2.5.RELEASE org.springframework.security spring-security-config - ${spring.version} + 3.2.5.RELEASE @@ -220,12 +214,6 @@ 1.8.3 - - org.aspectj - aspectjrt - ${aspectj.version} - - @@ -235,16 +223,11 @@ test-jar test - - org.neo4j - neo4j-cypher - ${neo4j.version} - junit junit - 4.8.1 + 4.11 test @@ -260,19 +243,6 @@ - - org.apache.maven.plugins - maven-failsafe-plugin - 2.12 - - - - integration-test - verify - - - - org.mortbay.jetty jetty-maven-plugin @@ -281,31 +251,11 @@ 10 foo 9999 + ${jetty-args} - - - start-jetty - pre-integration-test - - run - - - 0 - true - - - - stop-jetty - post-integration-test - - stop - - - - org.apache.maven.plugins maven-compiler-plugin 2.1 @@ -330,18 +280,6 @@ junit:junit - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - 1.5 - - org.eclipse.jdt.core.javanature - org.springframework.ide.eclipse.core.springnature - - - diff --git a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/domain/Actor.java b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/domain/Actor.java index 0ee848a96..c74ecd817 100644 --- a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/domain/Actor.java +++ b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/domain/Actor.java @@ -1,5 +1,6 @@ package org.neo4j.cineasts.domain; +import org.springframework.data.neo4j.annotation.NodeEntity; import org.springframework.data.neo4j.annotation.RelatedToVia; import java.util.Collection; @@ -8,6 +9,7 @@ import java.util.Collection; * @author mh * @since 10.11.11 */ +@NodeEntity public class Actor extends Person { public Actor(String id, String name) { super(id, name); diff --git a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/domain/Director.java b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/domain/Director.java index b82221012..9b5441b1a 100644 --- a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/domain/Director.java +++ b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/domain/Director.java @@ -1,5 +1,6 @@ package org.neo4j.cineasts.domain; +import org.springframework.data.neo4j.annotation.NodeEntity; import org.springframework.data.neo4j.annotation.RelatedTo; import java.util.HashSet; @@ -9,6 +10,7 @@ import java.util.Set; * @author mh * @since 10.11.11 */ +@NodeEntity public class Director extends Person { public Director(String id, String name) { super(id, name); diff --git a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/domain/Movie.java b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/domain/Movie.java index 83973f0fb..427cf92fd 100644 --- a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/domain/Movie.java +++ b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/domain/Movie.java @@ -26,13 +26,13 @@ public class Movie { String description; @RelatedTo(type="DIRECTED", direction = INCOMING) - Set directors; + Set directors; @RelatedTo(type = "ACTS_IN", direction = INCOMING) - Set actors; + Set actors; @RelatedToVia(type = "ACTS_IN", direction = INCOMING) - Iterable roles; + Collection roles; @RelatedToVia(type = "RATED", direction = INCOMING) @Fetch Iterable ratings; @@ -57,12 +57,12 @@ public class Movie { this.title = title; } - public Collection getActors() { + public Collection getActors() { return actors; } public Collection getRoles() { - return IteratorUtil.asCollection(roles); + return roles; } public int getYear() { @@ -234,7 +234,7 @@ public class Movie { return nodeId != null ? nodeId.hashCode() : super.hashCode(); } - public Set getDirectors() { + public Set getDirectors() { return directors; } } diff --git a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/domain/Role.java b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/domain/Role.java index fdbc52690..8969c3904 100644 --- a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/domain/Role.java +++ b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/domain/Role.java @@ -1,9 +1,6 @@ package org.neo4j.cineasts.domain; -import org.springframework.data.neo4j.annotation.EndNode; -import org.springframework.data.neo4j.annotation.GraphId; -import org.springframework.data.neo4j.annotation.RelationshipEntity; -import org.springframework.data.neo4j.annotation.StartNode; +import org.springframework.data.neo4j.annotation.*; /** * @author mh @@ -13,6 +10,7 @@ import org.springframework.data.neo4j.annotation.StartNode; public class Role { @GraphId Long id; @EndNode Movie movie; + @Fetch @StartNode Actor actor; String name; diff --git a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/movieimport/MovieDbApiClient.java b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/movieimport/MovieDbApiClient.java index f07fc9753..2520a4d75 100644 --- a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/movieimport/MovieDbApiClient.java +++ b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/movieimport/MovieDbApiClient.java @@ -9,38 +9,81 @@ import java.util.Map; public class MovieDbApiClient { - private final String baseUrl = "http://api.themoviedb.org/"; + private final String baseUrl = "http://api.themoviedb.org"; private final String apiKey; protected final ObjectMapper mapper; + private final Map config; + private final String profileFormat; + private final String posterFormat; + public MovieDbApiClient(String apiKey) { this.apiKey = apiKey; mapper = new ObjectMapper(); + config = loadJsonData(buildConfigUrl()); + Map images = (Map) config.get("images"); + profileFormat=String.format("%s%s/%%s", images.get("base_url"),((List)images.get("profile_sizes")).get(0)); + posterFormat=String.format("%s%s/%%s", images.get("base_url"),((List)images.get("poster_sizes")).get(3)); + } public Map getMovie(String id) { - return loadJsonData(id, buildMovieUrl(id)); + return loadJsonData(buildMovieUrl(id)); } - private Map loadJsonData(String id, String url) { + private Map loadJsonData(String url) { try { - List value = mapper.readValue(new URL(url), List.class); - if (value.isEmpty() || value.get(0).equals("Nothing found.")) return Collections.singletonMap("not_found",System.currentTimeMillis()); - return (Map) value.get(0); + Object value = mapper.readValue(new URL(url), Object.class); + Map map = null; + if (value instanceof List) { + List list= (List) value; + if (list.isEmpty() || list.get(0).equals("Nothing found.")) + return notFound(); + map = (Map)list.get(0); + } + if (value instanceof Map) { + map = (Map)value; + } + if (map == null ) { + return notFound(); + } + if (map.containsKey("status_code")) { + map.putAll(notFound()); + } + return map; } catch (Exception e) { throw new RuntimeException("Failed to get data from " + url, e); } } + public Map getConfig() { + return config; + } + + public String getProfileFormat() { + return profileFormat; + } + + public String getPosterFormat() { + return posterFormat; + } + + private Map notFound() { + return Collections.singletonMap("not_found", System.currentTimeMillis()); + } + private String buildMovieUrl(String movieId) { - return String.format("%s2.1/Movie.getInfo/en/json/%s/%s", baseUrl, apiKey, movieId); + return String.format("%s/3/movie/%s?api_key=%s&append_to_response=credits,trailers", baseUrl, movieId, apiKey); + } + private String buildConfigUrl() { + return String.format("%s/3/configuration?api_key=%s", baseUrl, apiKey); } public Map getPerson(String id) { - return loadJsonData(id, buildPersonUrl(id)); + return loadJsonData(buildPersonUrl(id)); } private String buildPersonUrl(String personId) { - return String.format("%s2.1/Person.getInfo/en/json/%s/%s", baseUrl, apiKey, personId); + return String.format("%s/3/person/%s?api_key=%s", baseUrl, personId, apiKey); } } diff --git a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/movieimport/MovieDbImportService.java b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/movieimport/MovieDbImportService.java index 8b64553f6..e0d3d51a8 100644 --- a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/movieimport/MovieDbImportService.java +++ b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/movieimport/MovieDbImportService.java @@ -4,6 +4,7 @@ import org.neo4j.cineasts.domain.*; import org.neo4j.cineasts.repository.DirectorRepository; import org.neo4j.cineasts.repository.MovieRepository; import org.neo4j.cineasts.repository.ActorRepository; +import org.neo4j.helpers.collection.CombiningIterable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -15,6 +16,8 @@ import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; +import static org.neo4j.helpers.collection.IteratorUtil.asIterable; + @Service public class MovieDbImportService { @@ -71,7 +74,7 @@ public class MovieDbImportService { Map data = loadMovieData(movieId); if (data.containsKey("not_found")) throw new RuntimeException("Data for Movie "+movieId+" not found."); - movieDbJsonMapper.mapToMovie(data, movie); + movieDbJsonMapper.mapToMovie(data, movie, client.getPosterFormat()); movieRepository.save(movie); relatePersonsToMovie(movie, data); return movie; @@ -88,8 +91,9 @@ public class MovieDbImportService { } private void relatePersonsToMovie(Movie movie, Map data) { - @SuppressWarnings("unchecked") Collection cast = (Collection) data.get("cast"); - for (Map entry : cast) { + @SuppressWarnings("unchecked") Iterable cast = (Collection) ((Map)data.get("credits")).get("cast"); + @SuppressWarnings("unchecked") Iterable crew = (Collection) ((Map)data.get("credits")).get("crew"); + for (Map entry : new CombiningIterable<>(asIterable(cast, crew))) { String id = "" + entry.get("id"); String jobName = (String) entry.get("job"); Roles job = movieDbJsonMapper.mapToRole(jobName); @@ -119,11 +123,11 @@ public class MovieDbImportService { private T doImportPerson(String personId, T newPerson) { logger.debug("Importing person " + personId); - Person person = template.lookup(Person.class,"id",personId).to(Person.class).singleOrNull(); + Person person = template.findByIndexedValue(Person.class, "id", personId).to(Person.class).singleOrNull(); if (person!=null) return (T)person; Map data = loadPersonData(personId); if (data.containsKey("not_found")) throw new RuntimeException("Data for Person "+personId+" not found."); - movieDbJsonMapper.mapToPerson(data, newPerson); + movieDbJsonMapper.mapToPerson(data, newPerson, client.getProfileFormat()); return template.save(newPerson); } diff --git a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/movieimport/MovieDbJsonMapper.java b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/movieimport/MovieDbJsonMapper.java index 6d83d6b90..25bf0a533 100644 --- a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/movieimport/MovieDbJsonMapper.java +++ b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/movieimport/MovieDbJsonMapper.java @@ -14,22 +14,23 @@ import java.util.Map; @Component public class MovieDbJsonMapper { - public void mapToMovie(Map data, Movie movie) { + public void mapToMovie(Map data, Movie movie, String posterFormat) { try { - movie.setTitle((String) data.get("name")); - movie.setLanguage((String) data.get("language")); + movie.setTitle((String) data.get("title")); + movie.setLanguage((String) data.get("original_language")); movie.setImdbId((String) data.get("imdb_id")); movie.setTagline((String) data.get("tagline")); movie.setDescription(limit((String) data.get("overview"), 500)); - movie.setReleaseDate(toDate(data, "released", "yyyy-MM-dd")); + movie.setReleaseDate(toDate(data, "release_date", "yyyy-MM-dd")); movie.setRuntime((Integer) data.get("runtime")); movie.setHomepage((String) data.get("homepage")); - movie.setTrailer((String) data.get("trailer")); + Map trailer = extractFirstMap(data, "trailers", "youtube"); + if (trailer!=null) movie.setTrailer("http:/youtu.be/" + trailer.get("source")); movie.setGenre(extractFirst(data, "genres", "name")); - movie.setStudio(extractFirst(data,"studios", "name")); - movie.setVersion((Integer)data.get("version")); - movie.setLastModified(toDate(data,"last_modified_at","yyyy-MM-dd HH:mm:ss")); - movie.setImageUrl(selectImageUrl((List) data.get("posters"), "poster", "mid")); + movie.setStudio(extractFirst(data,"production_companies", "name")); + movie.setImageUrl(String.format(posterFormat, data.get("poster_path"))); +// movie.setVersion((Integer)data.get("version")); +// movie.setLastModified(toDate(data,"last_modified_at","yyyy-MM-dd HH:mm:ss")); } catch (Exception e) { throw new MovieDbException("Failed to map json for movie", e); } @@ -50,6 +51,13 @@ public class MovieDbJsonMapper { if (inner == null || inner.isEmpty()) return null; return (String) inner.get(0).get(property); } + private Map extractFirstMap(Map data, String field, String property) { + Map inner = (Map) data.get(field); + if (inner == null || inner.isEmpty()) return null; + List list = (List) inner.get(property); + if (list == null || list.isEmpty()) return null; + return (Map) list.get(0); + } private Date toDate(Map data, String field, final String pattern) throws ParseException { try { @@ -61,569 +69,47 @@ public class MovieDbJsonMapper { } } - /* - [{"popularity":3, -"translated":true, -"adult":false, -"language":"en", -"original_name":"[Rec]", -"name":"[Rec]", -"alternative_name":"[REC]", -"movie_type":"movie", -"id":8329, -"imdb_id":"tt1038988", -"url":"http://www.themoviedb.org/movie/8329", -"votes":11, -"rating":7.2, -"status":"Released", -"tagline":"One Witness. One Camera", -"certification":"R", -"overview":"\"REC\" turns on a young TV reporter and her cameraman who cover the night shift at the local fire station. Receiving a call from an old lady trapped in her house, -they reach her building to hear horrifying screams -- which begin a long nightmare and a uniquely dramatic TV report.", -"keywords":["terror", -"lebende leichen", -"obsession", -"camcorder", -"firemen", -"reality tv ", -"bite", -"cinematographer", -"attempt to escape", -"virus", -"lodger", -"live-reportage", -"schwerverletzt"], -"released":"2007-08-29", -"runtime":78, -"budget":0, -"revenue":0, -"homepage":"http://www.3l-filmverleih.de/rec", -"trailer":"http://www.youtube.com/watch?v=YQUkX_XowqI", -"genres":[{"type":"genre", -"url":"http://themoviedb.org/genre/horror", -"name":"Horror", -"id":27}], -"studios":[{"url":"http://www.themoviedb.org/company/2270", -"name":"Filmax Group", -"id":2270}], -"languages_spoken":[{"code":"es", -"name":"Spanish", -"native_name":"Espa\u00f1ol"}], -"countries":[{"code":"ES", -"name":"Spain", -"url":"http://www.themoviedb.org/country/es"}], -"posters":[{"image":{"type":"poster", -"size":"original", -"height":1000, -"width":706, -"url":"http://cf1.imgobject.com/posters/3a0/4cc8df415e73d650240003a0/rec-original.jpg", -"id":"4cc8df415e73d650240003a0"}}, -{"image":{"type":"poster", -"size":"mid", -"height":708, -"width":500, -"url":"http://cf1.imgobject.com/posters/3a0/4cc8df415e73d650240003a0/rec-mid.jpg", -"id":"4cc8df415e73d650240003a0"}}, -{"image":{"type":"poster", -"size":"cover", -"height":262, -"width":185, -"url":"http://cf1.imgobject.com/posters/3a0/4cc8df415e73d650240003a0/rec-cover.jpg", -"id":"4cc8df415e73d650240003a0"}}, -{"image":{"type":"poster", -"size":"thumb", -"height":130, -"width":92, -"url":"http://cf1.imgobject.com/posters/3a0/4cc8df415e73d650240003a0/rec-thumb.jpg", -"id":"4cc8df415e73d650240003a0"}}, -{"image":{"type":"poster", -"size":"original", -"height":1000, -"width":711, -"url":"http://cf1.imgobject.com/posters/1e7/4bc92117017a3c57fe00d1e7/rec-original.jpg", -"id":"4bc92117017a3c57fe00d1e7"}}, -{"image":{"type":"poster", -"size":"mid", -"height":703, -"width":500, -"url":"http://cf1.imgobject.com/posters/1e7/4bc92117017a3c57fe00d1e7/rec-mid.jpg", -"id":"4bc92117017a3c57fe00d1e7"}}, -{"image":{"type":"poster", -"size":"cover", -"height":260, -"width":185, -"url":"http://cf1.imgobject.com/posters/1e7/4bc92117017a3c57fe00d1e7/rec-cover.jpg", -"id":"4bc92117017a3c57fe00d1e7"}}, -{"image":{"type":"poster", -"size":"thumb", -"height":129, -"width":92, -"url":"http://cf1.imgobject.com/posters/1e7/4bc92117017a3c57fe00d1e7/rec-thumb.jpg", -"id":"4bc92117017a3c57fe00d1e7"}}, -{"image":{"type":"poster", -"size":"original", -"height":1500, -"width":1000, -"url":"http://cf1.imgobject.com/posters/1ec/4bc92118017a3c57fe00d1ec/rec-original.jpg", -"id":"4bc92118017a3c57fe00d1ec"}}, -{"image":{"type":"poster", -"size":"mid", -"height":750, -"width":500, -"url":"http://cf1.imgobject.com/posters/1ec/4bc92118017a3c57fe00d1ec/rec-mid.jpg", -"id":"4bc92118017a3c57fe00d1ec"}}, -{"image":{"type":"poster", -"size":"cover", -"height":278, -"width":185, -"url":"http://cf1.imgobject.com/posters/1ec/4bc92118017a3c57fe00d1ec/rec-cover.jpg", -"id":"4bc92118017a3c57fe00d1ec"}}, -{"image":{"type":"poster", -"size":"thumb", -"height":138, -"width":92, -"url":"http://cf1.imgobject.com/posters/1ec/4bc92118017a3c57fe00d1ec/rec-thumb.jpg", -"id":"4bc92118017a3c57fe00d1ec"}}, -{"image":{"type":"poster", -"size":"original", -"height":1429, -"width":1000, -"url":"http://cf1.imgobject.com/posters/1f1/4bc92118017a3c57fe00d1f1/rec-original.jpg", -"id":"4bc92118017a3c57fe00d1f1"}}, -{"image":{"type":"poster", -"size":"mid", -"height":715, -"width":500, -"url":"http://cf1.imgobject.com/posters/1f1/4bc92118017a3c57fe00d1f1/rec-mid.jpg", -"id":"4bc92118017a3c57fe00d1f1"}}, -{"image":{"type":"poster", -"size":"cover", -"height":265, -"width":185, -"url":"http://cf1.imgobject.com/posters/1f1/4bc92118017a3c57fe00d1f1/rec-cover.jpg", -"id":"4bc92118017a3c57fe00d1f1"}}, -{"image":{"type":"poster", -"size":"thumb", -"height":132, -"width":92, -"url":"http://cf1.imgobject.com/posters/1f1/4bc92118017a3c57fe00d1f1/rec-thumb.jpg", -"id":"4bc92118017a3c57fe00d1f1"}}, -{"image":{"type":"poster", -"size":"original", -"height":1125, -"width":800, -"url":"http://cf1.imgobject.com/posters/1f6/4bc92118017a3c57fe00d1f6/rec-original.jpg", -"id":"4bc92118017a3c57fe00d1f6"}}, -{"image":{"type":"poster", -"size":"mid", -"height":703, -"width":500, -"url":"http://cf1.imgobject.com/posters/1f6/4bc92118017a3c57fe00d1f6/rec-mid.jpg", -"id":"4bc92118017a3c57fe00d1f6"}}, -{"image":{"type":"poster", -"size":"cover", -"height":260, -"width":185, -"url":"http://cf1.imgobject.com/posters/1f6/4bc92118017a3c57fe00d1f6/rec-cover.jpg", -"id":"4bc92118017a3c57fe00d1f6"}}, -{"image":{"type":"poster", -"size":"thumb", -"height":129, -"width":92, -"url":"http://cf1.imgobject.com/posters/1f6/4bc92118017a3c57fe00d1f6/rec-thumb.jpg", -"id":"4bc92118017a3c57fe00d1f6"}}], -"backdrops":[{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/1df/4bc92117017a3c57fe00d1df/rec-original.jpg", -"id":"4bc92117017a3c57fe00d1df"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/1df/4bc92117017a3c57fe00d1df/rec-poster.jpg", -"id":"4bc92117017a3c57fe00d1df"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/1df/4bc92117017a3c57fe00d1df/rec-thumb.jpg", -"id":"4bc92117017a3c57fe00d1df"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/1d7/4bc92113017a3c57fe00d1d7/rec-original.jpg", -"id":"4bc92113017a3c57fe00d1d7"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/1d7/4bc92113017a3c57fe00d1d7/rec-poster.jpg", -"id":"4bc92113017a3c57fe00d1d7"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/1d7/4bc92113017a3c57fe00d1d7/rec-thumb.jpg", -"id":"4bc92113017a3c57fe00d1d7"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/1e3/4bc92117017a3c57fe00d1e3/rec-original.jpg", -"id":"4bc92117017a3c57fe00d1e3"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/1e3/4bc92117017a3c57fe00d1e3/rec-poster.jpg", -"id":"4bc92117017a3c57fe00d1e3"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/1e3/4bc92117017a3c57fe00d1e3/rec-thumb.jpg", -"id":"4bc92117017a3c57fe00d1e3"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/1d3/4bc92113017a3c57fe00d1d3/rec-original.jpg", -"id":"4bc92113017a3c57fe00d1d3"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/1d3/4bc92113017a3c57fe00d1d3/rec-poster.jpg", -"id":"4bc92113017a3c57fe00d1d3"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/1d3/4bc92113017a3c57fe00d1d3/rec-thumb.jpg", -"id":"4bc92113017a3c57fe00d1d3"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/1db/4bc92114017a3c57fe00d1db/rec-original.jpg", -"id":"4bc92114017a3c57fe00d1db"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/1db/4bc92114017a3c57fe00d1db/rec-poster.jpg", -"id":"4bc92114017a3c57fe00d1db"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/1db/4bc92114017a3c57fe00d1db/rec-thumb.jpg", -"id":"4bc92114017a3c57fe00d1db"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/6f4/4d0e39c25e73d637100016f4/rec-original.jpg", -"id":"4d0e39c25e73d637100016f4"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/6f4/4d0e39c25e73d637100016f4/rec-poster.jpg", -"id":"4d0e39c25e73d637100016f4"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/6f4/4d0e39c25e73d637100016f4/rec-thumb.jpg", -"id":"4d0e39c25e73d637100016f4"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/567/4d0e39dd5e73d6370a001567/rec-original.jpg", -"id":"4d0e39dd5e73d6370a001567"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/567/4d0e39dd5e73d6370a001567/rec-poster.jpg", -"id":"4d0e39dd5e73d6370a001567"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/567/4d0e39dd5e73d6370a001567/rec-thumb.jpg", -"id":"4d0e39dd5e73d6370a001567"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/58a/4d0e39fb5e73d6371c00158a/rec-original.jpg", -"id":"4d0e39fb5e73d6371c00158a"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/58a/4d0e39fb5e73d6371c00158a/rec-poster.jpg", -"id":"4d0e39fb5e73d6371c00158a"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/58a/4d0e39fb5e73d6371c00158a/rec-thumb.jpg", -"id":"4d0e39fb5e73d6371c00158a"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/5f4/4d0e3a185e73d6370e0015f4/rec-original.jpg", -"id":"4d0e3a185e73d6370e0015f4"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/5f4/4d0e3a185e73d6370e0015f4/rec-poster.jpg", -"id":"4d0e3a185e73d6370e0015f4"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/5f4/4d0e3a185e73d6370e0015f4/rec-thumb.jpg", -"id":"4d0e3a185e73d6370e0015f4"}}, -{"image":{"type":"backdrop", -"size":"original", -"height":1080, -"width":1920, -"url":"http://cf1.imgobject.com/backdrops/67f/4d0e3a395e73d6371600167f/rec-original.jpg", -"id":"4d0e3a395e73d6371600167f"}}, -{"image":{"type":"backdrop", -"size":"poster", -"height":439, -"width":780, -"url":"http://cf1.imgobject.com/backdrops/67f/4d0e3a395e73d6371600167f/rec-poster.jpg", -"id":"4d0e3a395e73d6371600167f"}}, -{"image":{"type":"backdrop", -"size":"thumb", -"height":169, -"width":300, -"url":"http://cf1.imgobject.com/backdrops/67f/4d0e3a395e73d6371600167f/rec-thumb.jpg", -"id":"4d0e3a395e73d6371600167f"}}], -"cast":[{"name":"Manuela Velasco", -"job":"Actor", -"department":"Actors", -"character":"Angela Vidal", -"id":34793, -"order":0, -"cast_id":1, -"url":"http://www.themoviedb.org/person/34793", -"profile":"http://cf1.imgobject.com/profiles/390/4c0157fa017a3c702d001390/manuela-velasco-thumb.jpg"}, -{"name":"Carlos Lasarte", -"job":"Actor", -"department":"Actors", -"character":"C\u00e9sar", -"id":54519, -"order":2, -"cast_id":3, -"url":"http://www.themoviedb.org/person/54519", -"profile":"http://cf1.imgobject.com/profiles/ba6/4d27aa297b9aa134d3001ba6/carlos-lasarte-thumb.jpg"}, -{"name":"Pablo Rosso", -"job":"Actor", -"department":"Actors", -"character":"Marcos", -"id":54520, -"order":3, -"cast_id":4, -"url":"http://www.themoviedb.org/person/54520", -"profile":""}, -{"name":"David Vert", -"job":"Actor", -"department":"Actors", -"character":"Alex", -"id":54521, -"order":4, -"cast_id":5, -"url":"http://www.themoviedb.org/person/54521", -"profile":"http://cf1.imgobject.com/profiles/c7e/4d27aad57b9aa134cb001c7e/david-vert-thumb.jpg"}, -{"name":"Vicente Gil", -"job":"Actor", -"department":"Actors", -"character":"Polizist", -"id":54522, -"order":5, -"cast_id":6, -"url":"http://www.themoviedb.org/person/54522", -"profile":"http://cf1.imgobject.com/profiles/c86/4d27ab237b9aa134cb001c86/vicente-gil-thumb.jpg"}, -{"name":"Martha Carbonell", -"job":"Actor", -"department":"Actors", -"character":"Frau Izquierdo", -"id":54523, -"order":6, -"cast_id":7, -"url":"http://www.themoviedb.org/person/54523", -"profile":"http://cf1.imgobject.com/profiles/c90/4d27ab777b9aa134cb001c90/martha-carbonell-thumb.jpg"}, -{"name":"Carlos Vicente", -"job":"Actor", -"department":"Actors", -"character":"Guillem", -"id":54524, -"order":7, -"cast_id":8, -"url":"http://www.themoviedb.org/person/54524", -"profile":"http://cf1.imgobject.com/profiles/b0f/4d27abcc7b9aa134cf001b0f/carlos-vicente-thumb.jpg"}, -{"name":"Ferran Terraza", -"job":"Actor", -"department":"Actors", -"character":"Manu", -"id":54532, -"order":8, -"cast_id":22, -"url":"http://www.themoviedb.org/person/54532", -"profile":"http://cf1.imgobject.com/profiles/129/4c4bfbab7b9aa1237f000129/ferran-terraza-thumb.jpg"}, -{"name":"Jorge Yamam", -"job":"Actor", -"department":"Actors", -"character":"Sergio", -"id":147878, -"order":9, -"cast_id":23, -"url":"http://www.themoviedb.org/person/147878", -"profile":"http://cf1.imgobject.com/profiles/cbb/4d27ac677b9aa134dc001cbb/jorge-yamam-thumb.jpg"}, -{"name":"Jaume Balaguer\u00f3", -"job":"Director", -"department":"Directing", -"character":"", -"id":54525, -"order":0, -"cast_id":9, -"url":"http://www.themoviedb.org/person/54525", -"profile":""}, -{"name":"Paco Plaza", -"job":"Director", -"department":"Directing", -"character":"", -"id":54526, -"order":0, -"cast_id":10, -"url":"http://www.themoviedb.org/person/54526", -"profile":""}, -{"name":"Jaume Balaguer\u00f3", -"job":"Screenplay", -"department":"Writing", -"character":"", -"id":54525, -"order":0, -"cast_id":11, -"url":"http://www.themoviedb.org/person/54525", -"profile":""}, -{"name":"Paco Plaza", -"job":"Screenplay", -"department":"Writing", -"character":"", -"id":54526, -"order":0, -"cast_id":12, -"url":"http://www.themoviedb.org/person/54526", -"profile":""}, -{"name":"Luis Berdejo", -"job":"Screenplay", -"department":"Writing", -"character":"", -"id":54527, -"order":0, -"cast_id":13, -"url":"http://www.themoviedb.org/person/54527", -"profile":""}, -{"name":"Julio Fern\u00e1ndez", -"job":"Producer", -"department":"Production", -"character":"", -"id":17083, -"order":0, -"cast_id":14, -"url":"http://www.themoviedb.org/person/17083", -"profile":""}, -{"name":"Carlos Fern\u00e1ndez", -"job":"Executive Producer", -"department":"Production", -"character":"", -"id":37950, -"order":0, -"cast_id":15, -"url":"http://www.themoviedb.org/person/37950", -"profile":""}, -{"name":"Alberto Marini", -"job":"Producer", -"department":"Production", -"character":"", -"id":54528, -"order":0, -"cast_id":16, -"url":"http://www.themoviedb.org/person/54528", -"profile":""}, -{"name":"Pablo Rosso", -"job":"Director of Photography", -"department":"Camera", -"character":"", -"id":54520, -"order":0, -"cast_id":17, -"url":"http://www.themoviedb.org/person/54520", -"profile":""}, -{"name":"Gemma Fauria", -"job":"Set Designer", -"department":"Art", -"character":"", -"id":54529, -"order":0, -"cast_id":18, -"url":"http://www.themoviedb.org/person/54529", -"profile":""}, -{"name":"David Gallart", -"job":"Editor", -"department":"Editing", -"character":"", -"id":28500, -"order":0, -"cast_id":19, -"url":"http://www.themoviedb.org/person/28500", -"profile":""}, -{"name":"Xavier Mas", -"job":"Sound Designer", -"department":"Sound", -"character":"", -"id":54530, -"order":0, -"cast_id":20, -"url":"http://www.themoviedb.org/person/54530", -"profile":""}, -{"name":"Gl\u00f2ria Viguer", -"job":"Costume Design", -"department":"Costume \u0026 Make-Up", -"character":"", -"id":54531, -"order":0, -"cast_id":21, -"url":"http://www.themoviedb.org/person/54531", -"profile":""}], -"version":150, -"last_modified_at":"2011-02-20 23:16:57"}] +/* + { + adult: false, + also_known_as: [ ], + biography: "From Wikipedia, the free encyclopedia. Robert "Bob" Peterson (born January 1961) is an American animator, screenwriter, director and voice actor, who has worked for Pixar since 1994. His first job was working as a layout artist and animator on Toy Story. He was nominated for an Oscar for his screenplay for Finding Nemo. Peterson is a co-director and the writer of Up, which gained him his second Oscar nomination. He also performed the voices of Roz in Monsters, Inc., Mr. Ray in Finding Nemo, Dug the dog and Alpha the dog in Up[1] and in Dug's Special Mission, and the Janitor in Toy Story 3. Peterson was born in Wooster, Ohio, his family moved to Dover, Ohio, where he graduated from Dover High School. He received his undergraduate degree from Ohio Northern University, and a Master's degree in mechanical engineering from Purdue University in 1986. While attending Purdue, he wrote and illustrated the comic strip Loco Motives for the Purdue Exponent. Prior to coming to Pixar, Peterson worked at Wavefront Technologies and Rezn8 Productions. In 2008, Peterson played the part of Terry Cane, a puppeteer in Dan Scanlon's first feature film Tracy. He also played additional voices in Tokyo Mater in 2008, and the voice of Mr. Ray for the Finding Nemo Submarine Voyage ride at Disneyland Park in 2007. His most recent job at Pixar was voicing the Janitor at Sunnyside Daycare Center in Pixar's 11th film, Toy Story 3, which was released on June 18, 2010. Description above from the Wikipedia article Bob Peterson (animator), licensed under CC-BY-SA, full list of contributors on Wikipedia.", + birthday: "1961-01-18", + deathday: "", + homepage: "", + id: 10, + imdb_id: "nm0677037", + name: "Bob Peterson", + place_of_birth: "Wooster, Ohio, USA", + popularity: "0.00222079131937198", + profile_path: "/13YNM8lBKnK26MYd2Lp3OpU6JdI.jpg", + images: { + profiles: [ + { + aspect_ratio: "0.666666666666667", + file_path: "/13YNM8lBKnK26MYd2Lp3OpU6JdI.jpg", + height: 720, + id: "5311fd64c3a3682a220029f9", + iso_639_1: null, + vote_average: 0, + vote_count: 0, + width: 480 + } + ] + } + } */ - public void mapToPerson(Map data, Person person) { + public void mapToPerson(Map data, Person person, String profileFormat) { try { person.setName((String) data.get("name")); person.setBirthday(toDate(data, "birthday", "yyyy-MM-dd")); - person.setBirthplace((String) data.get("birthplace")); + person.setBirthplace((String) data.get("place_of_birth")); String biography = (String) data.get("biography"); person.setBiography(limit(biography,500)); - person.setVersion((Integer) data.get("version")); - person.setProfileImageUrl(selectImageUrl((List) data.get("profile"), "profile", "profile")); - person.setLastModified(toDate(data,"last_modified_at","yyyy-MM-dd HH:mm:ss")); + person.setProfileImageUrl(String.format(profileFormat,(data.get("profile_path")))); +// person.setVersion((Integer) data.get("version")); +// person.setLastModified(toDate(data,"last_modified_at","yyyy-MM-dd HH:mm:ss")); } catch (Exception e) { throw new MovieDbException("Failed to map json for person", e); } @@ -634,70 +120,8 @@ they reach her building to hear horrifying screams -- which begin a long nightma return text.substring(0,limit); } -/* - [{"popularity":3, -"name":"Glenn Strange", -"known_as":[{"name":"George Glenn Strange"}, -{"name":"Glen Strange"}, -{"name":"Glen 'Peewee' Strange"}, -{"name":"Peewee Strange"}, -{"name":"'Peewee' Strange"}], -"id":30112, -"biography":"", -"known_movies":4, -"birthday":"1899-08-16", -"birthplace":"Weed, - New Mexico, - USA", -"url":"http://www.themoviedb.org/person/30112", -"filmography":[{"name":"Bud Abbott Lou Costello Meet Frankenstein", -"id":3073, -"job":"Actor", -"department":"Actors", -"character":"The Frankenstein Monster", -"cast_id":23, -"url":"http://www.themoviedb.org/movie/3073", -"poster":"http://cf1.imgobject.com/posters/4ca/4bc9185d017a3c57fe0094ca/bud-abbott-lou-costello-meet-frankenstein-cover.jpg", -"adult":false, -"release":"1948-06-15"}, -{"name":"Arizona Days (1937)", -"id":22367, -"job":"Actor", -"department":"Actors", -"character":"Henchman Pete ", -"cast_id":12, -"url":"http://www.themoviedb.org/movie/22367", -"poster":"", -"adult":false, -"release":"1937-01-30"}, -{"name":"House of Dracula", -"id":30793, -"job":"Actor", -"department":"Actors", -"character":"The Frankenstein Monster", -"cast_id":3, -"url":"http://www.themoviedb.org/movie/30793", -"poster":"http://cf1.imgobject.com/posters/7cf/4bc97660017a3c57fe0367cf/house-of-dracula-cover.jpg", -"adult":false, -"release":"1945-01-01"}, -{"name":"The Fargo Kid", -"id":38704, -"job":"Actor", -"department":"Actors", -"character":"Sheriff Dave", -"cast_id":24, -"url":"http://www.themoviedb.org/movie/38704", -"poster":"http://cf1.imgobject.com/posters/04e/4d74018a5e73d6021d00004e/the-fargo-kid-cover.jpg", -"adult":false, -"release":"1940-12-06"}], -"profile":[], -"version":19, -"last_modified_at":"2011-03-07 13:02:35"}] -*/ - - public Roles mapToRole(String roleString) { - if (roleString.equals("Actor")) { + if (roleString==null || roleString.equals("Actor")) { return Roles.ACTS_IN; } if (roleString.equals("Director")) { @@ -705,4 +129,71 @@ they reach her building to hear horrifying screams -- which begin a long nightma } return null; } + +/* + { +adult: false, +backdrop_path: "/8qk8f84gfkfoD3tfBVdG8b4ZOvU.jpg", +belongs_to_collection: { +id: 8384, +name: "Proletariat Collection", +poster_path: null, +backdrop_path: "/ibLeWo3X3dVo4rxvn4m3y90ms1I.jpg" +}, +budget: 0, +genres: [ +{ +id: 18, +name: "Drama" +}, +{ +id: 10769, +name: "Foreign" +} +], +homepage: "", +id: 2, +imdb_id: "tt0094675", +original_language: "en", +original_title: "Ariel", +overview: "Taisto Kasurinen is a Finnish coal miner whose father has just committed suicide and who is framed for a crime he did not commit. In jail, he starts to dream about leaving the country and starting a new life. He escapes from prison but things don't go as planned...", +popularity: "0.113674818134343", +poster_path: "/w0NzAc4Lv6euPtPAmsdEf0ZCF8C.jpg", +production_companies: [ +{ +name: "Villealfa Filmproduction Oy", +id: 2303 +}, +{ +name: "Finnish Film Foundation", +id: 2396 +} +], +production_countries: [ +{ +iso_3166_1: "FI", +name: "Finland" +} +], +release_date: "1988-10-21", +revenue: 0, +runtime: 69, +spoken_languages: [ +{ +iso_639_1: "de", +name: "Deutsch" +}, +{ +iso_639_1: "fi", +name: "suomi" +} +], +status: "Released", +tagline: "", +title: "Ariel", +video: false, +vote_average: 6.5, +vote_count: 5 +} + */ } diff --git a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/repository/UserRepositoryImpl.java b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/repository/UserRepositoryImpl.java index 647eaedff..b27781933 100644 --- a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/repository/UserRepositoryImpl.java +++ b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/repository/UserRepositoryImpl.java @@ -31,7 +31,7 @@ public class UserRepositoryImpl implements CineastsUserDetailsService { } private User findByLogin(String login) { - return template.lookup(User.class,"login",login).to(User.class).singleOrNull(); + return template.findByIndexedValue(User.class,"login",login).to(User.class).singleOrNull(); } @Override diff --git a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/service/Neo4jDatabaseCleaner.java b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/service/Neo4jDatabaseCleaner.java index a09bbffe1..31e1e888e 100644 --- a/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/service/Neo4jDatabaseCleaner.java +++ b/spring-data-neo4j-examples/cineasts/src/main/java/org/neo4j/cineasts/service/Neo4jDatabaseCleaner.java @@ -34,17 +34,14 @@ public class Neo4jDatabaseCleaner { } private void removeNodes(Map result) { - Node refNode = graph.getReferenceNode(); int nodes = 0, relationships = 0; for (Node node : graph.getAllNodes()) { for (Relationship rel : node.getRelationships(Direction.OUTGOING)) { rel.delete(); relationships++; } - if (!refNode.equals(node)) { - node.delete(); - nodes++; - } + node.delete(); + nodes++; } result.put("nodes", nodes); result.put("relationships", relationships); diff --git a/spring-data-neo4j-examples/cineasts/src/main/webapp/WEB-INF/applicationContext.xml b/spring-data-neo4j-examples/cineasts/src/main/webapp/WEB-INF/applicationContext.xml index e1433c14d..90baeb7b0 100644 --- a/spring-data-neo4j-examples/cineasts/src/main/webapp/WEB-INF/applicationContext.xml +++ b/spring-data-neo4j-examples/cineasts/src/main/webapp/WEB-INF/applicationContext.xml @@ -15,14 +15,8 @@ - - - @@ -32,4 +26,13 @@ - \ No newline at end of file + + + + + + + + + + diff --git a/spring-data-neo4j-examples/cineasts/src/test/java/org/neo4j/cineasts/domain/DomainTests.java b/spring-data-neo4j-examples/cineasts/src/test/java/org/neo4j/cineasts/domain/DomainTests.java index c93eb75bc..e4f212c37 100644 --- a/spring-data-neo4j-examples/cineasts/src/test/java/org/neo4j/cineasts/domain/DomainTests.java +++ b/spring-data-neo4j-examples/cineasts/src/test/java/org/neo4j/cineasts/domain/DomainTests.java @@ -70,7 +70,7 @@ public class DomainTests { User user = template.save(new User("ich", "Micha", "password")); Rating awesome = user.rate(template,movie, 5, "Awesome"); - user = userRepository.findByPropertyValue("login", "ich"); + user = userRepository.findByLogin("ich"); movie = movieRepository.findById("1"); Rating rating = user.getRatings().iterator().next(); assertEquals(awesome,rating); @@ -81,7 +81,7 @@ public class DomainTests { @Test public void canFindUserByLogin() { User user = template.save(new User("ich", "Micha", "password")); - User foundUser = userRepository.findByPropertyValue("login", "ich"); + User foundUser = userRepository.findByLogin("ich"); assertEquals(user, foundUser); } @Test diff --git a/spring-data-neo4j-examples/cineasts/src/test/java/org/neo4j/cineasts/movieimport/MovieDbApiClientTests.java b/spring-data-neo4j-examples/cineasts/src/test/java/org/neo4j/cineasts/movieimport/MovieDbApiClientTests.java index 451be3790..0d8351ee1 100644 --- a/spring-data-neo4j-examples/cineasts/src/test/java/org/neo4j/cineasts/movieimport/MovieDbApiClientTests.java +++ b/spring-data-neo4j-examples/cineasts/src/test/java/org/neo4j/cineasts/movieimport/MovieDbApiClientTests.java @@ -20,6 +20,16 @@ public class MovieDbApiClientTests { Map movie = new MovieDbApiClient(API_KEY).getMovie("2"); assertEquals(2,movie.get("id")); } + @Test + public void testGetProfileUrl() throws Exception { + String format = new MovieDbApiClient(API_KEY).getProfileFormat(); + assertEquals("http://image.tmdb.org/t/p/w45/%s",format); + } + @Test + public void testGetPosterUrl() throws Exception { + String format = new MovieDbApiClient(API_KEY).getPosterFormat(); + assertEquals("http://image.tmdb.org/t/p/w342/%s",format); + } @Test public void testGetPerson() throws Exception { diff --git a/spring-data-neo4j-examples/cineasts/src/test/java/org/neo4j/cineasts/service/TransactionTests.java b/spring-data-neo4j-examples/cineasts/src/test/java/org/neo4j/cineasts/service/TransactionTests.java index c8fb67fdc..de3e13bdd 100644 --- a/spring-data-neo4j-examples/cineasts/src/test/java/org/neo4j/cineasts/service/TransactionTests.java +++ b/spring-data-neo4j-examples/cineasts/src/test/java/org/neo4j/cineasts/service/TransactionTests.java @@ -29,11 +29,10 @@ public class TransactionTests { MovieRepository movieRepository; @Test - @Ignore public void testBefriendUsers() { final User me = userRepository.save(new User("me", "me", "me")); final User you = userRepository.save(new User("you", "you", "you")); - userRepository.addFriend("you", userRepository.getUserFromSession()); + userRepository.addFriend("you", me); final User loaded = userRepository.findOne(me.getId()); assertEquals(1,loaded.getFriends().size()); } diff --git a/spring-data-neo4j-examples/cineasts/src/test/resources/movies-test-context.xml b/spring-data-neo4j-examples/cineasts/src/test/resources/movies-test-context.xml index c4657dae8..78c8309c7 100644 --- a/spring-data-neo4j-examples/cineasts/src/test/resources/movies-test-context.xml +++ b/spring-data-neo4j-examples/cineasts/src/test/resources/movies-test-context.xml @@ -12,7 +12,7 @@ - + @@ -24,4 +24,4 @@ - \ No newline at end of file + diff --git a/spring-data-neo4j-examples/hello-worlds/pom.xml b/spring-data-neo4j-examples/hello-worlds/pom.xml index 60cb23c54..99c19f4b4 100644 --- a/spring-data-neo4j-examples/hello-worlds/pom.xml +++ b/spring-data-neo4j-examples/hello-worlds/pom.xml @@ -4,78 +4,28 @@ org.springframework.data.examples spring-data-neo4j-hello-worlds - 3.0.2.BUILD-SNAPSHOT + 3.2.1.RELEASE jar Spring Data Neo4j hello-worlds UTF-8 - 3.2.8.RELEASE - 1.7.5 ${project.version} - 2.0.1 + 4.0.7.RELEASE + 1.7.5 + 2.1.5 4.11 - 1.2.17 - 4.2.0.Final - - spring-maven-release - Spring Maven Release Repository - http://maven.springframework.org/release - - - spring-maven-snapshot - Spring Maven Snapshot Repository - - true - - http://maven.springframework.org/snapshot - - - spring-maven-milestone - Spring Maven Milestone Repository - http://maven.springframework.org/milestone - neo4j-release-repository Neo4j Maven 2 release repository http://m2.neo4j.org/releases - - true - - - false - - - - neo4j-snapshot-repository - Neo4j Maven 2 snapshot repository - http://m2.neo4j.org/snapshots - - true - - - false - - - - spring-maven-release - Spring Maven Release Repository - http://maven.springframework.org/release - - - spring-maven-milestone - Spring Maven Milestone Repository - http://maven.springframework.org/milestone - - - @@ -89,24 +39,24 @@ org.hibernate hibernate-validator - ${hibernate-validator.version} + 5.1.1.Final org.slf4j slf4j-api - ${slf4j.version} + 1.7.7 org.slf4j slf4j-log4j12 - ${slf4j.version} + 1.7.7 log4j log4j - ${log4j.version} + 1.2.17 diff --git a/spring-data-neo4j-examples/imdb/.gitignore b/spring-data-neo4j-examples/imdb/.gitignore deleted file mode 100644 index 79cdd41fd..000000000 --- a/spring-data-neo4j-examples/imdb/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -/target/ -*.ipr -*.iws -*.iml -.project -.classpath -.settings -*.log - diff --git a/spring-data-neo4j-examples/imdb/README.md b/spring-data-neo4j-examples/imdb/README.md deleted file mode 100644 index 7bebf8c3a..000000000 --- a/spring-data-neo4j-examples/imdb/README.md +++ /dev/null @@ -1,63 +0,0 @@ -The IMDB Example Application for Neo4j written with Spring Datastore Graph -========================================================================== - -![Web UI](http://github.com/neo4j-examples/spring-datastore-graph-imdb/raw/master/doc/images/IMDB1.png) - - -This application serves as a boilerplate to illustrate the use of annotations to persist objects in Spring to Neo4j, along the lines of - - - @NodeEntity - public class Actor { - @GraphProperty(index = true) - private String name; - - @RelatedTo(type="ACTS_IN",elementClass = Movie.class) - - private Set movies; - static final String NAME_INDEX = "name"; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Iterable getMovies() { - return movies; - } - - public Role getRole(final Movie inMovie) { - return (Role)getRelationshipTo((Movie)inMovie, Role.class, RelTypes.ACTS_IN.name()); - } - - @Override - public String toString() { - return "Actor '" + this.getName() + "'"; - } - } - -Which produces a graph similar to - -![Graph](http://wiki.neo4j.org/images/5/53/Imdb.screenshot.actor.png) - - - -The documentation of the IMDB Example domain is found at [http://wiki.neo4j.org/content/IMDB_Example] - - -Run build and run the example: - git clone git://github.com/neo4j-examples/spring-datastore-graph-imdb.git - cd spring-datastore-graph-imdb - mvn clean install jetty:run - -browse to [http://localhost:8080/imdb/setup.html](http://localhost:8080/imdb/setup.html), insert the data and wait until it is completed (that may take some seconds). After that, you should be able to surf the data and look for actors and movies. - -Stop the application with - mvn jetty:stop - -If you inspect the graph using Neoclipse, -node-icons are found in -src/test/resources/icons diff --git a/spring-data-neo4j-examples/imdb/bin/pom.xml b/spring-data-neo4j-examples/imdb/bin/pom.xml deleted file mode 100644 index d6576c939..000000000 --- a/spring-data-neo4j-examples/imdb/bin/pom.xml +++ /dev/null @@ -1,474 +0,0 @@ - - - 4.0.0 - org.neo4j.examples - imdb - war - 2.2.0-BUILD-SNAPSHOT - imdb - - 3.0.7.RELEASE - 1.6.12 - 1.6.1 - UTF-8 - ${project.version} - - - - - spring-maven-release - Spring Maven Release Repository - http://maven.springframework.org/release - - - spring-maven-snapshot - Spring Maven Snapshot Repository - - true - - http://maven.springframework.org/snapshot - - - spring-maven-milestone - Spring Maven Milestone Repository - http://maven.springframework.org/milestone - - - neo4j-release-repository - Neo4j Maven 2 release repository - http://m2.neo4j.org/releases - - true - - - false - - - - neo4j-snapshot-repository - Neo4j Maven 2 snapshot repository - http://m2.neo4j.org/snapshots - - true - - - false - - - - - - spring-maven-release - Spring Maven Release Repository - http://maven.springframework.org/release - - - spring-maven-milestone - Spring Maven Milestone Repository - http://maven.springframework.org/milestone - - - - - - junit - junit - 4.8.1 - test - - - log4j - log4j - 1.2.16 - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - jcl-over-slf4j - ${slf4j.version} - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - - - org.aspectj - aspectjrt - ${aspectj.version} - - - org.aspectj - aspectjweaver - ${aspectj.version} - - - javax.servlet - servlet-api - 2.5 - provided - - - net.sf.flexjson - flexjson - 2.0 - - - - org.springframework - spring-core - ${spring.version} - - - commons-logging - commons-logging - - - - - org.springframework - spring-test - ${spring.version} - test - - - commons-logging - commons-logging - - - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-aop - ${spring.version} - - - org.springframework - spring-aspects - ${spring.version} - - - org.springframework - spring-tx - ${spring.version} - - - org.springframework.data - spring-data-neo4j-aspects - ${data-graph.version} - - - javax.validation - validation-api - 1.0.0.GA - - - org.hibernate - hibernate-validator - 4.0.2.GA - - - javax.xml.bind - jaxb-api - - - com.sun.xml.bind - jaxb-impl - - - - - org.apache.tiles - tiles-core - 2.2.1 - - - commons-logging - commons-logging - - - - - org.apache.tiles - tiles-jsp - 2.2.1 - - - org.springframework - spring-web - ${spring.version} - - - commons-logging - commons-logging - - - - - org.springframework - spring-webmvc - ${spring.version} - - - commons-logging - commons-logging - - - - - org.springframework.webflow - spring-js - 2.1.1.RELEASE - - - org.springframework - spring-beans - - - org.springframework - spring-context - - - org.springframework - spring-core - - - org.springframework - spring-context-support - - - commons-logging - commons-logging - - - - - commons-digester - commons-digester - 2.0 - - - commons-logging - commons-logging - - - - - commons-fileupload - commons-fileupload - 1.2.1 - - - commons-logging - commons-logging - - - - - javax.servlet - jstl - 1.2 - - - javax.el - el-api - 1.0 - provided - - - joda-time - joda-time - 1.6 - - - - - - org.apache.maven.plugins - maven-war-plugin - 2.1-beta-1 - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.1 - - 1.7 - 1.7 - - - - org.apache.maven.plugins - maven-resources-plugin - 2.4.2 - - UTF-8 - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.5 - - - **/*_Roo_* - - - - - org.apache.maven.plugins - maven-assembly-plugin - 2.2-beta-5 - - - jar-with-dependencies - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.5 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - 1.5 - - org.eclipse.ajdt.ui.ajnature - org.eclipse.jdt.core.javanature - org.springframework.ide.eclipse.core.springnature - - - - - org.apache.maven.plugins - maven-idea-plugin - 2.2 - - true - true - - - - org.codehaus.mojo - tomcat-maven-plugin - 1.0 - - - org.mortbay.jetty - jetty-maven-plugin - 7.1.2.v20100523 - - - /${project.name} - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-dependencies - package - - copy-dependencies - - - ${project.build.directory}/deps - false - false - true - - - - - - org.codehaus.mojo - aspectj-maven-plugin - 1.2 - - true - - - org.springframework - spring-aspects - - - org.springframework.data - spring-data-neo4j-aspects - - - 1.7 - 1.7 - - - - - compile - test-compile - - - - - - org.aspectj - aspectjrt - ${aspectj.version} - - - org.aspectj - aspectjtools - ${aspectj.version} - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.apache.maven.plugins - maven-dependency-plugin - [2.1,) - - copy-dependencies - unpack - - - - - - - - - - - - - - diff --git a/spring-data-neo4j-examples/imdb/doc/images/IMDB1.png b/spring-data-neo4j-examples/imdb/doc/images/IMDB1.png deleted file mode 100644 index 5ea3ec647..000000000 Binary files a/spring-data-neo4j-examples/imdb/doc/images/IMDB1.png and /dev/null differ diff --git a/spring-data-neo4j-examples/imdb/pom.xml b/spring-data-neo4j-examples/imdb/pom.xml deleted file mode 100644 index 8249d2d91..000000000 --- a/spring-data-neo4j-examples/imdb/pom.xml +++ /dev/null @@ -1,483 +0,0 @@ - - - 4.0.0 - org.neo4j.examples - imdb - war - 2.2.0.BUILD-SNAPSHOT - imdb - - 3.0.7.RELEASE - 1.6.12 - 1.6.1 - UTF-8 - ${project.version} - - - - - spring-maven-release - Spring Maven Release Repository - http://maven.springframework.org/release - - - spring-maven-snapshot - Spring Maven Snapshot Repository - - true - - http://maven.springframework.org/snapshot - - - spring-maven-milestone - Spring Maven Milestone Repository - http://maven.springframework.org/milestone - - - neo4j-release-repository - Neo4j Maven 2 release repository - http://m2.neo4j.org/releases - - true - - - false - - - - neo4j-snapshot-repository - Neo4j Maven 2 snapshot repository - http://m2.neo4j.org/snapshots - - true - - - false - - - - - - spring-maven-release - Spring Maven Release Repository - http://maven.springframework.org/release - - - spring-maven-milestone - Spring Maven Milestone Repository - http://maven.springframework.org/milestone - - - - - - junit - junit - 4.8.1 - test - - - log4j - log4j - 1.2.16 - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - jcl-over-slf4j - ${slf4j.version} - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - - - org.aspectj - aspectjrt - ${aspectj.version} - - - org.aspectj - aspectjweaver - ${aspectj.version} - - - - org.hibernate.javax.persistence - hibernate-jpa-2.0-api - 1.0.0.Final - true - compile - - - - javax.servlet - servlet-api - 2.5 - provided - - - net.sf.flexjson - flexjson - 2.0 - - - - org.springframework - spring-core - ${spring.version} - - - commons-logging - commons-logging - - - - - org.springframework - spring-test - ${spring.version} - test - - - commons-logging - commons-logging - - - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-aop - ${spring.version} - - - org.springframework - spring-aspects - ${spring.version} - - - org.springframework - spring-tx - ${spring.version} - - - org.springframework.data - spring-data-neo4j-aspects - ${spring-data-neo4j.version} - - - javax.validation - validation-api - 1.0.0.GA - - - org.hibernate - hibernate-validator - 4.0.2.GA - - - javax.xml.bind - jaxb-api - - - com.sun.xml.bind - jaxb-impl - - - - - org.apache.tiles - tiles-core - 2.2.1 - - - commons-logging - commons-logging - - - - - org.apache.tiles - tiles-jsp - 2.2.1 - - - org.springframework - spring-web - ${spring.version} - - - commons-logging - commons-logging - - - - - org.springframework - spring-webmvc - ${spring.version} - - - commons-logging - commons-logging - - - - - org.springframework.webflow - spring-js - 2.1.1.RELEASE - - - org.springframework - spring-beans - - - org.springframework - spring-context - - - org.springframework - spring-core - - - org.springframework - spring-context-support - - - commons-logging - commons-logging - - - - - commons-digester - commons-digester - 2.0 - - - commons-logging - commons-logging - - - - - commons-fileupload - commons-fileupload - 1.2.1 - - - commons-logging - commons-logging - - - - - javax.servlet - jstl - 1.2 - - - javax.el - el-api - 1.0 - provided - - - joda-time - joda-time - 1.6 - - - - - - org.apache.maven.plugins - maven-war-plugin - 2.1-beta-1 - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.1 - - 1.7 - 1.7 - - - - org.apache.maven.plugins - maven-resources-plugin - 2.4.2 - - UTF-8 - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.5 - - - **/*_Roo_* - - - - - org.apache.maven.plugins - maven-assembly-plugin - 2.2-beta-5 - - - jar-with-dependencies - - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.5 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - 1.5 - - org.eclipse.ajdt.ui.ajnature - org.eclipse.jdt.core.javanature - org.springframework.ide.eclipse.core.springnature - - - - - org.apache.maven.plugins - maven-idea-plugin - 2.2 - - true - true - - - - org.codehaus.mojo - tomcat-maven-plugin - 1.0 - - - org.mortbay.jetty - jetty-maven-plugin - 7.1.2.v20100523 - - - /${project.name} - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-dependencies - package - - copy-dependencies - - - ${project.build.directory}/deps - false - false - true - - - - - - org.codehaus.mojo - aspectj-maven-plugin - 1.2 - - true - - - org.springframework - spring-aspects - - - org.springframework.data - spring-data-neo4j-aspects - - - 1.7 - 1.7 - - - - - compile - test-compile - - - - - - org.aspectj - aspectjrt - ${aspectj.version} - - - org.aspectj - aspectjtools - ${aspectj.version} - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.apache.maven.plugins - maven-dependency-plugin - [2.1,) - - copy-dependencies - unpack - - - - - - - - - - - - - - diff --git a/spring-data-neo4j-examples/imdb/src/main/assembly/imdb-src.xml b/spring-data-neo4j-examples/imdb/src/main/assembly/imdb-src.xml deleted file mode 100644 index 07a2e0379..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/assembly/imdb-src.xml +++ /dev/null @@ -1,26 +0,0 @@ - - src - - tar.gz - zip - - - - - README* - LICENSE* - NOTICE* - pom.xml - - true - - - src - true - - **/main/model/** - **/main/assembly/** - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/Actor.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/Actor.java deleted file mode 100644 index f9b3569ac..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/Actor.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.neo4j.examples.imdb.domain; - -import org.springframework.data.neo4j.annotation.Indexed; -import org.springframework.data.neo4j.annotation.NodeEntity; -import org.springframework.data.neo4j.annotation.RelatedTo; - -import java.util.Set; - -// START SNIPPET: ActorClass -@NodeEntity -public class Actor { - @Indexed - private String name; - - @RelatedTo(type = "ACTS_IN", elementClass = Movie.class) - private Set movies; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Set getMovies() { - return movies; - } - - public Role getRole(final Movie inMovie) { - return getRelationshipTo(inMovie, Role.class, RelTypes.ACTS_IN.name()); - } - - @Override - public String toString() { - return "Actor '" + this.getName() + "'"; - } - - public void actsIn(Movie movie, final String role) { - relateTo(movie, Role.class, RelTypes.ACTS_IN.name()).play(role); - } - - public int getMovieCount() { - return getMovies().size(); - } -} -// END SNIPPET: ActorClass diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/ActorRepository.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/ActorRepository.java deleted file mode 100644 index fc9317c49..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/ActorRepository.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.neo4j.examples.imdb.domain; - - -import org.springframework.data.neo4j.repository.GraphRepository; - -/** - * @author mh - * @since 01.04.11 - */ -public interface ActorRepository extends GraphRepository { -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/ImdbSearchEngine.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/ImdbSearchEngine.java deleted file mode 100644 index 60c3e48c7..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/ImdbSearchEngine.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.neo4j.examples.imdb.domain; - -public interface ImdbSearchEngine { - void indexActor(Actor actor); - - void indexMovie(Movie movie); - - Actor searchActor(String name); - - Movie searchMovie(String title); -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/ImdbSearchEngineImpl.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/ImdbSearchEngineImpl.java deleted file mode 100644 index 7fce7e5c3..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/ImdbSearchEngineImpl.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.neo4j.examples.imdb.domain; - -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.*; - -/** - * example-implementation of an in-graph index using splitted names and titles and Lookup - Entities - * representing them to navigate to the "indexed" entities via their relationships. - * Lookup[word] - name.part -*> Actor | Lookup[word] - title.part -*> Movie - */ -public class ImdbSearchEngineImpl implements ImdbSearchEngine { - - @Autowired - private LookupRepository lookupRepository; - - public void indexActor(Actor actor) { - for (Lookup lookup : obtainLookups(actor.getName())) { - lookup.addActor(actor); - } - } - - public void indexMovie(Movie movie) { - String name = movie.getTitle(); - for (Lookup lookup : obtainLookups(name)) { - lookup.addMovie(movie); - } - } - - public Actor searchActor(String name) { - Set result = null; - for (Lookup lookup : findLookups(name)) { - result = merge(result, lookup.getActors()); - } - return firstOrMax(result, new Comparator() { - public int compare(Actor actor1, Actor actor2) { - return actor1.getMovieCount() - actor2.getMovieCount(); - } - }); - } - - - public Movie searchMovie(String title) { - Set result = null; - for (Lookup lookup : findLookups(title)) { - result = merge(result, lookup.getMovies()); - } - return firstOrMax(result, new Comparator(){ - public int compare(Movie movie1, Movie movie2) { - return movie1.getActorsCount() - movie2.getActorsCount(); - } - }); - } - - private List obtainLookups(String name) { - List result = new ArrayList(); - for (String part : splitSearchString(name)) { - Lookup lookup = findLookup(part); - if (lookup == null) { - result.add((Lookup) new Lookup(part).persist()); - } else { - result.add(lookup); - } - } - return result; - } - - private T firstOrMax(Set result, Comparator comparator) { - if (result == null || result.isEmpty()) return null; - return Collections.max(result, comparator); - } - - private Set merge(Set result, Collection values) { - if (result == null) { - return new HashSet(values); - } - - result.retainAll(values); - return result; - } - - private List findLookups(String name) { - List result = new ArrayList(); - for (String part : splitSearchString(name)) { - Lookup lookup = findLookup(part); - if (lookup != null) result.add(lookup); - } - return result; - } - - private Lookup findLookup(String part) { - return lookupRepository.findByPropertyValue("word", part); - } - - private String[] splitSearchString(final String value) { - return value.toLowerCase(Locale.ENGLISH).split("[^\\w]+"); - } -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/ImdbService.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/ImdbService.java deleted file mode 100644 index 59f084b11..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/ImdbService.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.neo4j.examples.imdb.domain; - -import java.util.List; - -public interface ImdbService { - /** - * Store a new actor in the graph and add the name to the index. - * - * @param name - * @return the new actor - */ - Actor createActor(String name); - - /** - * Store a new movie and add the title to the index. - * - * @param title title of the movie - * @param year year of release - * @return the new movie - */ - Movie createMovie(String title, int year); - - /** - * Returns the actor with the given name or null - * if not found. - * - * @param name name of actor - * @return actor or null if not found - */ - Actor getActor(String name); - - /** - * Return the movie with given title or null if - * not found. - * - * @param title movie title - * @return movie or null if not found - */ - Movie getMovie(String title); - - Movie getExactMovie(String title); - - /** - * Returns a list with first element {@link Actor} followed by {@link Movie} - * ending with an {@link Actor}. The list is one of the shortest paths - * between the actor and actor Kevin Bacon. - * - * @param actor name of actor to find shortest path to Kevin Bacon - * @return one of the shortest paths to Kevin Bacon - */ - List getBaconPath(Actor actor); - - /** - * Add a relationship from some node to the reference node. - * Will make it easy and fast to retrieve this node. - */ - void setupReferenceRelationship(); -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/ImdbServiceImpl.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/ImdbServiceImpl.java deleted file mode 100644 index 241b9e6c8..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/ImdbServiceImpl.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.neo4j.examples.imdb.domain; - -import org.neo4j.graphalgo.GraphAlgoFactory; -import org.neo4j.graphdb.Node; -import org.neo4j.graphdb.Path; -import org.neo4j.graphdb.PathExpander; -import org.neo4j.kernel.StandardExpander; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.neo4j.support.Neo4jTemplate; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.NoSuchElementException; - -class ImdbServiceImpl implements ImdbService { - @Autowired - private Neo4jTemplate template; - @Autowired - private ImdbSearchEngine searchEngine; - @Autowired - private MovieRepository movieRepository; - @Autowired - private ActorRepository actorRepository; - - public Actor createActor(final String name) { - final Actor actor = new Actor().persist(); - actor.setName(name); - searchEngine.indexActor(actor); - return actor; - } - - public Movie createMovie(final String title, final int year) { - final Movie movie = new Movie().persist(); - movie.setTitle(title); - movie.setYear(year); - searchEngine.indexMovie(movie); - return movie; - } - - public Actor getActor(final String name) { - Actor actor = actorRepository.findByPropertyValue("name", name); - if (actor != null) return actor; - return searchEngine.searchActor(name); - } - - public Movie getMovie(final String title) { - Movie movie = getExactMovie(title); - if (movie != null) return movie; - - return searchEngine.searchMovie(title); - } - - public Movie getExactMovie(final String title) { - return movieRepository.findByPropertyValue("title", title); - } - - - @Transactional - public void setupReferenceRelationship() { - Node referenceNode = template.getReferenceNode(); - Actor bacon = actorRepository.findByPropertyValue("name", "Bacon, Kevin"); - - if (bacon == null) throw new NoSuchElementException("Unable to find Kevin Bacon actor"); - - referenceNode.createRelationshipTo(bacon.getPersistentState(), RelTypes.IMDB); - } - - public List getBaconPath(final Actor actor) { - if (actor == null) throw new IllegalArgumentException("Null actor"); - - Actor bacon = actorRepository.findByPropertyValue("name", "Bacon, Kevin"); - - Path path = GraphAlgoFactory.shortestPath((PathExpander)StandardExpander.DEFAULT.add(RelTypes.ACTS_IN), 10).findSinglePath(bacon.getPersistentState(), actor.getPersistentState()); - if (path==null) return Collections.emptyList(); - return convertNodesToActorsAndMovies(path); - } - - private List convertNodesToActorsAndMovies(final Path list) { - final List actorAndMovieList = new LinkedList(); - int mod = 0; - for (Node node : list.nodes()) { - if (mod++ % 2 == 0) { - actorAndMovieList.add(template.load(node, Actor.class)); - } else { - actorAndMovieList.add(template.load(node, Movie.class)); - } - } - return actorAndMovieList; - } -} \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/Lookup.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/Lookup.java deleted file mode 100644 index 1472ea679..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/Lookup.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.neo4j.examples.imdb.domain; - -import org.springframework.data.neo4j.annotation.Indexed; -import org.springframework.data.neo4j.annotation.NodeEntity; -import org.springframework.data.neo4j.annotation.RelatedTo; - -import java.util.Set; - -/** - * @author mh - * @since 16.03.11 - */ -@NodeEntity -public class Lookup { - private - @Indexed - String word; - private int count; - - @RelatedTo(elementClass = Movie.class, type = "title.part") - private Set movies; - @RelatedTo(elementClass = Actor.class, type = "name.part") - private Set actors; - - public Lookup(String word) { - this.word = word; - } - - public Lookup() { - } - - public void addActor(Actor actor) { - relateTo(actor, "name.part"); - count++; - } - - public void addMovie(Movie movie) { - this.movies.add(movie); - count++; - } - - public String getWord() { - return word; - } - - public int getCount() { - return count; - } - - public Set getMovies() { - return movies; - } - - public Set getActors() { - return actors; - } - - public Movie getMovie() { - Set allMovies = getMovies(); - return allMovies != null && !allMovies.isEmpty() ? allMovies.iterator().next() : null; - } - - public Actor getActor() { - Set allActors = getActors(); - return allActors != null && !allActors.isEmpty() ? allActors.iterator().next() : null; - } -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/LookupRepository.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/LookupRepository.java deleted file mode 100644 index beebc5a3f..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/LookupRepository.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.neo4j.examples.imdb.domain; - - -import org.springframework.data.neo4j.repository.GraphRepository; - -/** - * @author mh - * @since 01.04.11 - */ -public interface LookupRepository extends GraphRepository { -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/Movie.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/Movie.java deleted file mode 100644 index bbf554cd6..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/Movie.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.neo4j.examples.imdb.domain; - -import org.neo4j.graphdb.Direction; -import org.springframework.data.neo4j.annotation.Indexed; -import org.springframework.data.neo4j.annotation.NodeEntity; -import org.springframework.data.neo4j.annotation.RelatedTo; - -import java.util.Set; - -// START SNIPPET: MovieClass -@NodeEntity -public class Movie { - @Indexed - String title; - int year; - - @RelatedTo(type = "ACTS_IN", elementClass = Actor.class, direction = Direction.INCOMING) - Set actors; - - public Set getActors() { - return actors; - } - - @Override - public String toString() { - return String.format("%s (%d)", getTitle(), getYear()); - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public int getYear() { - return year; - } - - public void setYear(int year) { - this.year = year; - } - - int getActorsCount() { - return getActors().size(); - } -} -// END SNIPPET: MovieClass diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/MovieRepository.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/MovieRepository.java deleted file mode 100644 index 4668650b6..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/MovieRepository.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.neo4j.examples.imdb.domain; - -import org.springframework.data.neo4j.repository.GraphRepository; - -/** - * @author mh - * @since 01.04.11 - */ -public interface MovieRepository extends GraphRepository { -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/RelTypes.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/RelTypes.java deleted file mode 100644 index fa1acb060..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/RelTypes.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.neo4j.examples.imdb.domain; - -import org.neo4j.graphdb.RelationshipType; - -public enum RelTypes implements RelationshipType { - ACTS_IN, IMDB -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/Role.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/Role.java deleted file mode 100644 index cc820588d..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/domain/Role.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.neo4j.examples.imdb.domain; - -import org.springframework.data.neo4j.annotation.EndNode; -import org.springframework.data.neo4j.annotation.RelationshipEntity; -import org.springframework.data.neo4j.annotation.StartNode; - -@RelationshipEntity -public class Role { - String role; - @StartNode - Actor actor; - @EndNode - Movie movie; - - @Override - public String toString() { - return String.format("%s-[%s]->%s", this.getActor(), role, this.getMovie()); - } - - public Actor getActor() { - return actor; - } - - public Movie getMovie() { - return movie; - } - - public String getName() { - return role; - } - - public Role play(String name) { - this.role = name; - return this; - } -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/ActorData.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/ActorData.java deleted file mode 100644 index 50be67085..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/ActorData.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.neo4j.examples.imdb.parser; - -public class ActorData { - private final String name; - private final RoleData[] movieRoles; - - /** - * Create container for actor data. - * - * @param name name of actor - * @param movieRoles movie roles of actor - */ - ActorData(final String name, final RoleData[] movieRoles) { - this.movieRoles = movieRoles; - this.name = name; - } - - public String getName() { - return name; - } - - public RoleData[] getMovieRoles() { - return movieRoles; - } -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/ImdbParser.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/ImdbParser.java deleted file mode 100644 index 76c06e5d9..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/ImdbParser.java +++ /dev/null @@ -1,223 +0,0 @@ -package org.neo4j.examples.imdb.parser; - -import org.springframework.core.io.ClassPathResource; - -import java.io.*; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.zip.GZIPInputStream; -import java.util.zip.ZipInputStream; - -/** - * A ImdbParser can parse the movie and actor/actress lists from - * the imdb text data (http://www.imdb.com/interfaces). It uses an - * {@link ImdbReader} forwarding the parsed information. - */ -public class ImdbParser { - private static final String MOVIES_MARKER = "MOVIES LIST"; - private static final int MOVIES_SKIPS = 2; - private static final String ACTRESSES_MARKER = "THE ACTRESSES LIST"; - private static final int ACTRESS_SKIPS = 4; - private static final String ACTOR_MARKER = "THE ACTORS LIST"; - private static final int ACTOR_SKIPS = 4; - private static final int BUFFER_SIZE = 200; - private final ImdbReader reader; - - /** - * Create a new Imdb parser. - * - * @param reader reader this parser will use to forward events to - */ - public ImdbParser(final ImdbReader reader) { - if (reader == null) { - throw new IllegalArgumentException("Null ImdbReader"); - } - this.reader = reader; - } - - /** - * Parsers a tab-separated movie list file, each line containing a movie - * title and the year the movie was released. The file can be .gz or .zip - * compressed, and must then have the corresponding file extension. - * - * @param file name of movie list file - * @throws IOException if unable to open the movie list file - */ - public String parseMovies(final String file) throws IOException { - final List buffer = new LinkedList(); - if (file == null) { - throw new IllegalArgumentException("Null movie file"); - } - BufferedReader fileReader = getFileReader(file, MOVIES_MARKER, - MOVIES_SKIPS); - String line = fileReader.readLine(); - int movieCount = 0; - while (line != null) { - // get rid of blank lines and TV shows - if ("".equals(line) || line.indexOf("(TV)") != -1) { - line = fileReader.readLine(); - continue; - } - final int yearSep = line.indexOf('\t'); - if (yearSep > 0) { - final String title = line.substring(0, yearSep).trim(); - String yearString = line.substring(yearSep).trim(); - if (yearString.length() > 4) { - yearString = yearString.substring(0, 4); - } - if (yearString.length() == 0 || yearString.charAt(0) == '?' - || title.contains("{") || title.startsWith("\"")) { - line = fileReader.readLine(); - continue; - } - final int year = Integer.parseInt(yearString); - buffer.add(new MovieData(title, year)); - movieCount++; - if (movieCount % BUFFER_SIZE == 0) { - reader.newMovies(buffer); - buffer.clear(); - } - } - line = fileReader.readLine(); - } - reader.newMovies(buffer); - return (movieCount + " movies parsed and injected."); - } - - /** - * Parsers a tab-separated actors list file. A line begins with actor name - * then followed by a tab and a movie title the actor acted in. Additional - * movies the current actor acted in are found on the following line that - * starts with a tab followed by the movie title. - * - * @param actorFile name of actor list file - * @param actressFile TODO - * @throws IOException if unable to open actor list file - */ - public String parseActors(final String actorFile, final String actressFile) - throws IOException { - if (actorFile == null) { - throw new IllegalArgumentException("Null actor file"); - } - if (actressFile == null) { - throw new IllegalArgumentException("Null actress file"); - } - String result = ""; - BufferedReader fileReader = getFileReader(actorFile, ACTOR_MARKER, - ACTOR_SKIPS); - result += "Actors: " + parseActorItems(fileReader) + "\n"; - fileReader.close(); - fileReader = getFileReader(actressFile, ACTRESSES_MARKER, - ACTRESS_SKIPS); - result += "Actresses: " + parseActorItems(fileReader); - return result; - } - - private String parseActorItems(BufferedReader fileReader) - throws IOException { - String line = fileReader.readLine(); - String currentActor = null; - final List buffer = new LinkedList(); - final List movies = new ArrayList(); - int movieCount = 0; - int actorCount = 0; - while (line != null) { - // get rid of blank lines - if ("".equals(line)) { - line = fileReader.readLine(); - continue; - } - int actorSep = line.indexOf('\t'); - if (actorSep >= 0) { - String actor = line.substring(0, actorSep).trim(); - if (!"".equals(actor)) { - if (movies.size() > 0) { - buffer.add(new ActorData(currentActor, movies - .toArray(new RoleData[movies.size()]))); - actorCount++; - movies.clear(); - } - currentActor = actor; - } - String title = line.substring(actorSep).trim(); - if (title.length() == 0 || title.contains("{") - || title.startsWith("\"") || title.contains("????")) { - line = fileReader.readLine(); - continue; - } - int characterStart = title.indexOf('['); - int characterEnd = title.indexOf(']'); - String character = null; - if (characterStart > 0 && characterEnd > characterStart) { - character = title.substring(characterStart + 1, - characterEnd); - } - int creditStart = title.indexOf('<'); - // int creditEnd = title.indexOf( '>' ); - // String credit = null; - // if ( creditStart > 0 && creditEnd > creditStart ) - // { - // credit = title.substring( creditStart + 1, creditEnd ); - // } - if (characterStart > 0) { - title = title.substring(0, characterStart).trim(); - } else if (creditStart > 0) { - title = title.substring(0, creditStart).trim(); - } - int spaces = title.indexOf(" "); - if (spaces > 0) { - if (title.charAt(spaces - 1) == ')' - && title.charAt(spaces + 2) == '(') { - title = title.substring(0, spaces).trim(); - } - } - movies.add(new RoleData(title, character)); - movieCount++; - if (movieCount % BUFFER_SIZE == 0) { - reader.newActors(buffer); - buffer.clear(); - } - } - line = fileReader.readLine(); - } - reader.newActors(buffer); - return (actorCount + " added including " + movieCount + " characters parsed and injected."); - } - - /** - * Get file reader that corresponds to file extension. - * - * @param file the file name - * @param pattern TODO - * @param skipLines TODO - * @return a file reader that uncompresses data if needed - * @throws IOException - * @throws FileNotFoundException - */ - private BufferedReader getFileReader(final String file, String pattern, - int skipLines) throws IOException, FileNotFoundException { - BufferedReader fileReader; - // support compressed files - if (file.endsWith(".gz")) { - fileReader = new BufferedReader(new InputStreamReader( - new GZIPInputStream(new ClassPathResource(file).getInputStream()))); - } else if (file.endsWith(".zip")) { - fileReader = new BufferedReader(new InputStreamReader( - new ZipInputStream(new ClassPathResource(file).getInputStream()))); - } else { - fileReader = new BufferedReader(new FileReader(file)); - } - - String line = ""; - while (!pattern.equals(line)) { - line = fileReader.readLine(); - } - for (int i = 0; i < skipLines; i++) { - line = fileReader.readLine(); - } - - return fileReader; - } - -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/ImdbReader.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/ImdbReader.java deleted file mode 100644 index 04ec5f3ac..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/ImdbReader.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.neo4j.examples.imdb.parser; - -import java.util.List; - -/** - * Reads events from the {@link ImdbParser}. - */ -public interface ImdbReader { - /** - * Creates new movies with specified title and - * year from a {@link MovieData} list. - * Every movie will be indexed. - * - * @param movieList movies to create and index - */ - void newMovies(List movieList); - - /** - * Creates new actors specifying what movies the actors acted in - * from a {@link ActorData} list. - * Every actor will be indexed. - * - * @param actorList actors to create and index - */ - void newActors(List actorList); -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/ImdbReaderImpl.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/ImdbReaderImpl.java deleted file mode 100644 index 41b926751..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/ImdbReaderImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.neo4j.examples.imdb.parser; - -import org.neo4j.examples.imdb.domain.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -class ImdbReaderImpl implements ImdbReader { - @Autowired - private ImdbService imdbService; - - @Transactional - public void newActors(final List actorList) { - for (ActorData actorData : actorList) { - newActor(actorData.getName(), actorData.getMovieRoles()); - } - } - - @Transactional - public void newMovies(final List movieList) { - for (MovieData movieData : movieList) { - newMovie(movieData.getTitle(), movieData.getYear()); - } - } - - private void newMovie(final String title, final int year) { - imdbService.createMovie(title, year); - } - - private void newActor(final String name, final RoleData[] movieRoles) { - final Actor actor = imdbService.createActor(name); - for (RoleData movieRole : movieRoles) { - final Movie movie = imdbService.getExactMovie(movieRole.getTitle()); - if (movie != null) { - actor.actsIn(movie, movieRole.getRole()); - } - } - } - -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/MovieData.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/MovieData.java deleted file mode 100644 index d388ffe47..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/MovieData.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.neo4j.examples.imdb.parser; - -public class MovieData { - private final String title; - private final int year; - - /** - * Create container for movie data. - * - * @param title title of movie - * @param year release year of movie - */ - MovieData(final String title, final int year) { - this.title = title; - this.year = year; - } - - public String getTitle() { - return title; - } - - public int getYear() { - return year; - } -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/RoleData.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/RoleData.java deleted file mode 100644 index 51317da96..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/parser/RoleData.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.neo4j.examples.imdb.parser; - -/** - * Holds information about what role an actor has in a movie - */ -public class RoleData { - private final String title; - private final String role; - - RoleData(final String title, final String role) { - this.title = title; - this.role = role; - } - - /** - * Returns the title of the movie, never null. - * - * @return title of the movie - */ - public String getTitle() { - return this.title; - } - - /** - * Returns the role the actor had in the movie, may be null - * if no information is available. - * - * @return actor role or null if information not avilable - */ - public String getRole() { - return this.role; - } -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/ActorFindControllerDelegate.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/ActorFindControllerDelegate.java deleted file mode 100644 index 2edb297f7..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/ActorFindControllerDelegate.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.neo4j.examples.imdb.web; - -import org.neo4j.examples.imdb.domain.Actor; -import org.neo4j.examples.imdb.domain.ImdbService; -import org.neo4j.examples.imdb.domain.Movie; -import org.neo4j.examples.imdb.domain.Role; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.ServletException; -import java.util.*; - -public class ActorFindControllerDelegate implements FindControllerDelegate { - @Autowired - private ImdbService imdbService; - - public String getFieldName() { - return "name"; - } - - @Transactional - public void getModel(final Object command, final Map model) - throws ServletException { - final String name = ((ActorForm) command).getName(); - final Actor actor = imdbService.getActor(name); - populateModel(model, actor); - } - - private void populateModel(final Map model, - final Actor actor) { - if (actor == null) { - model.put("actorName", "No actor found"); - model.put("kevinBaconNumber", ""); - model.put("movieTitles", Collections.emptyList()); - } else { - model.put("actorName", actor.getName()); - final List baconPathList = imdbService.getBaconPath(actor); - model.put("kevinBaconNumber", baconPathList.size() / 2); - final Collection movieInfo = new TreeSet(); - for (Movie movie : actor.getMovies()) { - movieInfo.add(new MovieInfo(movie, actor.getRole(movie))); - } - model.put("movieInfo", movieInfo); - final List baconPath = new LinkedList(); - for (Object actorOrMovie : baconPathList) { - if (actorOrMovie instanceof Actor) { - baconPath.add(((Actor) actorOrMovie).getName()); - } else if (actorOrMovie instanceof Movie) { - baconPath.add(((Movie) actorOrMovie).getTitle()); - } - } - model.put("baconPath", baconPath); - } - } - - public static final class MovieInfo implements Comparable { - private String title; - private String role; - - MovieInfo(final Movie movie, final Role role) { - setTitle(movie.getTitle()); - if (role == null || role.getName() == null) { - setRole("(unknown)"); - } else { - setRole(role.getName()); - } - } - - public final void setTitle(final String title) { - this.title = title; - } - - public String getTitle() { - return title; - } - - public final void setRole(final String role) { - this.role = role; - } - - public String getRole() { - return role; - } - - public int compareTo(final MovieInfo otherMovieInfo) { - return getTitle().compareTo(otherMovieInfo.getTitle()); - } - } -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/ActorForm.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/ActorForm.java deleted file mode 100644 index b4fcc989d..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/ActorForm.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.neo4j.examples.imdb.web; - -public class ActorForm { - private String name; - - public void setName(final String name) { - this.name = name; - } - - public String getName() { - return this.name; - } -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/ActorInfo.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/ActorInfo.java deleted file mode 100644 index 69cdd1b53..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/ActorInfo.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.neo4j.examples.imdb.web; - -import org.neo4j.examples.imdb.domain.Actor; -import org.neo4j.examples.imdb.domain.Role; - -/** -* @author mh -* @since 01.04.11 -*/ -public final class ActorInfo implements Comparable { - private String name; - private String role; - - public ActorInfo(final Actor actor, final Role role) { - setName(actor.getName()); - if (role == null || role.getName() == null) { - setRole("(unknown)"); - } else { - setRole(role.getName()); - } - } - - public void setName(final String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setRole(final String role) { - this.role = role; - } - - public String getRole() { - return role; - } - - public int compareTo(ActorInfo otherActorInfo) { - return getName().compareTo(otherActorInfo.getName()); - } -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/FindController.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/FindController.java deleted file mode 100644 index 2cdcc235c..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/FindController.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.neo4j.examples.imdb.web; - -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.SimpleFormController; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import java.util.HashMap; -import java.util.Map; - -public class FindController extends SimpleFormController { - private final FindControllerDelegate delegate; - - public FindController(final FindControllerDelegate delegate) { - super(); - this.delegate = delegate; - } - - @Override - protected ModelAndView onSubmit(final Object command) throws ServletException { - final Map model = new HashMap(); - delegate.getModel(command, model); - return new ModelAndView(getSuccessView(), "model", model); - } - - @Override - protected boolean isFormSubmission(final HttpServletRequest request) { - final String field = request.getParameter(delegate.getFieldName()); - return field != null && field.trim().length() > 0; - } -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/FindControllerDelegate.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/FindControllerDelegate.java deleted file mode 100644 index ca126b39c..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/FindControllerDelegate.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.neo4j.examples.imdb.web; - -import javax.servlet.ServletException; -import java.util.Map; - -public interface FindControllerDelegate { - void getModel(Object command, Map model) throws ServletException; - - String getFieldName(); -} \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/ImdbSetupControllerDelegate.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/ImdbSetupControllerDelegate.java deleted file mode 100644 index ee4fa5bdc..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/ImdbSetupControllerDelegate.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.neo4j.examples.imdb.web; - -import org.neo4j.examples.imdb.domain.ImdbService; -import org.neo4j.examples.imdb.parser.ImdbParser; -import org.neo4j.examples.imdb.parser.ImdbReader; -import org.springframework.beans.factory.annotation.Autowired; - -import javax.servlet.ServletException; -import java.io.IOException; -import java.util.Map; - -public class ImdbSetupControllerDelegate implements SetupControllerDelegate { - private static final String IMDB_DATADIR = "data/"; - @Autowired - private ImdbReader imdbReader; - @Autowired - private ImdbService imdbService; - - public void getModel(final Object command, final Map model) - throws ServletException { - - final ImdbParser parser = new ImdbParser(imdbReader); - StringBuffer message = new StringBuffer(200); - try { - message.append(parser.parseMovies(IMDB_DATADIR + "movies.list.gz")).append('\n'); - message.append(parser.parseActors(IMDB_DATADIR + "actors.list.gz", IMDB_DATADIR + "actresses.list.gz")).append('\n'); - imdbService.setupReferenceRelationship(); - } catch (IOException e) { - message.append("Something went wrong during the setup process:\n").append(e.getMessage()); - } - model.put("setupMessage", message.toString()); - } -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/MovieFindControllerDelegate.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/MovieFindControllerDelegate.java deleted file mode 100644 index e1dfc4fa7..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/MovieFindControllerDelegate.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.neo4j.examples.imdb.web; - -import org.neo4j.examples.imdb.domain.Actor; -import org.neo4j.examples.imdb.domain.ImdbService; -import org.neo4j.examples.imdb.domain.Movie; -import org.neo4j.examples.imdb.domain.Role; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.ServletException; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; -import java.util.TreeSet; - -public class MovieFindControllerDelegate implements FindControllerDelegate { - @Autowired - private ImdbService imdbService; - - public String getFieldName() { - return "title"; - } - - @Transactional - public void getModel(final Object command, final Map model) - throws ServletException { - final String title = ((MovieForm) command).getTitle(); - final Movie movie = imdbService.getMovie(title); - populateModel(model, movie); - } - - private void populateModel(final Map model, - final Movie movie) { - if (movie == null) { - model.put("movieTitle", "No movie found"); - model.put("actorNames", Collections.emptyList()); - } else { - model.put("movieTitle", movie.getTitle()); - final Collection actorInfo = new TreeSet(); - for (Actor actor : movie.getActors()) { - actorInfo.add(new ActorInfo(actor, actor.getRole(movie))); - } - model.put("actorInfo", actorInfo); - } - } - - public static final class ActorInfo implements Comparable { - private String name; - private String role; - - public ActorInfo(final Actor actor, final Role role) { - setName(actor.getName()); - if (role == null || role.getName() == null) { - setRole("(unknown)"); - } else { - setRole(role.getName()); - } - } - - public void setName(final String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setRole(final String role) { - this.role = role; - } - - public String getRole() { - return role; - } - - public int compareTo(ActorInfo otherActorInfo) { - return getName().compareTo(otherActorInfo.getName()); - } - } -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/MovieForm.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/MovieForm.java deleted file mode 100644 index d1af7adcc..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/MovieForm.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.neo4j.examples.imdb.web; - -public class MovieForm { - private String title; - - public void setTitle(final String title) { - this.title = title; - } - - public String getTitle() { - return this.title; - } -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/MovieInfo.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/MovieInfo.java deleted file mode 100644 index 287c1a33e..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/MovieInfo.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.neo4j.examples.imdb.web; - -import org.neo4j.examples.imdb.domain.Movie; -import org.neo4j.examples.imdb.domain.Role; - -/** -* @author mh -* @since 01.04.11 -*/ -public final class MovieInfo implements Comparable { - private String title; - private String role; - - MovieInfo(final Movie movie, final Role role) { - setTitle(movie.getTitle()); - if (role == null || role.getName() == null) { - setRole("(unknown)"); - } else { - setRole(role.getName()); - } - } - - public final void setTitle(final String title) { - this.title = title; - } - - public String getTitle() { - return title; - } - - public final void setRole(final String role) { - this.role = role; - } - - public String getRole() { - return role; - } - - public int compareTo(final MovieInfo otherMovieInfo) { - return getTitle().compareTo(otherMovieInfo.getTitle()); - } -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/SetupController.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/SetupController.java deleted file mode 100644 index 5b294b63b..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/SetupController.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.neo4j.examples.imdb.web; - -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.SimpleFormController; - -import javax.servlet.ServletException; -import java.util.HashMap; -import java.util.Map; - -public class SetupController extends SimpleFormController { - private final SetupControllerDelegate delegate; - - public SetupController(final SetupControllerDelegate delegate) { - super(); - this.delegate = delegate; - } - - @Override - protected ModelAndView onSubmit(final Object command) throws ServletException { - final Map model = new HashMap(); - delegate.getModel(command, model); - return new ModelAndView(getSuccessView(), "model", model); - } -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/SetupControllerDelegate.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/SetupControllerDelegate.java deleted file mode 100644 index 0c51d3dd8..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/SetupControllerDelegate.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.neo4j.examples.imdb.web; - -import javax.servlet.ServletException; -import java.util.Map; - -public interface SetupControllerDelegate { - void getModel(Object command, Map model) - throws ServletException; - -} diff --git a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/SetupForm.java b/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/SetupForm.java deleted file mode 100644 index ae04568c9..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/java/org/neo4j/examples/imdb/web/SetupForm.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.neo4j.examples.imdb.web; - -public class SetupForm { -} diff --git a/spring-data-neo4j-examples/imdb/src/main/model/imdb.domain.impl.ucls b/spring-data-neo4j-examples/imdb/src/main/model/imdb.domain.impl.ucls deleted file mode 100644 index 21487deab..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/model/imdb.domain.impl.ucls +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/main/model/imdb.domain.interface.simple.ucls b/spring-data-neo4j-examples/imdb/src/main/model/imdb.domain.interface.simple.ucls deleted file mode 100644 index dfb9108d9..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/model/imdb.domain.interface.simple.ucls +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/main/model/imdb.domain.interface.ucls b/spring-data-neo4j-examples/imdb/src/main/model/imdb.domain.interface.ucls deleted file mode 100644 index e58a89a33..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/model/imdb.domain.interface.ucls +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/main/model/imdb.domain.service.search.ucls b/spring-data-neo4j-examples/imdb/src/main/model/imdb.domain.service.search.ucls deleted file mode 100644 index 22ed008db..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/model/imdb.domain.service.search.ucls +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/main/model/imdb.domain.service.ucls b/spring-data-neo4j-examples/imdb/src/main/model/imdb.domain.service.ucls deleted file mode 100644 index 8dc2132fe..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/model/imdb.domain.service.ucls +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/main/model/imdb.packages.ucls b/spring-data-neo4j-examples/imdb/src/main/model/imdb.packages.ucls deleted file mode 100644 index b4f04ee4f..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/model/imdb.packages.ucls +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/main/model/imdb.parser.data.ucls b/spring-data-neo4j-examples/imdb/src/main/model/imdb.parser.data.ucls deleted file mode 100644 index 469eaf124..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/model/imdb.parser.data.ucls +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/main/model/imdb.parser.ucls b/spring-data-neo4j-examples/imdb/src/main/model/imdb.parser.ucls deleted file mode 100644 index bf5f2ec7d..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/model/imdb.parser.ucls +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/main/model/imdb.util.ucls b/spring-data-neo4j-examples/imdb/src/main/model/imdb.util.ucls deleted file mode 100644 index d0908a9ca..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/model/imdb.util.ucls +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/main/model/imdb.web.find.ucls b/spring-data-neo4j-examples/imdb/src/main/model/imdb.web.find.ucls deleted file mode 100644 index 7d284a190..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/model/imdb.web.find.ucls +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/main/model/imdb.web.setup.ucls b/spring-data-neo4j-examples/imdb/src/main/model/imdb.web.setup.ucls deleted file mode 100644 index e077ad162..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/model/imdb.web.setup.ucls +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/main/resources/data/actors.list.gz b/spring-data-neo4j-examples/imdb/src/main/resources/data/actors.list.gz deleted file mode 100644 index 4b5a4316f..000000000 Binary files a/spring-data-neo4j-examples/imdb/src/main/resources/data/actors.list.gz and /dev/null differ diff --git a/spring-data-neo4j-examples/imdb/src/main/resources/data/actresses.list.gz b/spring-data-neo4j-examples/imdb/src/main/resources/data/actresses.list.gz deleted file mode 100644 index e31a9e10d..000000000 Binary files a/spring-data-neo4j-examples/imdb/src/main/resources/data/actresses.list.gz and /dev/null differ diff --git a/spring-data-neo4j-examples/imdb/src/main/resources/data/movies.list.gz b/spring-data-neo4j-examples/imdb/src/main/resources/data/movies.list.gz deleted file mode 100644 index 31e457ee3..000000000 Binary files a/spring-data-neo4j-examples/imdb/src/main/resources/data/movies.list.gz and /dev/null differ diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/META-INF/MANIFEST.MF b/spring-data-neo4j-examples/imdb/src/main/webapp/META-INF/MANIFEST.MF deleted file mode 100644 index 5e9495128..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/webapp/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/WEB-INF/imdb-app-servlet.xml b/spring-data-neo4j-examples/imdb/src/main/webapp/WEB-INF/imdb-app-servlet.xml deleted file mode 100644 index 96743d3b5..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/webapp/WEB-INF/imdb-app-servlet.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/WEB-INF/tld/spring-form.tld b/spring-data-neo4j-examples/imdb/src/main/webapp/WEB-INF/tld/spring-form.tld deleted file mode 100644 index 4f6fd9fd4..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/webapp/WEB-INF/tld/spring-form.tld +++ /dev/null @@ -1,2252 +0,0 @@ - - - - - - 2.5 - 1.2 - form - http://www.springframework.org/tags/form - Spring Framework JSP Form Tag Library - - - - form - org.springframework.web.servlet.tags.form.FormTag - JSP - Renders an HTML 'form' tag and exposes a binding path to inner tags for binding. - - id - false - true - HTML Standard Attribute - - - name - false - true - HTML Standard Attribute - added for backwards compatibility cases - - - htmlEscape - false - true - Enable/disable HTML escaping of rendered values. - - - cssClass - false - true - Equivalent to "class" - HTML Optional Attribute - - - cssStyle - false - true - Equivalent to "style" - HTML Optional Attribute - - - lang - false - true - HTML Standard Attribute - - - title - false - true - HTML Standard Attribute - - - dir - false - true - HTML Standard Attribute - - - onclick - false - true - HTML Event Attribute - - - ondblclick - false - true - HTML Event Attribute - - - onmousedown - false - true - HTML Event Attribute - - - onmouseup - false - true - HTML Event Attribute - - - onmouseover - false - true - HTML Event Attribute - - - onmousemove - false - true - HTML Event Attribute - - - onmouseout - false - true - HTML Event Attribute - - - onkeypress - false - true - HTML Event Attribute - - - onkeyup - false - true - HTML Event Attribute - - - onkeydown - false - true - HTML Event Attribute - - - - modelAttribute - false - true - Name of the model attribute under which the form object is exposed. - Defaults to 'command'. - - - commandName - false - true - Name of the model attribute under which the form object is exposed. - Defaults to 'command'. - - - action - false - true - HTML Required Attribute - - - method - false - true - HTML Optional Attribute - - - enctype - false - true - HTML Optional Attribute - - - onsubmit - false - true - HTML Event Attribute - - - onreset - false - true - HTML Event Attribute - - - acceptCharset - false - true - Specifies the list of character encodings for input data that is accepted by the server processing this form. The value is a space- and/or comma-delimited list of charset values. The client must interpret this list as an exclusive-or list, i.e., the server is able to accept any single character encoding per entity received. - - - - - - input - org.springframework.web.servlet.tags.form.InputTag - empty - Renders an HTML 'input' tag with type 'text' using the bound value. - - path - true - true - Path to property for data binding - - - id - false - true - HTML Standard Attribute - - - htmlEscape - false - true - Enable/disable HTML escaping of rendered values. - - - cssClass - false - true - Equivalent to "class" - HTML Optional Attribute - - - cssErrorClass - false - true - Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. - - - cssStyle - false - true - Equivalent to "style" - HTML Optional Attribute - - - lang - false - true - HTML Standard Attribute - - - title - false - true - HTML Standard Attribute - - - dir - false - true - HTML Standard Attribute - - - tabindex - false - true - HTML Standard Attribute - - - disabled - false - true - HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. - - - onclick - false - true - HTML Event Attribute - - - ondblclick - false - true - HTML Event Attribute - - - onmousedown - false - true - HTML Event Attribute - - - onmouseup - false - true - HTML Event Attribute - - - onmouseover - false - true - HTML Event Attribute - - - onmousemove - false - true - HTML Event Attribute - - - onmouseout - false - true - HTML Event Attribute - - - onkeypress - false - true - HTML Event Attribute - - - onkeyup - false - true - HTML Event Attribute - - - onkeydown - false - true - HTML Event Attribute - - - onfocus - false - true - HTML Event Attribute - - - onblur - false - true - HTML Event Attribute - - - onchange - false - true - HTML Event Attribute - - - accesskey - false - true - HTML Standard Attribute - - - - size - false - true - HTML Optional Attribute - - - maxlength - false - true - HTML Optional Attribute - - - alt - false - true - HTML Optional Attribute - - - onselect - false - true - HTML Event Attribute - - - readonly - false - true - HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will make the HTML element readonly. - - - autocomplete - false - true - Common Optional Attribute - - - - - - password - org.springframework.web.servlet.tags.form.PasswordInputTag - empty - Renders an HTML 'input' tag with type 'password' using the bound value. - - path - true - true - Path to property for data binding - - - id - false - true - HTML Standard Attribute - - - htmlEscape - false - true - Enable/disable HTML escaping of rendered values. - - - cssClass - false - true - Equivalent to "class" - HTML Optional Attribute - - - cssErrorClass - false - true - Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. - - - cssStyle - false - true - Equivalent to "style" - HTML Optional Attribute - - - lang - false - true - HTML Standard Attribute - - - title - false - true - HTML Standard Attribute - - - dir - false - true - HTML Standard Attribute - - - tabindex - false - true - HTML Standard Attribute - - - disabled - false - true - HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. - - - onclick - false - true - HTML Event Attribute - - - ondblclick - false - true - HTML Event Attribute - - - onmousedown - false - true - HTML Event Attribute - - - onmouseup - false - true - HTML Event Attribute - - - onmouseover - false - true - HTML Event Attribute - - - onmousemove - false - true - HTML Event Attribute - - - onmouseout - false - true - HTML Event Attribute - - - onkeypress - false - true - HTML Event Attribute - - - onkeyup - false - true - HTML Event Attribute - - - onkeydown - false - true - HTML Event Attribute - - - onfocus - false - true - HTML Event Attribute - - - onblur - false - true - HTML Event Attribute - - - onchange - false - true - HTML Event Attribute - - - accesskey - false - true - HTML Standard Attribute - - - - size - false - true - HTML Optional Attribute - - - maxlength - false - true - HTML Optional Attribute - - - alt - false - true - HTML Optional Attribute - - - onselect - false - true - HTML Event Attribute - - - readonly - false - true - HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will make the HTML element readonly. - - - autocomplete - false - true - Common Optional Attribute - - - - showPassword - false - true - Is the password value to be shown? Defaults to false. - - - - - - hidden - org.springframework.web.servlet.tags.form.HiddenInputTag - empty - Renders an HTML 'input' tag with type 'hidden' using the bound value. - - path - true - true - Path to property for data binding - - - id - false - true - HTML Standard Attribute - - - htmlEscape - false - true - Enable/disable HTML escaping of rendered values. - - - - - - select - org.springframework.web.servlet.tags.form.SelectTag - JSP - Renders an HTML 'select' element. Supports databinding to the selected option. - - path - true - true - Path to property for data binding - - - id - false - true - HTML Standard Attribute - - - htmlEscape - false - true - Enable/disable HTML escaping of rendered values. - - - cssClass - false - true - Equivalent to "class" - HTML Optional Attribute - - - cssErrorClass - false - true - Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. - - - cssStyle - false - true - Equivalent to "style" - HTML Optional Attribute - - - lang - false - true - HTML Standard Attribute - - - title - false - true - HTML Standard Attribute - - - dir - false - true - HTML Standard Attribute - - - tabindex - false - true - HTML Standard Attribute - - - disabled - false - true - HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. - - - onclick - false - true - HTML Event Attribute - - - ondblclick - false - true - HTML Event Attribute - - - onmousedown - false - true - HTML Event Attribute - - - onmouseup - false - true - HTML Event Attribute - - - onmouseover - false - true - HTML Event Attribute - - - onmousemove - false - true - HTML Event Attribute - - - onmouseout - false - true - HTML Event Attribute - - - onkeypress - false - true - HTML Event Attribute - - - onkeyup - false - true - HTML Event Attribute - - - onkeydown - false - true - HTML Event Attribute - - - onfocus - false - true - HTML Event Attribute - - - onblur - false - true - HTML Event Attribute - - - onchange - false - true - HTML Event Attribute - - - accesskey - false - true - HTML Standard Attribute - - - - items - false - true - The Collection, Map or array of objects used to generate the inner 'option' tags - - - itemValue - false - true - Name of the property mapped to 'value' attribute of the 'option' tag - - - itemLabel - false - true - Name of the property mapped to the inner text of the 'option' tag - - - size - false - true - HTML Optional Attribute - - - multiple - false - true - HTML Optional Attribute - - - - - - option - org.springframework.web.servlet.tags.form.OptionTag - JSP - Renders a single HTML 'option'. Sets 'selected' as appropriate based on bound value. - - value - java.lang.Object - The actual value bound to the 'value' attribute - - - displayValue - java.lang.String - The String representation of thr value bound to the 'value' attribute, taking into consideration - any PropertyEditor associated with the enclosing 'select' tag. - - - value - true - true - HTML Optional Attribute - - - label - false - true - HTML Optional Attribute - - - htmlEscape - false - true - Enable/disable HTML escaping of rendered values. - - - cssClass - false - true - Equivalent to "class" - HTML Optional Attribute - - - cssErrorClass - false - true - Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. - - - cssStyle - false - true - Equivalent to "style" - HTML Optional Attribute - - - lang - false - true - HTML Standard Attribute - - - title - false - true - HTML Standard Attribute - - - dir - false - true - HTML Standard Attribute - - - tabindex - false - true - HTML Standard Attribute - - - disabled - false - true - HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. - - - onclick - false - true - HTML Event Attribute - - - ondblclick - false - true - HTML Event Attribute - - - onmousedown - false - true - HTML Event Attribute - - - onmouseup - false - true - HTML Event Attribute - - - onmouseover - false - true - HTML Event Attribute - - - onmousemove - false - true - HTML Event Attribute - - - onmouseout - false - true - HTML Event Attribute - - - onkeypress - false - true - HTML Event Attribute - - - onkeyup - false - true - HTML Event Attribute - - - onkeydown - false - true - HTML Event Attribute - - - - - - options - org.springframework.web.servlet.tags.form.OptionsTag - empty - Renders a list of HTML 'option' tags. Sets 'selected' as appropriate based on bound - value. - - items - true - true - The Collection, Map or array of objects used to generate the inner 'option' tags - - - itemValue - false - true - Name of the property mapped to 'value' attribute of the 'option' tag - - - itemLabel - false - true - Name of the property mapped to the inner text of the 'option' tag - - - htmlEscape - false - true - Enable/disable HTML escaping of rendered values. - - - cssClass - false - true - Equivalent to "class" - HTML Optional Attribute - - - cssErrorClass - false - true - Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. - - - cssStyle - false - true - Equivalent to "style" - HTML Optional Attribute - - - lang - false - true - HTML Standard Attribute - - - title - false - true - HTML Standard Attribute - - - dir - false - true - HTML Standard Attribute - - - tabindex - false - true - HTML Standard Attribute - - - disabled - false - true - HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. - - - onclick - false - true - HTML Event Attribute - - - ondblclick - false - true - HTML Event Attribute - - - onmousedown - false - true - HTML Event Attribute - - - onmouseup - false - true - HTML Event Attribute - - - onmouseover - false - true - HTML Event Attribute - - - onmousemove - false - true - HTML Event Attribute - - - onmouseout - false - true - HTML Event Attribute - - - onkeypress - false - true - HTML Event Attribute - - - onkeyup - false - true - HTML Event Attribute - - - onkeydown - false - true - HTML Event Attribute - - - - - - radiobutton - org.springframework.web.servlet.tags.form.RadioButtonTag - empty - Renders an HTML 'input' tag with type 'radio'. - - path - true - true - Path to property for data binding - - - id - false - true - HTML Standard Attribute - - - htmlEscape - false - true - Enable/disable HTML escaping of rendered values. - - - cssClass - false - true - Equivalent to "class" - HTML Optional Attribute - - - cssErrorClass - false - true - Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. - - - cssStyle - false - true - Equivalent to "style" - HTML Optional Attribute - - - lang - false - true - HTML Standard Attribute - - - title - false - true - HTML Standard Attribute - - - dir - false - true - HTML Standard Attribute - - - tabindex - false - true - HTML Standard Attribute - - - disabled - false - true - HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. - - - onclick - false - true - HTML Event Attribute - - - ondblclick - false - true - HTML Event Attribute - - - onmousedown - false - true - HTML Event Attribute - - - onmouseup - false - true - HTML Event Attribute - - - onmouseover - false - true - HTML Event Attribute - - - onmousemove - false - true - HTML Event Attribute - - - onmouseout - false - true - HTML Event Attribute - - - onkeypress - false - true - HTML Event Attribute - - - onkeyup - false - true - HTML Event Attribute - - - onkeydown - false - true - HTML Event Attribute - - - onfocus - false - true - HTML Event Attribute - - - onblur - false - true - HTML Event Attribute - - - onchange - false - true - HTML Event Attribute - - - accesskey - false - true - HTML Standard Attribute - - - - value - false - true - HTML Optional Attribute - - - label - false - true - Value to be displayed as part of the tag - - - - - - radiobuttons - org.springframework.web.servlet.tags.form.RadioButtonsTag - empty - Renders multiple HTML 'input' tags with type 'radio'. - - path - true - true - Path to property for data binding - - - id - false - true - HTML Standard Attribute - - - htmlEscape - false - true - Enable/disable HTML escaping of rendered values. - - - cssClass - false - true - Equivalent to "class" - HTML Optional Attribute - - - cssErrorClass - false - true - Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. - - - cssStyle - false - true - Equivalent to "style" - HTML Optional Attribute - - - lang - false - true - HTML Standard Attribute - - - title - false - true - HTML Standard Attribute - - - dir - false - true - HTML Standard Attribute - - - tabindex - false - true - HTML Standard Attribute - - - disabled - false - true - HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. - - - onclick - false - true - HTML Event Attribute - - - ondblclick - false - true - HTML Event Attribute - - - onmousedown - false - true - HTML Event Attribute - - - onmouseup - false - true - HTML Event Attribute - - - onmouseover - false - true - HTML Event Attribute - - - onmousemove - false - true - HTML Event Attribute - - - onmouseout - false - true - HTML Event Attribute - - - onkeypress - false - true - HTML Event Attribute - - - onkeyup - false - true - HTML Event Attribute - - - onkeydown - false - true - HTML Event Attribute - - - onfocus - false - true - HTML Event Attribute - - - onblur - false - true - HTML Event Attribute - - - onchange - false - true - HTML Event Attribute - - - accesskey - false - true - HTML Standard Attribute - - - - items - true - true - The Collection, Map or array of objects used to generate the 'input' tags with type 'radio' - - - itemValue - false - true - Name of the property mapped to 'value' attribute of the 'input' tags with type 'radio' - - - itemLabel - false - true - Value to be displayed as part of the 'input' tags with type 'radio' - - - delimiter - false - true - Delimiter to use between each 'input' tag with type 'radio'. There is no delimiter by default. - - - element - false - true - Specifies the HTML element that is used to enclose each 'input' tag with type 'radio'. Defaults to 'span'. - - - - - - checkbox - org.springframework.web.servlet.tags.form.CheckboxTag - empty - Renders an HTML 'input' tag with type 'checkbox'. - - path - true - true - Path to property for data binding - - - id - false - true - HTML Standard Attribute - - - htmlEscape - false - true - Enable/disable HTML escaping of rendered values. - - - cssClass - false - true - Equivalent to "class" - HTML Optional Attribute - - - cssErrorClass - false - true - Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. - - - cssStyle - false - true - Equivalent to "style" - HTML Optional Attribute - - - lang - false - true - HTML Standard Attribute - - - title - false - true - HTML Standard Attribute - - - dir - false - true - HTML Standard Attribute - - - tabindex - false - true - HTML Standard Attribute - - - disabled - false - true - HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. - - - onclick - false - true - HTML Event Attribute - - - ondblclick - false - true - HTML Event Attribute - - - onmousedown - false - true - HTML Event Attribute - - - onmouseup - false - true - HTML Event Attribute - - - onmouseover - false - true - HTML Event Attribute - - - onmousemove - false - true - HTML Event Attribute - - - onmouseout - false - true - HTML Event Attribute - - - onkeypress - false - true - HTML Event Attribute - - - onkeyup - false - true - HTML Event Attribute - - - onkeydown - false - true - HTML Event Attribute - - - onfocus - false - true - HTML Event Attribute - - - onblur - false - true - HTML Event Attribute - - - onchange - false - true - HTML Event Attribute - - - accesskey - false - true - HTML Standard Attribute - - - - value - false - true - HTML Optional Attribute - - - label - false - true - Value to be displayed as part of the tag - - - - - - checkboxes - org.springframework.web.servlet.tags.form.CheckboxesTag - empty - Renders multiple HTML 'input' tags with type 'checkbox'. - - path - true - true - Path to property for data binding - - - id - false - true - HTML Standard Attribute - - - htmlEscape - false - true - Enable/disable HTML escaping of rendered values. - - - cssClass - false - true - Equivalent to "class" - HTML Optional Attribute - - - cssErrorClass - false - true - Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. - - - cssStyle - false - true - Equivalent to "style" - HTML Optional Attribute - - - lang - false - true - HTML Standard Attribute - - - title - false - true - HTML Standard Attribute - - - dir - false - true - HTML Standard Attribute - - - tabindex - false - true - HTML Standard Attribute - - - disabled - false - true - HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. - - - onclick - false - true - HTML Event Attribute - - - ondblclick - false - true - HTML Event Attribute - - - onmousedown - false - true - HTML Event Attribute - - - onmouseup - false - true - HTML Event Attribute - - - onmouseover - false - true - HTML Event Attribute - - - onmousemove - false - true - HTML Event Attribute - - - onmouseout - false - true - HTML Event Attribute - - - onkeypress - false - true - HTML Event Attribute - - - onkeyup - false - true - HTML Event Attribute - - - onkeydown - false - true - HTML Event Attribute - - - onfocus - false - true - HTML Event Attribute - - - onblur - false - true - HTML Event Attribute - - - onchange - false - true - HTML Event Attribute - - - accesskey - false - true - HTML Standard Attribute - - - - items - true - true - The Collection, Map or array of objects used to generate the 'input' tags with type 'checkbox' - - - itemValue - false - true - Name of the property mapped to 'value' attribute of the 'input' tags with type 'checkbox' - - - itemLabel - false - true - Value to be displayed as part of the 'input' tags with type 'checkbox' - - - delimiter - false - true - Delimiter to use between each 'input' tag with type 'checkbox'. There is no delimiter by default. - - - element - false - true - Specifies the HTML element that is used to enclose each 'input' tag with type 'checkbox'. Defaults to 'span'. - - - - - - textarea - org.springframework.web.servlet.tags.form.TextareaTag - empty - Renders an HTML 'textarea'. - - path - true - true - Path to property for data binding - - - id - false - true - HTML Standard Attribute - - - htmlEscape - false - true - Enable/disable HTML escaping of rendered values. - - - cssClass - false - true - Equivalent to "class" - HTML Optional Attribute - - - cssErrorClass - false - true - Equivalent to "class" - HTML Optional Attribute. Used when the bound field has errors. - - - cssStyle - false - true - Equivalent to "style" - HTML Optional Attribute - - - lang - false - true - HTML Standard Attribute - - - title - false - true - HTML Standard Attribute - - - dir - false - true - HTML Standard Attribute - - - tabindex - false - true - HTML Standard Attribute - - - disabled - false - true - HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element. - - - onclick - false - true - HTML Event Attribute - - - ondblclick - false - true - HTML Event Attribute - - - onmousedown - false - true - HTML Event Attribute - - - onmouseup - false - true - HTML Event Attribute - - - onmouseover - false - true - HTML Event Attribute - - - onmousemove - false - true - HTML Event Attribute - - - onmouseout - false - true - HTML Event Attribute - - - onkeypress - false - true - HTML Event Attribute - - - onkeyup - false - true - HTML Event Attribute - - - onkeydown - false - true - HTML Event Attribute - - - onfocus - false - true - HTML Event Attribute - - - onblur - false - true - HTML Event Attribute - - - onchange - false - true - HTML Event Attribute - - - accesskey - false - true - HTML Standard Attribute - - - - rows - false - true - HTML Required Attribute - - - cols - false - true - HTML Required Attribute - - - onselect - false - true - HTML Event Attribute - - - readonly - false - true - HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will make the HTML element readonly. - - - - - - errors - org.springframework.web.servlet.tags.form.ErrorsTag - JSP - Renders field errors in an HTML 'span' tag. - - messages - java.util.List - - - path - false - true - Path to errors object for data binding - - - id - false - true - HTML Standard Attribute - - - htmlEscape - false - true - Enable/disable HTML escaping of rendered values. - - - delimiter - false - true - Delimiter for displaying multiple error messages. Defaults to the br tag. - - - cssClass - false - true - Equivalent to "class" - HTML Optional Attribute - - - cssStyle - false - true - Equivalent to "style" - HTML Optional Attribute - - - lang - false - true - HTML Standard Attribute - - - title - false - true - HTML Standard Attribute - - - dir - false - true - HTML Standard Attribute - - - tabindex - false - true - HTML Standard Attribute - - - onclick - false - true - HTML Event Attribute - - - ondblclick - false - true - HTML Event Attribute - - - onmousedown - false - true - HTML Event Attribute - - - onmouseup - false - true - HTML Event Attribute - - - onmouseover - false - true - HTML Event Attribute - - - onmousemove - false - true - HTML Event Attribute - - - onmouseout - false - true - HTML Event Attribute - - - onkeypress - false - true - HTML Event Attribute - - - onkeyup - false - true - HTML Event Attribute - - - onkeydown - false - true - HTML Event Attribute - - - element - false - true - Specifies the HTML element that is used to render the enclosing errors. - - - - - - label - org.springframework.web.servlet.tags.form.LabelTag - JSP - Renders a form field label in an HTML 'label' tag. - - path - true - true - Path to errors object for data binding - - - id - false - true - HTML Standard Attribute - - - htmlEscape - false - true - Enable/disable HTML escaping of rendered values. - - - for - false - true - HTML Standard Attribute - - - cssClass - false - true - Equivalent to "class" - HTML Optional Attribute. - - - cssErrorClass - false - true - Equivalent to "class" - HTML Optional Attribute. Used only when errors are present. - - - cssStyle - false - true - Equivalent to "style" - HTML Optional Attribute - - - lang - false - true - HTML Standard Attribute - - - title - false - true - HTML Standard Attribute - - - dir - false - true - HTML Standard Attribute - - - tabindex - false - true - HTML Standard Attribute - - - onclick - false - true - HTML Event Attribute - - - ondblclick - false - true - HTML Event Attribute - - - onmousedown - false - true - HTML Event Attribute - - - onmouseup - false - true - HTML Event Attribute - - - onmouseover - false - true - HTML Event Attribute - - - onmousemove - false - true - HTML Event Attribute - - - onmouseout - false - true - HTML Event Attribute - - - onkeypress - false - true - HTML Event Attribute - - - onkeyup - false - true - HTML Event Attribute - - - onkeydown - false - true - HTML Event Attribute - - - - diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/WEB-INF/web.xml b/spring-data-neo4j-examples/imdb/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index a6ce357d9..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - imdb-app - org.springframework.web.servlet.DispatcherServlet - 1 - - - - imdb-app - *.html - - - - index.jsp - - - - - /spring - /WEB-INF/tld/spring-form.tld - - - - diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/actor.png b/spring-data-neo4j-examples/imdb/src/main/webapp/actor.png deleted file mode 100644 index 9d2d50081..000000000 Binary files a/spring-data-neo4j-examples/imdb/src/main/webapp/actor.png and /dev/null differ diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/bg.png b/spring-data-neo4j-examples/imdb/src/main/webapp/bg.png deleted file mode 100644 index 29d110772..000000000 Binary files a/spring-data-neo4j-examples/imdb/src/main/webapp/bg.png and /dev/null differ diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/favicon.ico b/spring-data-neo4j-examples/imdb/src/main/webapp/favicon.ico deleted file mode 100644 index 58a83c6d8..000000000 Binary files a/spring-data-neo4j-examples/imdb/src/main/webapp/favicon.ico and /dev/null differ diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/gradient.png b/spring-data-neo4j-examples/imdb/src/main/webapp/gradient.png deleted file mode 100644 index abdb086c4..000000000 Binary files a/spring-data-neo4j-examples/imdb/src/main/webapp/gradient.png and /dev/null differ diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/index.jsp b/spring-data-neo4j-examples/imdb/src/main/webapp/index.jsp deleted file mode 100644 index b7a02fb16..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/webapp/index.jsp +++ /dev/null @@ -1,17 +0,0 @@ -<%@ include file="/jsp/include.jsp"%> -<%@ include file="/jsp/head.jsp"%> - -IMDB powered by Neo - - -

IMDB powered by Neo4j

- - - - - diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/actor-list.jsp b/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/actor-list.jsp deleted file mode 100644 index 71f825c98..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/actor-list.jsp +++ /dev/null @@ -1,21 +0,0 @@ -<%@ include file="/jsp/include.jsp"%> -<%@ include file="/jsp/head.jsp"%> - -<c:out value="${model.movieTitle}" /> : IMDB powered by Neo4j - - -

-

Actors

-
    - - - - -
  • as
  • -
    -
-<%@ include file="/jsp/menu.jsp"%> - - diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/actor.jsp b/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/actor.jsp deleted file mode 100644 index ab3287f14..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/actor.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%@ include file="/jsp/include.jsp"%> -<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> -<%@ include file="/jsp/head.jsp"%> - -IMDB powered by Neo4j - - -

IMDB powered by Neo4j

- -
Find actor
-
-
-<%@ include file="/jsp/menu.jsp"%> - - diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/head.jsp b/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/head.jsp deleted file mode 100644 index 35200828e..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/head.jsp +++ /dev/null @@ -1,9 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - - - - diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/include.jsp b/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/include.jsp deleted file mode 100644 index 8f1115e11..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/include.jsp +++ /dev/null @@ -1,3 +0,0 @@ -<%@ page session="false"%> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/menu.jsp b/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/menu.jsp deleted file mode 100644 index dc452990d..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/menu.jsp +++ /dev/null @@ -1 +0,0 @@ - diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/movie-list.jsp b/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/movie-list.jsp deleted file mode 100644 index 106613ae9..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/movie-list.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%@ include file="/jsp/include.jsp"%> -<%@ include file="/jsp/head.jsp"%> - -<c:out value="${model.actorName}" /> : IMDB powered by Neo4j - - -

- -

Kevin Bacon number:

-

Bacon path

- -

Movies

-
    - - - - -
  • in
  • -
    -
-
-<%@ include file="/jsp/menu.jsp"%> - - diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/movie.jsp b/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/movie.jsp deleted file mode 100644 index 13c4539ff..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/movie.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%@ include file="/jsp/include.jsp"%> -<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> -<%@ include file="/jsp/head.jsp"%> - -IMDB powered by Neo4j - - -

IMDB powered by Neo4j

- -
Find movie
-
-
-<%@ include file="/jsp/menu.jsp"%> - - diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/setup-message.jsp b/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/setup-message.jsp deleted file mode 100644 index e1be252c9..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/setup-message.jsp +++ /dev/null @@ -1,13 +0,0 @@ -<%@ include file="/jsp/include.jsp"%> -<%@ include file="/jsp/head.jsp"%> - -Setup : IMDB powered by Neo4j - - -

IMDB Setup

-

Result

-
-

-<%@ include file="/jsp/menu.jsp"%> - - diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/setup.jsp b/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/setup.jsp deleted file mode 100644 index 372668ddc..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/webapp/jsp/setup.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ include file="/jsp/include.jsp"%> -<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> -<%@ include file="/jsp/head.jsp"%> - -IMDB powered by Neo4j - - -

IMDB powered by Neo4j

- -
Inject data into the graph -
-
-<%@ include file="/jsp/menu.jsp"%> - - diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/menu.png b/spring-data-neo4j-examples/imdb/src/main/webapp/menu.png deleted file mode 100644 index 800b9e848..000000000 Binary files a/spring-data-neo4j-examples/imdb/src/main/webapp/menu.png and /dev/null differ diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/movie.png b/spring-data-neo4j-examples/imdb/src/main/webapp/movie.png deleted file mode 100644 index 64e7a3075..000000000 Binary files a/spring-data-neo4j-examples/imdb/src/main/webapp/movie.png and /dev/null differ diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/setup.png b/spring-data-neo4j-examples/imdb/src/main/webapp/setup.png deleted file mode 100644 index 22ff49571..000000000 Binary files a/spring-data-neo4j-examples/imdb/src/main/webapp/setup.png and /dev/null differ diff --git a/spring-data-neo4j-examples/imdb/src/main/webapp/style.css b/spring-data-neo4j-examples/imdb/src/main/webapp/style.css deleted file mode 100644 index 3e3320a72..000000000 --- a/spring-data-neo4j-examples/imdb/src/main/webapp/style.css +++ /dev/null @@ -1,118 +0,0 @@ -html { - font-size: 100% -} - -body { - color: #353535; - text-align: left; - font: 0.75em/1.5 sans-serif; - background: #fffdfb url(/imdb/bg.png) repeat-x; - margin-top: 4em; - margin-left: 8em; -} - -.inputField { - padding: 5px; - border: 0; - border-bottom: 1px solid #cccccc; - background: #FFFFFF url(/imdb/gradient.png) repeat-x; - font: normal 14px "trebuchet ms", helvetica, sans-serif; - color: #454743; -} - -.inputField:hover { - border-bottom: 1px solid #333; -} - -label { - font: 13px "trebuchet ms", helvetica, sans-serif; - color: #0c9b92; - margin-right: 0.5em; -} - -p { - color: #5f5f5f; -} - -a:link { - color: #0c9b92; -} - -a:visited { - color: #00a18a; -} - -a:hover { - -} - -h1 { - color: #006380; - padding-top: 0.5em; - line-height: 1.2; -} - -#menu { - clear: left; - padding-top: 1.5em; -} - -ul { - padding-left: 0; -} - -li { - color: #656565; - list-style-type: none; - background: url(/imdb/menu.png) no-repeat; - padding-left: 20px; - line-height: 20px; -} - -.actor { - background-image: url(/imdb/actor.png); -} - -.actors li,.movies li { - float: left; - width: 15em; - height: 7em; - background-color: #F8F8F8; - border: 1px solid #D6D6D6; - background-position: 6px 6px; - margin: 10px; - padding: 0.5em 0.5em 0.5em 30px; - overflow: hidden; -} - -li.actor em { - display: block; -} - -.movies a { - display: block; -} - -.movie { - background-image: url(/imdb/movie.png); -} - -.setup { - background-image: url(/imdb/setup.png); -} - -fieldset { - border: 1px solid #afafaf; - padding: 1em; -} - -legend { - font-weight: bold; - background-repeat: no-repeat; - background-position: 4px 0; - padding: 0 6px 0 24px; -} - -pre { - font-size: 1.5em; -} \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/site/apt/index.apt b/spring-data-neo4j-examples/imdb/src/site/apt/index.apt deleted file mode 100644 index ee2573fa7..000000000 --- a/spring-data-neo4j-examples/imdb/src/site/apt/index.apt +++ /dev/null @@ -1,28 +0,0 @@ -The Neo4j - Datastore Graph IMDB Example - - Imagine a number of actors, acting in Movies and thus forming a graph of relationships between Actors and Movies. The - Spring Datastore Graph project provides an annotation-based approach to map objects onto Neo4j. The current annotations - supported (still subject to change) are: - - * @NodeEntity - class annotation for POJOs backed by a graph node. - - * @RelationshipEntity - class annotation for POJOs containing relationship properties. - - * @GraphProperty - field annotation used to specify indexing. - - * @RelatedTo - for fields denoting relationships (either one-to-one or one-to-many). - - * @StartNode - the start node for a @GraphRelationship.. - - * @EndNode - the end node for a @GraphRelationship. - - In order to persist objects in Spring into Neo4j, simply do something like this (the full code is available over at the - {{{http://github.com/neo4j-examples/spring-datastore-graph-imdb} Spring Datastore Graph IMDB example}}: - -%{source-code|snippet=MovieClass|file=src/main/java/org/neo4j/examples/imdb/domain/Movie.java} - - and the Actor class, - -%{source-code|snippet=ActorClass|file=src/main/java/org/neo4j/examples/imdb/domain/Actor.java} - - This will produce something like {{{http://wiki.neo4j.org/images/5/53/Imdb.screenshot.actor.png} this graph}} \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/site/site.xml b/spring-data-neo4j-examples/imdb/src/site/site.xml deleted file mode 100644 index 0c01dac59..000000000 --- a/spring-data-neo4j-examples/imdb/src/site/site.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - ${project.name} - images/logos/logo-dark.png - http://neo4j.org/ - - - - - - - - - - - - - - - - - - - - ${skinGroupId} - ${skinArtifactId} - ${skinVersion} - - \ No newline at end of file diff --git a/spring-data-neo4j-examples/imdb/src/test/resources/icons/ACTS_IN.INCOMING.png b/spring-data-neo4j-examples/imdb/src/test/resources/icons/ACTS_IN.INCOMING.png deleted file mode 100644 index 64e7a3075..000000000 Binary files a/spring-data-neo4j-examples/imdb/src/test/resources/icons/ACTS_IN.INCOMING.png and /dev/null differ diff --git a/spring-data-neo4j-examples/imdb/src/test/resources/icons/ACTS_IN.OUTGOING.png b/spring-data-neo4j-examples/imdb/src/test/resources/icons/ACTS_IN.OUTGOING.png deleted file mode 100644 index 9d2d50081..000000000 Binary files a/spring-data-neo4j-examples/imdb/src/test/resources/icons/ACTS_IN.OUTGOING.png and /dev/null differ diff --git a/spring-data-neo4j-examples/imdb/src/test/resources/icons/IMDB.OUTGOING.png b/spring-data-neo4j-examples/imdb/src/test/resources/icons/IMDB.OUTGOING.png deleted file mode 100644 index a46fb2220..000000000 Binary files a/spring-data-neo4j-examples/imdb/src/test/resources/icons/IMDB.OUTGOING.png and /dev/null differ diff --git a/spring-data-neo4j-examples/imdb/src/test/resources/icons/PART_OF_NAME.OUTGOING.png b/spring-data-neo4j-examples/imdb/src/test/resources/icons/PART_OF_NAME.OUTGOING.png deleted file mode 100644 index d072d3cbe..000000000 Binary files a/spring-data-neo4j-examples/imdb/src/test/resources/icons/PART_OF_NAME.OUTGOING.png and /dev/null differ diff --git a/spring-data-neo4j-examples/imdb/src/test/resources/icons/PART_OF_TITLE.OUTGOING.png b/spring-data-neo4j-examples/imdb/src/test/resources/icons/PART_OF_TITLE.OUTGOING.png deleted file mode 100644 index d072d3cbe..000000000 Binary files a/spring-data-neo4j-examples/imdb/src/test/resources/icons/PART_OF_TITLE.OUTGOING.png and /dev/null differ diff --git a/spring-data-neo4j-examples/myrestaurants-original/pom.xml b/spring-data-neo4j-examples/myrestaurants-original/pom.xml index bb443d6b5..6e08ffcb5 100644 --- a/spring-data-neo4j-examples/myrestaurants-original/pom.xml +++ b/spring-data-neo4j-examples/myrestaurants-original/pom.xml @@ -4,14 +4,14 @@ com.springone.myrestaurants myrestaurants-original war - 0.1.0.BUILD-SNAPSHOT + 3.2.1.RELEASE myrestaurants-original - 3.0.4.RELEASE - 1.6.10.M1 - 1.6.1 + 4.0.7.RELEASE + 1.8.4 + 1.7.10 UTF-8 - 3.0.2.RELEASE + 3.2.5.RELEASE @@ -374,7 +374,7 @@ org.apache.maven.plugins maven-war-plugin - 2.1-beta-1 + 2.1.1 diff --git a/spring-data-neo4j-examples/myrestaurants-original/src/main/resources/META-INF/spring/applicationContext-security.xml b/spring-data-neo4j-examples/myrestaurants-original/src/main/resources/META-INF/spring/applicationContext-security.xml index 54e54fd11..be1274815 100644 --- a/spring-data-neo4j-examples/myrestaurants-original/src/main/resources/META-INF/spring/applicationContext-security.xml +++ b/spring-data-neo4j-examples/myrestaurants-original/src/main/resources/META-INF/spring/applicationContext-security.xml @@ -3,8 +3,8 @@ + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"> diff --git a/spring-data-neo4j-examples/myrestaurants-social/pom.xml b/spring-data-neo4j-examples/myrestaurants-social/pom.xml index a6b1cbc5d..4c31b456c 100644 --- a/spring-data-neo4j-examples/myrestaurants-social/pom.xml +++ b/spring-data-neo4j-examples/myrestaurants-social/pom.xml @@ -4,16 +4,16 @@ com.springone.myrestaurants myrestaurants-social war - 2.2.0.BUILD-SNAPSHOT + 3.2.1.RELEASE myrestaurants-social - 3.1.0.RELEASE + 4.0.7.RELEASE ${project.version} - 1.6.12 - 1.6.1 - 1.8.1 + 1.8.4 + 1.7.10 + 2.1.6 UTF-8 - 3.1.0.RELEASE + 3.2.5.RELEASE @@ -418,7 +418,7 @@ org.apache.maven.plugins maven-war-plugin - 2.1-beta-1 + 2.1.1 diff --git a/spring-data-neo4j-examples/myrestaurants-social/src/main/java/com/springone/myrestaurants/domain/TopRatedRestaurantFinder.java b/spring-data-neo4j-examples/myrestaurants-social/src/main/java/com/springone/myrestaurants/domain/TopRatedRestaurantFinder.java index 77b59924e..fbb24eb7c 100644 --- a/spring-data-neo4j-examples/myrestaurants-social/src/main/java/com/springone/myrestaurants/domain/TopRatedRestaurantFinder.java +++ b/spring-data-neo4j-examples/myrestaurants-social/src/main/java/com/springone/myrestaurants/domain/TopRatedRestaurantFinder.java @@ -5,7 +5,6 @@ import org.neo4j.graphdb.traversal.*; import org.neo4j.graphdb.traversal.Traverser; import org.neo4j.helpers.Predicate; import org.neo4j.kernel.Traversal; -import org.neo4j.kernel.impl.traversal.TraversalDescriptionImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Configurable; import org.springframework.data.neo4j.support.Neo4jTemplate; @@ -26,7 +25,7 @@ public class TopRatedRestaurantFinder { public Collection getTopNRatedRestaurants(final UserAccount user, final int n) { final CalculateRatingPredicate calculateRatingPredicate = new CalculateRatingPredicate(); final Node userNode=user.getPersistentState(); - final TraversalDescription traversalDescription = new TraversalDescriptionImpl() + final TraversalDescription traversalDescription = Traversal.description() .order(Traversal.postorderBreadthFirst()) .evaluator(Evaluators.toDepth(MAXIMUM_DEPTH)) .evaluator(calculateRatingPredicate) diff --git a/spring-data-neo4j-examples/myrestaurants-social/src/main/java/com/springone/myrestaurants/domain/TopRatedRestaurantTraverser.java b/spring-data-neo4j-examples/myrestaurants-social/src/main/java/com/springone/myrestaurants/domain/TopRatedRestaurantTraverser.java index 2709545ad..d33beeeb7 100644 --- a/spring-data-neo4j-examples/myrestaurants-social/src/main/java/com/springone/myrestaurants/domain/TopRatedRestaurantTraverser.java +++ b/spring-data-neo4j-examples/myrestaurants-social/src/main/java/com/springone/myrestaurants/domain/TopRatedRestaurantTraverser.java @@ -3,7 +3,7 @@ package com.springone.myrestaurants.domain; import org.neo4j.graphdb.DynamicRelationshipType; import org.neo4j.graphdb.PathExpander; import org.neo4j.graphdb.traversal.*; -import org.neo4j.kernel.impl.traversal.TraversalDescriptionImpl; +import org.neo4j.kernel.Traversal; import org.springframework.data.neo4j.core.FieldTraversalDescriptionBuilder; import org.springframework.data.neo4j.mapping.Neo4jPersistentProperty; @@ -16,7 +16,7 @@ import org.springframework.data.neo4j.mapping.Neo4jPersistentProperty; class TopRatedRestaurantTraverser implements FieldTraversalDescriptionBuilder { @Override public TraversalDescription build(Object start, Neo4jPersistentProperty field, String... params) { - return new TraversalDescriptionImpl() + return Traversal.description() .breadthFirst() .relationships(DynamicRelationshipType.withName("friends")) .order(new BranchOrderingPolicy() { diff --git a/spring-data-neo4j-examples/myrestaurants-social/src/main/resources/META-INF/spring/applicationContext-security.xml b/spring-data-neo4j-examples/myrestaurants-social/src/main/resources/META-INF/spring/applicationContext-security.xml index 54e54fd11..9e6cd0d5e 100644 --- a/spring-data-neo4j-examples/myrestaurants-social/src/main/resources/META-INF/spring/applicationContext-security.xml +++ b/spring-data-neo4j-examples/myrestaurants-social/src/main/resources/META-INF/spring/applicationContext-security.xml @@ -3,8 +3,8 @@ + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"> @@ -34,4 +34,4 @@ - \ No newline at end of file + diff --git a/spring-data-neo4j-examples/myrestaurants-social/src/main/resources/META-INF/spring/applicationContext.xml b/spring-data-neo4j-examples/myrestaurants-social/src/main/resources/META-INF/spring/applicationContext.xml index 998ab237c..e86903056 100644 --- a/spring-data-neo4j-examples/myrestaurants-social/src/main/resources/META-INF/spring/applicationContext.xml +++ b/spring-data-neo4j-examples/myrestaurants-social/src/main/resources/META-INF/spring/applicationContext.xml @@ -73,7 +73,7 @@ - + diff --git a/spring-data-neo4j-examples/myrestaurants-social/src/test/java/com/springdeveloper/data/neo/PrintNeo4j.java b/spring-data-neo4j-examples/myrestaurants-social/src/test/java/com/springdeveloper/data/neo/PrintNeo4j.java deleted file mode 100644 index a26836a0e..000000000 --- a/spring-data-neo4j-examples/myrestaurants-social/src/test/java/com/springdeveloper/data/neo/PrintNeo4j.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.springdeveloper.data.neo; - -import org.neo4j.graphdb.GraphDatabaseService; -import org.neo4j.graphdb.Node; -import org.neo4j.graphdb.Relationship; -import org.neo4j.graphdb.RelationshipType; -import org.neo4j.graphdb.Transaction; -import org.neo4j.kernel.EmbeddedGraphDatabase; - - -public class PrintNeo4j { - - public static void main(String[] args) { - System.out.println("Hello Neo4j!"); -// GraphDatabaseService graphDb = new EmbeddedGraphDatabase( "target/data/test" ); - GraphDatabaseService graphDb = new EmbeddedGraphDatabase( "/Users/trisberg/neo4j/imdb" ); - Transaction tx = graphDb.beginTx(); - - tx = graphDb.beginTx(); - try { - for (Node n : graphDb.getAllNodes()) { - System.out.print("=> " + n.getId() + " :: "); - for (String s : n.getPropertyKeys()) { - System.out.print(" : " + s + " = " + n.getProperty(s)); - } - for (Relationship r : n.getRelationships()) { - long start = r.getStartNode().getId(); - long end = r.getEndNode().getId(); - if (n.getId() == start) { - System.out.print(" ** " + r.getType().name() + "--> " + end); - - } - if (n.getId() == end) { - System.out.print(" ** " + start + " <--" + r.getType().name()); - - } - for (String s : r.getPropertyKeys()) { - System.out.print(" :: " + s + " = " + r.getProperty(s)); - } - } - System.out.println("!"); - } - tx.success(); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - finally { - tx.close(); - } - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - graphDb.shutdown(); - System.out.println("Done!"); - } - -} diff --git a/spring-data-neo4j-examples/todos/pom.xml b/spring-data-neo4j-examples/todos/pom.xml index 58b899059..e20f09c06 100644 --- a/spring-data-neo4j-examples/todos/pom.xml +++ b/spring-data-neo4j-examples/todos/pom.xml @@ -4,18 +4,18 @@ org.neo4j.app sdn-todos - 2.2.0.BUILD-SNAPSHOT + 3.2.1.RELEASE jar sdn-todos UTF-8 - 1.8.1 - 3.1.0.RELEASE + 2.1.6 + 4.0.7.RELEASE ${project.version} - 1.6.12 - 1.6.1 + 1.8.4 + 1.7.10 diff --git a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/lifecycle/AuditingEventListenerUnitTests.java b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/lifecycle/AuditingEventListenerUnitTests.java index 2de729d85..d1a151106 100644 --- a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/lifecycle/AuditingEventListenerUnitTests.java +++ b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/lifecycle/AuditingEventListenerUnitTests.java @@ -30,6 +30,8 @@ import org.springframework.data.neo4j.annotation.NodeEntity; import org.springframework.data.neo4j.support.mapping.Neo4jMappingContext; import org.springframework.data.support.IsNewStrategyFactory; +import java.util.Collections; + /** * Unit tests for {@link AuditingEventListener}. * @@ -46,7 +48,7 @@ public class AuditingEventListenerUnitTests { @Before public void setUp() { - handler = spy(new IsNewAwareAuditingHandler(new Neo4jMappingContext())); + handler = spy(new IsNewAwareAuditingHandler(createContext())); listener = new AuditingEventListener(new ObjectFactory() { @Override @@ -56,6 +58,13 @@ public class AuditingEventListenerUnitTests { }); } + protected Neo4jMappingContext createContext() { + Neo4jMappingContext mappingContext = new Neo4jMappingContext(); + mappingContext.setInitialEntitySet(Collections.singleton(Sample.class)); + mappingContext.afterPropertiesSet(); + return mappingContext; + } + @Test(expected = IllegalArgumentException.class) public void rejectsNullAuditingHandler() { new AuditingEventListener(null);