cyclic dependencies and remove dependency on DirectGraphRepositoryFactory in TraversalFieldAccessor

This commit is contained in:
Michael Hunger
2011-04-12 15:19:34 +02:00
parent 3f9008153d
commit 9d4eab6e77
38 changed files with 62 additions and 90 deletions

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.graph.neo4j.support.path;
package org.springframework.data.graph.core;
import org.neo4j.graphdb.Path;
import org.springframework.data.graph.core.GraphBacked;

View File

@@ -19,7 +19,6 @@ package org.springframework.data.graph.core;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.traversal.TraversalDescription;
import org.springframework.data.graph.neo4j.support.path.EntityPath;
/**
* Interface introduced to objects annotated with @NodeEntity by the {@link org.springframework.data.graph.neo4j.support.node.Neo4jNodeBacking} aspect.

View File

@@ -33,10 +33,10 @@ import org.springframework.data.graph.core.RelationshipBacked;
import org.springframework.data.graph.neo4j.fieldaccess.Neo4jConversionServiceFactoryBean;
import org.springframework.data.graph.neo4j.fieldaccess.NodeDelegatingFieldAccessorFactory;
import org.springframework.data.graph.neo4j.repository.DirectGraphRepositoryFactory;
import org.springframework.data.graph.neo4j.state.NodeEntityStateFactory;
import org.springframework.data.graph.neo4j.state.RelationshipEntityStateFactory;
import org.springframework.data.graph.neo4j.support.node.NodeEntityStateFactory;
import org.springframework.data.graph.neo4j.support.relationship.RelationshipEntityStateFactory;
import org.springframework.data.graph.neo4j.support.GraphDatabaseContext;
import org.springframework.data.graph.neo4j.support.TypeRepresentationStrategyFactory;
import org.springframework.data.graph.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory;
import org.springframework.data.graph.neo4j.support.node.Neo4jNodeBacking;
import org.springframework.data.graph.neo4j.support.node.NodeEntityInstantiator;
import org.springframework.data.graph.neo4j.support.node.PartialNodeEntityInstantiator;
@@ -168,9 +168,8 @@ public class Neo4jConfiguration {
NodeEntityStateFactory entityStateFactory = new NodeEntityStateFactory();
entityStateFactory.setGraphDatabaseContext(graphDatabaseContext);
entityStateFactory.setGraphRepositoryFactory(graphRepositoryFactory);
entityStateFactory.setEntityManagerFactory(entityManagerFactory);
final NodeDelegatingFieldAccessorFactory nodeDelegatingFieldAccessorFactory = new NodeDelegatingFieldAccessorFactory(graphDatabaseContext, graphRepositoryFactory);
final NodeDelegatingFieldAccessorFactory nodeDelegatingFieldAccessorFactory = new NodeDelegatingFieldAccessorFactory(graphDatabaseContext);
entityStateFactory.setNodeDelegatingFieldAccessorFactory(nodeDelegatingFieldAccessorFactory);
return entityStateFactory;
}

View File

@@ -20,7 +20,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.data.graph.annotation.NodeEntity;
import org.springframework.data.graph.annotation.RelationshipEntity;
import org.springframework.data.graph.neo4j.repository.DirectGraphRepositoryFactory;
import org.springframework.data.graph.neo4j.support.GraphDatabaseContext;
import org.springframework.util.ReflectionUtils;
@@ -34,15 +33,12 @@ public abstract class DelegatingFieldAccessorFactory<T> implements FieldAccessor
protected final GraphDatabaseContext graphDatabaseContext;
protected final DirectGraphRepositoryFactory graphRepositoryFactory;
protected abstract Collection<FieldAccessorListenerFactory<?>> createListenerFactories();
protected abstract Collection<? extends FieldAccessorFactory<?>> createAccessorFactories();
public DelegatingFieldAccessorFactory(final GraphDatabaseContext graphDatabaseContext, final DirectGraphRepositoryFactory graphRepositoryFactory) {
public DelegatingFieldAccessorFactory(final GraphDatabaseContext graphDatabaseContext) {
this.graphDatabaseContext = graphDatabaseContext;
this.graphRepositoryFactory = graphRepositoryFactory;
this.fieldAccessorFactories.addAll(createAccessorFactories());
this.fieldAccessorListenerFactories.addAll(createListenerFactories());
}

View File

@@ -17,7 +17,6 @@
package org.springframework.data.graph.neo4j.fieldaccess;
import org.springframework.data.graph.core.NodeBacked;
import org.springframework.data.graph.neo4j.repository.DirectGraphRepositoryFactory;
import org.springframework.data.graph.neo4j.support.GraphDatabaseContext;
import java.util.Arrays;
@@ -29,8 +28,8 @@ import java.util.Collection;
*/
public class NodeDelegatingFieldAccessorFactory extends DelegatingFieldAccessorFactory<NodeBacked> {
public NodeDelegatingFieldAccessorFactory(GraphDatabaseContext graphDatabaseContext, DirectGraphRepositoryFactory graphRepositoryFactory) {
super(graphDatabaseContext, graphRepositoryFactory);
public NodeDelegatingFieldAccessorFactory(GraphDatabaseContext graphDatabaseContext) {
super(graphDatabaseContext);
}
@Override
@@ -54,7 +53,7 @@ public class NodeDelegatingFieldAccessorFactory extends DelegatingFieldAccessorF
new SingleRelationshipFieldAccessorFactory(graphDatabaseContext),
new OneToNRelationshipFieldAccessorFactory(graphDatabaseContext),
new ReadOnlyOneToNRelationshipFieldAccessorFactory(graphDatabaseContext),
new TraversalFieldAccessorFactory(graphRepositoryFactory),
new TraversalFieldAccessorFactory(),
new OneToNRelationshipEntityFieldAccessorFactory(graphDatabaseContext)
);
}

