updated and fixed examples, cypher is now optional in execution as well
This commit is contained in:
4
pom.xml
4
pom.xml
@@ -15,6 +15,10 @@
|
||||
<module>spring-data-neo4j-rest</module>
|
||||
<module>spring-data-neo4j-aspects</module>
|
||||
<module>spring-data-neo4j-cross-store</module>
|
||||
<module>spring-data-neo4j-examples/hello-worlds</module>
|
||||
<module>spring-data-neo4j-examples/imdb</module>
|
||||
<module>spring-data-neo4j-examples/cineasts</module>
|
||||
<module>spring-data-neo4j-examples/myrestaurants-social</module>
|
||||
</modules>
|
||||
<url>http://www.springsource.org/spring-data/neo4j</url>
|
||||
<organization>
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.version>3.0.5.RELEASE</spring.version>
|
||||
<spring.version>3.0.6.RELEASE</spring.version>
|
||||
<slf4j.version>1.6.1</slf4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<neo4j.version>1.4.1</neo4j.version>
|
||||
<neo4j.version>1.5-SNAPSHOT</neo4j.version>
|
||||
<spring-data-graph.version>2.0.0.BUILD-SNAPSHOT</spring-data-graph.version>
|
||||
<aspectj.version>1.6.12.M1</aspectj.version>
|
||||
<org.slf4j-version>1.6.1</org.slf4j-version>
|
||||
@@ -159,7 +159,7 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-neo4j</artifactId>
|
||||
<artifactId>spring-data-neo4j-aspects</artifactId>
|
||||
<version>${spring-data-graph.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@@ -312,7 +312,7 @@
|
||||
</aspectLibrary>
|
||||
<aspectLibrary>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-neo4j</artifactId>
|
||||
<artifactId>spring-data-neo4j-aspects</artifactId>
|
||||
</aspectLibrary>
|
||||
</aspectLibraries>
|
||||
<source>1.6</source>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.version>3.0.5.RELEASE</spring.version>
|
||||
<spring.version>3.0.6.RELEASE</spring.version>
|
||||
<aspectj.version>1.6.12.M1</aspectj.version>
|
||||
<slf4j.version>1.6.1</slf4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -78,7 +78,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-neo4j</artifactId>
|
||||
<artifactId>spring-data-neo4j-aspects</artifactId>
|
||||
<version>${spring-data-neo4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -115,7 +115,7 @@
|
||||
</aspectLibrary>
|
||||
<aspectLibrary>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-neo4j</artifactId>
|
||||
<artifactId>spring-data-neo4j-aspects</artifactId>
|
||||
</aspectLibrary>
|
||||
</aspectLibraries>
|
||||
<source>1.6</source>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<version>2.0.0-BUILD-SNAPSHOT</version>
|
||||
<name>imdb</name>
|
||||
<properties>
|
||||
<spring.version>3.0.5.RELEASE</spring.version>
|
||||
<spring.version>3.0.6.RELEASE</spring.version>
|
||||
<aspectj.version>1.6.12.M1</aspectj.version>
|
||||
<slf4j.version>1.6.1</slf4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -146,7 +146,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-neo4j</artifactId>
|
||||
<artifactId>spring-data-neo4j-aspects</artifactId>
|
||||
<version>${data-graph.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -407,7 +407,7 @@
|
||||
</aspectLibrary>
|
||||
<aspectLibrary>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-neo4j</artifactId>
|
||||
<artifactId>spring-data-neo4j-aspects</artifactId>
|
||||
</aspectLibrary>
|
||||
</aspectLibraries>
|
||||
<source>1.6</source>
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<version>2.0.0.BUILD-SNAPSHOT</version>
|
||||
<name>myrestaurants-social</name>
|
||||
<properties>
|
||||
<spring.version>3.0.5.RELEASE</spring.version>
|
||||
<spring.version>3.0.6.RELEASE</spring.version>
|
||||
<spring-data-graph.version>2.0.0.BUILD-SNAPSHOT</spring-data-graph.version>
|
||||
<aspectj.version>1.6.12.M1</aspectj.version>
|
||||
<slf4j.version>1.6.1</slf4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring-security.version>3.0.2.RELEASE</spring-security.version>
|
||||
<spring-security.version>3.0.6.RELEASE</spring-security.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
@@ -384,7 +384,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-neo4j</artifactId>
|
||||
<artifactId>spring-data-neo4j-cross-store</artifactId>
|
||||
<version>${spring-data-graph.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -441,7 +441,7 @@
|
||||
</aspectLibrary>
|
||||
<aspectLibrary>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-neo4j</artifactId>
|
||||
<artifactId>spring-data-neo4j-aspects</artifactId>
|
||||
</aspectLibrary>
|
||||
</aspectLibraries>
|
||||
<source>1.6</source>
|
||||
|
||||
@@ -7,10 +7,7 @@ import org.neo4j.graphdb.traversal.TraversalBranch;
|
||||
import org.neo4j.graphdb.traversal.TraversalDescription;
|
||||
import org.neo4j.kernel.impl.traversal.TraversalDescriptionImpl;
|
||||
import org.springframework.data.neo4j.core.FieldTraversalDescriptionBuilder;
|
||||
import org.springframework.data.neo4j.core.NodeBacked;
|
||||
import org.springframework.data.neo4j.mapping.Neo4JPersistentProperty;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import org.springframework.data.neo4j.mapping.Neo4jPersistentProperty;
|
||||
|
||||
/**
|
||||
* @author Michael Hunger
|
||||
@@ -20,7 +17,7 @@ import java.lang.reflect.Field;
|
||||
*/
|
||||
class TopRatedRestaurantTraverser implements FieldTraversalDescriptionBuilder {
|
||||
@Override
|
||||
public TraversalDescription build(NodeBacked start, Neo4JPersistentProperty field, String... params) {
|
||||
public TraversalDescription build(Object start, Neo4jPersistentProperty field, String... params) {
|
||||
return new TraversalDescriptionImpl()
|
||||
.breadthFirst()
|
||||
.relationships(DynamicRelationshipType.withName("friends"))
|
||||
|
||||
@@ -16,8 +16,10 @@
|
||||
|
||||
package org.springframework.data.neo4j.support.query;
|
||||
|
||||
import org.springframework.data.neo4j.conversion.QueryResult;
|
||||
import org.springframework.data.neo4j.support.GraphDatabaseContext;
|
||||
import org.springframework.data.neo4j.support.conversion.EntityResultConverter;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
@@ -28,11 +30,20 @@ import java.util.Map;
|
||||
* todo limits
|
||||
*/
|
||||
public class CypherQueryExecutor implements QueryOperations<Map<String,Object>> {
|
||||
private final CypherQueryEngine queryEngine;
|
||||
private final QueryEngine<Map<String,Object>> queryEngine;
|
||||
|
||||
public CypherQueryExecutor(GraphDatabaseContext ctx) {
|
||||
EntityResultConverter converter = new EntityResultConverter(ctx);
|
||||
queryEngine = new CypherQueryEngine(ctx.getGraphDatabaseService(), converter);
|
||||
if (ClassUtils.isPresent("org.neo4j.cypher.javacompat.ExecutionEngine",getClass().getClassLoader())) {
|
||||
queryEngine = new CypherQueryEngine(ctx.getGraphDatabaseService(), converter);
|
||||
} else {
|
||||
queryEngine = new QueryEngine<Map<String, Object>>() {
|
||||
@Override
|
||||
public QueryResult<Map<String, Object>> query(String statement, Map<String, Object> params) {
|
||||
throw new IllegalStateException("Cypher is not available, please add it to your dependencies to execute: "+statement);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public Iterable<Map<String, Object>> queryForList(String statement, Map<String,Object> params) {
|
||||
|
||||
Reference in New Issue
Block a user