diff --git a/spring-data-neo4j-parent/pom.xml b/spring-data-neo4j-parent/pom.xml index c46f6721c..29c368ffc 100644 --- a/spring-data-neo4j-parent/pom.xml +++ b/spring-data-neo4j-parent/pom.xml @@ -492,11 +492,56 @@ + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + + org.apache.maven.plugins + maven-surefire-plugin + 2.6 + + + org.apache.maven.plugins + maven-jar-plugin + 2.3.1 + + + org.apache.maven.plugins + maven-source-plugin + 2.0.4 + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + + com.mycila.maven-license-plugin + maven-license-plugin + 1.9.0 + + + com.springsource.bundlor + com.springsource.bundlor.maven + 1.0.0.RELEASE + + + org.codehaus.mojo + aspectj-maven-plugin + 1.2 + + + + org.apache.maven.plugins maven-compiler-plugin - 2.3.2 1.6 1.6 @@ -508,7 +553,6 @@ org.apache.maven.plugins maven-surefire-plugin - 2.6 once @@ -527,7 +571,6 @@ org.apache.maven.plugins maven-jar-plugin - 2.3.1 true @@ -535,7 +578,6 @@ org.apache.maven.plugins maven-source-plugin - 2.0.4 attach-sources @@ -549,7 +591,6 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.8 javadoc @@ -563,7 +604,6 @@ com.mycila.maven-license-plugin maven-license-plugin - 1.9.0 check-licenses @@ -609,7 +649,6 @@ com.springsource.bundlor com.springsource.bundlor.maven - 1.0.0.RELEASE true diff --git a/spring-data-neo4j-rest/pom.xml b/spring-data-neo4j-rest/pom.xml index 9039c7203..14a8b7d96 100644 --- a/spring-data-neo4j-rest/pom.xml +++ b/spring-data-neo4j-rest/pom.xml @@ -83,6 +83,11 @@ ${neo4j.version} test + + org.slf4j + log4j-over-slf4j + + org.neo4j neo4j diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/repository/query/MatchClause.java b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/repository/query/MatchClause.java index 201121d18..770c96ccd 100644 --- a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/repository/query/MatchClause.java +++ b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/repository/query/MatchClause.java @@ -16,10 +16,10 @@ package org.springframework.data.neo4j.repository.query; +import org.springframework.data.mapping.PropertyPath; import org.springframework.data.neo4j.mapping.Neo4jMappingContext; import org.springframework.data.neo4j.mapping.Neo4jPersistentProperty; import org.springframework.data.neo4j.mapping.RelationshipInfo; -import org.springframework.data.repository.query.parser.Property; import org.springframework.util.Assert; import org.springframework.util.StringUtils; @@ -33,18 +33,18 @@ class MatchClause { private final Iterable properties; /** - * Creates a new {@link MatchClause} using the given {@link org.springframework.data.neo4j.mapping.Neo4jMappingContext} and {@link Property}. + * Creates a new {@link MatchClause} using the given + * {@link org.springframework.data.neo4j.mapping.Neo4jMappingContext} and {@link PropertyPath}. * * @param context must not be {@literal null}. * @param property must not be {@literal null}. */ - public MatchClause(Neo4jMappingContext context, Property property) { + public MatchClause(Neo4jMappingContext context, PropertyPath property) { Assert.notNull(context); Assert.notNull(property); - Class rootType = property.getOwningType().getType(); - this.properties = context.getPersistentPropertyPath(rootType, property.toDotPath()); + this.properties = context.getPersistentPropertyPath(property); } /* @@ -65,9 +65,10 @@ class MatchClause { RelationshipInfo info = property.getRelationshipInfo(); Class ownerType = property.getOwner().getType(); - intermediate = intermediate == null ? asVariableReference(StringUtils.uncapitalize(ownerType.getSimpleName())) - : intermediate; - intermediate = String.format(getPattern(info), intermediate, info.getType(), asVariableReference(property.getName())); + intermediate = intermediate == null ? asVariableReference(StringUtils.uncapitalize(ownerType + .getSimpleName())) : intermediate; + intermediate = String.format(getPattern(info), intermediate, info.getType(), + asVariableReference(property.getName())); } return intermediate.toString(); diff --git a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/query/MatchClauseUnitTest.java b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/query/MatchClauseUnitTest.java index 0f495c763..184586818 100644 --- a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/query/MatchClauseUnitTest.java +++ b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/query/MatchClauseUnitTest.java @@ -25,11 +25,11 @@ import java.util.Set; import org.junit.Before; import org.junit.Test; import org.neo4j.graphdb.Direction; +import org.springframework.data.mapping.PropertyPath; 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.mapping.Neo4jMappingContext; -import org.springframework.data.repository.query.parser.Property; /** * @@ -37,52 +37,52 @@ import org.springframework.data.repository.query.parser.Property; */ public class MatchClauseUnitTest { - Neo4jMappingContext context; + Neo4jMappingContext context; - @Before - public void setUp() { - context = new Neo4jMappingContext(); - context.setInitialEntitySet(Collections.singleton(Person.class)); - context.afterPropertiesSet(); - } + @Before + public void setUp() { + context = new Neo4jMappingContext(); + context.setInitialEntitySet(Collections.singleton(Person.class)); + context.afterPropertiesSet(); + } - @Test - public void buildsMatchExpressionForSimpleTraversalCorrectly() { + @Test + public void buildsMatchExpressionForSimpleTraversalCorrectly() { - MatchClause clause = new MatchClause(context, Property.from("group", Person.class)); - assertThat(clause.toString(), is("(person)<-[:members]-(group)")); - } + MatchClause clause = new MatchClause(context, PropertyPath.from("group", Person.class)); + assertThat(clause.toString(), is("(person)<-[:members]-(group)")); + } - @Test - public void createsMatchClassForDeepTraversal() { + @Test + public void createsMatchClassForDeepTraversal() { - MatchClause clause = new MatchClause(context, Property.from("group.members.age", Person.class)); - assertThat(clause.toString(), is("(person)<-[:members]-(group)-[:members]->(members)")); - } + MatchClause clause = new MatchClause(context, PropertyPath.from("group.members.age", Person.class)); + assertThat(clause.toString(), is("(person)<-[:members]-(group)-[:members]->(members)")); + } - @Test - public void stopsAtNonRelationShipProperty() { + @Test + public void stopsAtNonRelationShipPropertyPath() { - MatchClause clause = new MatchClause(context, Property.from("group.name", Person.class)); - assertThat(clause.toString(), is("(person)<-[:members]-(group)")); - } - - @NodeEntity - class Person { - - private int age; - - @RelatedTo(type = "members", direction = Direction.INCOMING) - private Group group; - } + MatchClause clause = new MatchClause(context, PropertyPath.from("group.name", Person.class)); + assertThat(clause.toString(), is("(person)<-[:members]-(group)")); + } @NodeEntity - class Group { + class Person { - @Indexed - private String name; + private int age; - @RelatedTo(type = "members", direction = Direction.OUTGOING) - private Set members; - } + @RelatedTo(type = "members", direction = Direction.INCOMING) + private Group group; + } + + @NodeEntity + class Group { + + @Indexed + private String name; + + @RelatedTo(type = "members", direction = Direction.OUTGOING) + private Set members; + } }