View File

@@ -22,7 +22,6 @@ import org.springframework.data.graph.annotation.GraphTraversal;
import org.springframework.data.graph.core.FieldTraversalDescriptionBuilder;
import org.springframework.data.graph.core.NodeBacked;
import org.springframework.data.graph.neo4j.repository.DirectGraphRepositoryFactory;
import org.springframework.data.graph.neo4j.repository.GraphRepository;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
@@ -30,16 +29,6 @@ import java.lang.reflect.Field;
import static org.springframework.data.graph.neo4j.support.DoReturn.doReturn;
public class TraversalFieldAccessorFactory implements FieldAccessorFactory<NodeBacked> {
private DirectGraphRepositoryFactory graphRepositoryFactory;
public TraversalFieldAccessorFactory(DirectGraphRepositoryFactory graphRepositoryFactory) {
super();
this.graphRepositoryFactory = graphRepositoryFactory;
}
@Override
public boolean accept(final Field f) {
final GraphTraversal graphEntityTraversal = f.getAnnotation(GraphTraversal.class);
@@ -51,7 +40,7 @@ public class TraversalFieldAccessorFactory implements FieldAccessorFactory<NodeB
@Override
public FieldAccessor<NodeBacked> forField(final Field field) {
return new TraversalFieldAccessor(field, graphRepositoryFactory);
return new TraversalFieldAccessor(field);
}
/**
@@ -60,14 +49,12 @@ public class TraversalFieldAccessorFactory implements FieldAccessorFactory<NodeB
*/
public static class TraversalFieldAccessor implements FieldAccessor<NodeBacked> {
protected final Field field;
private final DirectGraphRepositoryFactory graphRepositoryFactory;
private final FieldTraversalDescriptionBuilder fieldTraversalDescriptionBuilder;
private Class<? extends NodeBacked> target;
protected String[] params;
public TraversalFieldAccessor(final Field field, DirectGraphRepositoryFactory graphRepositoryFactory) {
public TraversalFieldAccessor(final Field field) {
this.field = field;
this.graphRepositoryFactory = graphRepositoryFactory;
final GraphTraversal graphEntityTraversal = field.getAnnotation(GraphTraversal.class);
this.target = graphEntityTraversal.elementClass();
this.params = graphEntityTraversal.params();
@@ -86,9 +73,8 @@ public class TraversalFieldAccessorFactory implements FieldAccessorFactory<NodeB
@Override
public Object getValue(final NodeBacked nodeBacked) {
final GraphRepository<? extends NodeBacked> finder = graphRepositoryFactory.createGraphRepository(target);
final TraversalDescription traversalDescription = fieldTraversalDescriptionBuilder.build(nodeBacked,field,params);
return doReturn(finder.findAllByTraversal(nodeBacked, traversalDescription));
return doReturn(nodeBacked.findAllByTraversal((Class<? extends NodeBacked>) target, traversalDescription));
}

View File

@@ -18,9 +18,9 @@ package org.springframework.data.graph.neo4j.support.node;
import org.neo4j.graphdb.Path;
import org.neo4j.helpers.collection.IterableWrapper;
import org.springframework.data.graph.core.EntityPath;
import org.springframework.data.graph.core.NodeBacked;
import org.springframework.data.graph.neo4j.support.path.ConvertingEntityPath;
import org.springframework.data.graph.neo4j.support.path.EntityPath;
import org.springframework.data.graph.neo4j.support.GraphDatabaseContext;
/**

View File

@@ -28,9 +28,8 @@ import org.neo4j.graphdb.traversal.Traverser;
import org.springframework.data.graph.core.GraphBacked;
import org.springframework.data.graph.core.NodeBacked;
import org.springframework.data.graph.core.RelationshipBacked;
import org.springframework.data.graph.neo4j.state.NodeEntityStateFactory;
import org.springframework.data.graph.neo4j.support.DoReturn;
import org.springframework.data.graph.neo4j.support.path.EntityPath;
import org.springframework.data.graph.core.EntityPath;
import org.springframework.data.graph.core.EntityState;
import org.springframework.data.graph.neo4j.support.GraphDatabaseContext;
@@ -45,7 +44,7 @@ import static org.springframework.data.graph.neo4j.support.DoReturn.unwrap;
/**
* Aspect for handling node entity creation and field access (read & write)
* puts the underlying state (Node) into and delegates field access to an {@link org.springframework.data.graph.core.EntityState} instance,
* created by a configured {@link org.springframework.data.graph.neo4j.state.NodeEntityStateFactory}.
* created by a configured {@link NodeEntityStateFactory}.
*
* Handles constructor invocation and partial entities as well.
*/

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.graph.neo4j.state;
package org.springframework.data.graph.neo4j.support.node;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.NotInTransactionException;

View File

@@ -14,15 +14,14 @@
* limitations under the License.
*/
package org.springframework.data.graph.neo4j.state;
package org.springframework.data.graph.neo4j.support.node;
import org.neo4j.graphdb.Node;
import org.springframework.data.graph.annotation.NodeEntity;
import org.springframework.data.graph.core.EntityState;
import org.springframework.data.graph.core.NodeBacked;
import org.springframework.data.graph.neo4j.fieldaccess.DetachedEntityState;
import org.springframework.data.graph.neo4j.fieldaccess.NodeDelegatingFieldAccessorFactory;
import org.springframework.data.graph.neo4j.repository.DirectGraphRepositoryFactory;
import org.springframework.data.graph.core.EntityState;
import org.springframework.data.graph.neo4j.support.GraphDatabaseContext;
import javax.annotation.PostConstruct;
@@ -33,8 +32,6 @@ public class NodeEntityStateFactory {
private GraphDatabaseContext graphDatabaseContext;
private DirectGraphRepositoryFactory graphRepositoryFactory;
private EntityManagerFactory entityManagerFactory;
private NodeDelegatingFieldAccessorFactory nodeDelegatingFieldAccessorFactory;
@@ -72,16 +69,12 @@ public class NodeEntityStateFactory {
this.graphDatabaseContext = graphDatabaseContext;
}
public void setGraphRepositoryFactory(DirectGraphRepositoryFactory graphRepositoryFactory) {
this.graphRepositoryFactory = graphRepositoryFactory;
}
public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) {
this.entityManagerFactory = entityManagerFactory;
}
@PostConstruct
private void setUp() {
this.delegatingFieldAccessorFactory = new PartialNodeEntityState.PartialNodeDelegatingFieldAccessorFactory(graphDatabaseContext, graphRepositoryFactory);
this.delegatingFieldAccessorFactory = new PartialNodeEntityState.PartialNodeDelegatingFieldAccessorFactory(graphDatabaseContext);
}
}

View File

@@ -18,7 +18,6 @@ package org.springframework.data.graph.neo4j.support.node;
import org.neo4j.graphdb.Node;
import org.springframework.data.graph.core.NodeBacked;
import org.springframework.data.graph.neo4j.state.PartialNodeEntityState;
import org.springframework.orm.jpa.EntityManagerFactoryUtils;
import org.springframework.data.persistence.EntityInstantiator;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.graph.neo4j.state;
package org.springframework.data.graph.neo4j.support.node;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.NotInTransactionException;
@@ -25,7 +25,6 @@ import org.springframework.data.graph.annotation.GraphProperty;
import org.springframework.data.graph.annotation.RelatedTo;
import org.springframework.data.graph.core.NodeBacked;
import org.springframework.data.graph.neo4j.fieldaccess.*;
import org.springframework.data.graph.neo4j.repository.DirectGraphRepositoryFactory;
import org.springframework.data.graph.neo4j.support.GraphDatabaseContext;
import javax.persistence.PersistenceUnitUtil;
@@ -113,8 +112,8 @@ public class PartialNodeEntityState<ENTITY extends NodeBacked> extends DefaultEn
public static class PartialNodeDelegatingFieldAccessorFactory extends DelegatingFieldAccessorFactory {
public PartialNodeDelegatingFieldAccessorFactory(GraphDatabaseContext graphDatabaseContext, DirectGraphRepositoryFactory graphRepositoryFactory) {
super(graphDatabaseContext, graphRepositoryFactory);
public PartialNodeDelegatingFieldAccessorFactory(GraphDatabaseContext graphDatabaseContext) {
super(graphDatabaseContext);
}
@Override
@@ -147,7 +146,7 @@ public class PartialNodeEntityState<ENTITY extends NodeBacked> extends DefaultEn
},
new OneToNRelationshipFieldAccessorFactory(getGraphDatabaseContext()),
new ReadOnlyOneToNRelationshipFieldAccessorFactory(getGraphDatabaseContext()),
new TraversalFieldAccessorFactory(this.graphRepositoryFactory),
new TraversalFieldAccessorFactory(),
new OneToNRelationshipEntityFieldAccessorFactory(getGraphDatabaseContext())
);
}

View File

@@ -21,6 +21,7 @@ import org.neo4j.graphdb.Path;
import org.neo4j.graphdb.PropertyContainer;
import org.neo4j.graphdb.Relationship;
import org.neo4j.helpers.collection.IterableWrapper;
import org.springframework.data.graph.core.EntityPath;
import org.springframework.data.graph.core.GraphBacked;
import org.springframework.data.graph.core.NodeBacked;
import org.springframework.data.graph.core.RelationshipBacked;

View File

@@ -17,6 +17,7 @@
package org.springframework.data.graph.neo4j.support.path;
import org.neo4j.graphdb.Path;
import org.springframework.data.graph.core.EntityPath;
import org.springframework.data.graph.core.NodeBacked;
import org.springframework.data.graph.neo4j.support.GraphDatabaseContext;

View File

@@ -41,7 +41,7 @@ public interface PathMapper<T> {
/**
* callback instead of mapping
*/
public abstract class WithoutResult implements PathMapper<Void>, IterationController{
public abstract class WithoutResult implements PathMapper<Void>, IterationController {
public abstract void eachPath(Path path);
@Override

View File

@@ -23,8 +23,6 @@ import org.neo4j.helpers.collection.IterableWrapper;
import java.util.ArrayList;
import java.util.List;
import static org.springframework.data.graph.neo4j.support.path.IterationController.IterationMode.EAGER_STOP_ON_NULL;
/**
* @author mh
* @since 22.02.11

View File

@@ -22,7 +22,6 @@ import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.reflect.FieldSignature;
import org.neo4j.graphdb.Relationship;
import org.springframework.data.graph.core.RelationshipBacked;
import org.springframework.data.graph.neo4j.state.RelationshipEntityStateFactory;
import org.springframework.data.graph.neo4j.support.DoReturn;
import org.springframework.data.graph.core.EntityState;
import org.springframework.data.graph.neo4j.support.GraphDatabaseContext;
@@ -35,7 +34,7 @@ import static org.springframework.data.graph.neo4j.support.DoReturn.unwrap;
/**
* Aspect for handling relationship entity creation and field access (read & write)
* puts the underlying state into and delegates field access to an {@link org.springframework.data.graph.core.EntityState} instance,
* created by a configured {@link org.springframework.data.graph.neo4j.state.RelationshipEntityStateFactory}
* created by a configured {@link RelationshipEntityStateFactory}
*/
public aspect Neo4jRelationshipBacking {

View File

@@ -14,14 +14,13 @@
* limitations under the License.
*/
package org.springframework.data.graph.neo4j.state;
package org.springframework.data.graph.neo4j.support.relationship;
import org.neo4j.graphdb.NotInTransactionException;
import org.neo4j.graphdb.Relationship;
import org.springframework.dao.InvalidDataAccessResourceUsageException;
import org.springframework.data.graph.core.RelationshipBacked;
import org.springframework.data.graph.neo4j.fieldaccess.*;
import org.springframework.data.graph.neo4j.repository.DirectGraphRepositoryFactory;
import org.springframework.data.graph.neo4j.support.GraphDatabaseContext;
import java.util.Arrays;
@@ -35,7 +34,7 @@ public class RelationshipEntityState<ENTITY extends RelationshipBacked> extends
private final GraphDatabaseContext graphDatabaseContext;
public RelationshipEntityState(final Relationship underlyingState, final ENTITY entity, final Class<? extends ENTITY> type, final GraphDatabaseContext graphDatabaseContext, final DirectGraphRepositoryFactory graphRepositoryFactory, final RelationshipStateDelegatingFieldAccessorFactory delegatingFieldAccessorFactory) {
public RelationshipEntityState(final Relationship underlyingState, final ENTITY entity, final Class<? extends ENTITY> type, final GraphDatabaseContext graphDatabaseContext, final RelationshipStateDelegatingFieldAccessorFactory delegatingFieldAccessorFactory) {
super(underlyingState, entity, type, delegatingFieldAccessorFactory);
this.graphDatabaseContext = graphDatabaseContext;
}
@@ -68,8 +67,8 @@ public class RelationshipEntityState<ENTITY extends RelationshipBacked> extends
}
public static class RelationshipStateDelegatingFieldAccessorFactory extends DelegatingFieldAccessorFactory {
public RelationshipStateDelegatingFieldAccessorFactory(GraphDatabaseContext graphDatabaseContext, DirectGraphRepositoryFactory graphRepositoryFactory) {
super(graphDatabaseContext, graphRepositoryFactory);
public RelationshipStateDelegatingFieldAccessorFactory(GraphDatabaseContext graphDatabaseContext) {
super(graphDatabaseContext);
}
@Override

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.graph.neo4j.state;
package org.springframework.data.graph.neo4j.support.relationship;
import org.neo4j.graphdb.Relationship;
import org.springframework.data.graph.core.RelationshipBacked;
@@ -32,7 +32,7 @@ public class RelationshipEntityStateFactory {
private RelationshipEntityState.RelationshipStateDelegatingFieldAccessorFactory delegatingFieldAccessorFactory;
public EntityState<RelationshipBacked, Relationship> getEntityState(final RelationshipBacked entity) {
return new RelationshipEntityState<RelationshipBacked>(null,entity,entity.getClass(), graphDatabaseContext, graphRepositoryFactory, delegatingFieldAccessorFactory);
return new RelationshipEntityState<RelationshipBacked>(null,entity,entity.getClass(), graphDatabaseContext, delegatingFieldAccessorFactory);
}
public void setGraphDatabaseContext(GraphDatabaseContext graphDatabaseContext) {
@@ -45,7 +45,7 @@ public class RelationshipEntityStateFactory {
@PostConstruct
private void setUp() {
this.delegatingFieldAccessorFactory = new RelationshipEntityState.RelationshipStateDelegatingFieldAccessorFactory(graphDatabaseContext, graphRepositoryFactory);
this.delegatingFieldAccessorFactory = new RelationshipEntityState.RelationshipStateDelegatingFieldAccessorFactory(graphDatabaseContext);
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.graph.neo4j.support;
package org.springframework.data.graph.neo4j.support.typerepresentation;
import org.neo4j.graphdb.*;
import org.neo4j.graphdb.index.Index;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.graph.neo4j.support;
package org.springframework.data.graph.neo4j.support.typerepresentation;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.graph.neo4j.support;
package org.springframework.data.graph.neo4j.support.typerepresentation;
import org.neo4j.graphdb.Node;
import org.neo4j.helpers.collection.ClosableIterable;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.graph.neo4j.support;
package org.springframework.data.graph.neo4j.support.typerepresentation;
import org.neo4j.graphdb.Relationship;
import org.neo4j.helpers.collection.ClosableIterable;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.data.graph.neo4j.support;
package org.springframework.data.graph.neo4j.support.typerepresentation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

View File

@@ -14,12 +14,13 @@
* limitations under the License.
*/
package org.springframework.data.graph.neo4j.support;
package org.springframework.data.graph.neo4j.support.typerepresentation;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.springframework.data.graph.core.*;
import org.springframework.data.graph.neo4j.support.typerepresentation.*;
import org.springframework.data.persistence.EntityInstantiator;
public class TypeRepresentationStrategyFactory {

View File

@@ -19,8 +19,8 @@ package org.springframework.data.graph.neo4j.template;
import org.neo4j.graphdb.*;
import org.neo4j.graphdb.traversal.TraversalDescription;
import org.neo4j.helpers.collection.ClosableIterable;
import org.springframework.data.graph.core.Property;
import org.springframework.data.graph.neo4j.support.path.PathMapper;
import org.springframework.data.graph.core.Property;
/**
* A template with convenience operations, exception translation and implicit transaction for modifying methods

View File

@@ -29,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.graph.annotation.NodeEntity;
import org.springframework.data.graph.core.NodeBacked;
import org.springframework.data.graph.neo4j.support.node.Neo4jHelper;
import org.springframework.data.graph.neo4j.support.typerepresentation.IndexingNodeTypeRepresentationStrategy;
import org.springframework.test.context.CleanContextCacheTestExecutionListener;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;

View File

@@ -29,6 +29,8 @@ import org.springframework.data.graph.annotation.NodeEntity;
import org.springframework.data.graph.annotation.RelationshipEntity;
import org.springframework.data.graph.annotation.StartNode;
import org.springframework.data.graph.neo4j.support.node.Neo4jHelper;
import org.springframework.data.graph.neo4j.support.typerepresentation.IndexingNodeTypeRepresentationStrategy;
import org.springframework.data.graph.neo4j.support.typerepresentation.IndexingRelationshipTypeRepresentationStrategy;
import org.springframework.test.context.CleanContextCacheTestExecutionListener;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;

View File

@@ -26,6 +26,8 @@ import org.neo4j.graphdb.Transaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.graph.annotation.NodeEntity;
import org.springframework.data.graph.annotation.RelationshipEntity;
import org.springframework.data.graph.neo4j.support.typerepresentation.NoopNodeTypeRepresentationStrategy;
import org.springframework.data.graph.neo4j.support.typerepresentation.NoopRelationshipTypeRepresentationStrategy;
import org.springframework.test.context.CleanContextCacheTestExecutionListener;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;

View File

@@ -35,6 +35,7 @@ import org.springframework.data.graph.neo4j.Volvo;
import org.springframework.data.graph.neo4j.repository.DirectGraphRepositoryFactory;
import org.springframework.data.graph.neo4j.repository.GraphRepository;
import org.springframework.data.graph.neo4j.support.node.Neo4jHelper;
import org.springframework.data.graph.neo4j.support.typerepresentation.SubReferenceNodeTypeRepresentationStrategy;
import org.springframework.test.context.CleanContextCacheTestExecutionListener;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;

View File

@@ -27,6 +27,7 @@ import org.neo4j.graphdb.traversal.TraversalDescription;
import org.neo4j.kernel.Traversal;
import org.neo4j.kernel.impl.traversal.TraversalDescriptionImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.graph.core.EntityPath;
import org.springframework.data.graph.neo4j.Group;
import org.springframework.data.graph.neo4j.Person;
import static org.springframework.data.graph.neo4j.Person.persistedPerson;
@@ -35,7 +36,6 @@ import org.springframework.data.graph.neo4j.repository.DirectGraphRepositoryFact
import org.springframework.data.graph.neo4j.repository.GraphRepository;
import org.springframework.data.graph.neo4j.support.node.Neo4jHelper;
import org.springframework.data.graph.neo4j.support.path.EntityPath;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

View File

@@ -20,6 +20,7 @@ import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.graph.core.EntityPath;
import org.springframework.data.graph.neo4j.Person;
import org.springframework.data.graph.neo4j.support.GraphDatabaseContext;
import org.springframework.test.context.ContextConfiguration;

View File

@@ -21,6 +21,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.Node;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.graph.core.EntityPath;
import org.springframework.data.graph.neo4j.Person;
import org.springframework.data.graph.neo4j.support.GraphDatabaseContext;
import org.springframework.test.context.ContextConfiguration;

View File

@@ -103,7 +103,7 @@
<bean id="relationshipEntityInstantiator"
class="org.springframework.data.graph.neo4j.support.relationship.RelationshipEntityInstantiator"/>
<bean id="typeRepresentationStrategyFactory" class="org.springframework.data.graph.neo4j.support.TypeRepresentationStrategyFactory">
<bean id="typeRepresentationStrategyFactory" class="org.springframework.data.graph.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory">
<constructor-arg ref="graphDatabaseService"/>
<constructor-arg ref="graphEntityInstantiator"/>
<constructor-arg ref="relationshipEntityInstantiator"/>
@@ -112,19 +112,17 @@
<bean id="nodeTypeRepresentationStrategy" factory-bean="typeRepresentationStrategyFactory" factory-method="getNodeTypeRepresentationStrategy" />
<bean id="relationshipTypeRepresentationStrategy" factory-bean="typeRepresentationStrategyFactory" factory-method="getRelationshipTypeRepresentationStrategy"/>
<bean id="nodeEntityStateFactory" class="org.springframework.data.graph.neo4j.state.NodeEntityStateFactory">
<bean id="nodeEntityStateFactory" class="org.springframework.data.graph.neo4j.support.node.NodeEntityStateFactory">
<property name="nodeDelegatingFieldAccessorFactory">
<bean class="org.springframework.data.graph.neo4j.fieldaccess.NodeDelegatingFieldAccessorFactory">
<constructor-arg ref="graphDatabaseContext"/>
<constructor-arg ref="graphRepositoryFactory"/>
</bean>
</property>
<property name="graphDatabaseContext" ref="graphDatabaseContext"/>
<property name="graphRepositoryFactory" ref="graphRepositoryFactory"/>
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<bean id="relationshipEntityStateFactory" class="org.springframework.data.graph.neo4j.state.RelationshipEntityStateFactory">
<bean id="relationshipEntityStateFactory" class="org.springframework.data.graph.neo4j.support.relationship.RelationshipEntityStateFactory">
<property name="graphDatabaseContext" ref="graphDatabaseContext"/>
<property name="graphRepositoryFactory" ref="graphRepositoryFactory"/>
</bean>

View File

@@ -14,11 +14,11 @@
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="nodeTypeRepresentationStrategy" class="org.springframework.data.graph.neo4j.support.IndexingNodeTypeRepresentationStrategy">
<bean id="nodeTypeRepresentationStrategy" class="org.springframework.data.graph.neo4j.support.typerepresentation.IndexingNodeTypeRepresentationStrategy">
<constructor-arg ref="graphDatabaseService" />
<constructor-arg ref="graphEntityInstantiator" />
</bean>
<bean id="relationshipTypeRepresentationStrategy" class="org.springframework.data.graph.neo4j.support.IndexingRelationshipTypeRepresentationStrategy">
<bean id="relationshipTypeRepresentationStrategy" class="org.springframework.data.graph.neo4j.support.typerepresentation.IndexingRelationshipTypeRepresentationStrategy">
<constructor-arg ref="graphDatabaseService" />
<constructor-arg ref="relationshipEntityInstantiator" />
</bean>

View File

@@ -100,7 +100,7 @@
<bean id="graphEntityInstantiator"
class="org.springframework.data.graph.neo4j.support.node.NodeEntityInstantiator"/>
<bean id="typeRepresentationStrategyFactory" class="org.springframework.data.graph.neo4j.support.TypeRepresentationStrategyFactory">
<bean id="typeRepresentationStrategyFactory" class="org.springframework.data.graph.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory">
<constructor-arg ref="graphDatabaseService"/>
<constructor-arg ref="graphEntityInstantiator"/>
<constructor-arg ref="relationshipEntityInstantiator"/>
@@ -109,18 +109,16 @@
<bean id="nodeTypeRepresentationStrategy" factory-bean="typeRepresentationStrategyFactory" factory-method="getNodeTypeRepresentationStrategy" />
<bean id="relationshipTypeRepresentationStrategy" factory-bean="typeRepresentationStrategyFactory" factory-method="getRelationshipTypeRepresentationStrategy"/>
<bean id="nodeEntityStateFactory" class="org.springframework.data.graph.neo4j.state.NodeEntityStateFactory">
<bean id="nodeEntityStateFactory" class="org.springframework.data.graph.neo4j.support.node.NodeEntityStateFactory">
<property name="nodeDelegatingFieldAccessorFactory">
<bean class="org.springframework.data.graph.neo4j.fieldaccess.NodeDelegatingFieldAccessorFactory">
<constructor-arg ref="graphDatabaseContext"/>
<constructor-arg ref="graphRepositoryFactory"/>
</bean>
</property>
<property name="graphDatabaseContext" ref="graphDatabaseContext"/>
<property name="graphRepositoryFactory" ref="graphRepositoryFactory"/>
</bean>
<bean id="relationshipEntityStateFactory" class="org.springframework.data.graph.neo4j.state.RelationshipEntityStateFactory">
<bean id="relationshipEntityStateFactory" class="org.springframework.data.graph.neo4j.support.relationship.RelationshipEntityStateFactory">
<property name="graphDatabaseContext" ref="graphDatabaseContext"/>
<property name="graphRepositoryFactory" ref="graphRepositoryFactory"/>
</bean>

View File

@@ -14,6 +14,6 @@
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="noopNodeStrategy" class="org.springframework.data.graph.neo4j.support.NoopNodeTypeRepresentationStrategy" />
<bean id="noopRelationshipStrategy" class="org.springframework.data.graph.neo4j.support.NoopRelationshipTypeRepresentationStrategy" />
<bean id="noopNodeStrategy" class="org.springframework.data.graph.neo4j.support.typerepresentation.NoopNodeTypeRepresentationStrategy" />
<bean id="noopRelationshipStrategy" class="org.springframework.data.graph.neo4j.support.typerepresentation.NoopRelationshipTypeRepresentationStrategy" />
</beans>

View File

@@ -14,7 +14,7 @@
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="typeRepresentationStrategy" class="org.springframework.data.graph.neo4j.support.SubReferenceNodeTypeRepresentationStrategy">
<bean id="typeRepresentationStrategy" class="org.springframework.data.graph.neo4j.support.typerepresentation.SubReferenceNodeTypeRepresentationStrategy">
<constructor-arg ref="graphDatabaseService"/>
<constructor-arg ref="graphEntityInstantiator" />
</bean>