fixed circular dependency in configuration, injection tests, JOTM tests ignored for now
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.data.neo4j.config;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.validation.Validator;
|
||||
|
||||
import org.neo4j.graphdb.GraphDatabaseService;
|
||||
@@ -96,7 +97,7 @@ public abstract class Neo4jConfiguration {
|
||||
|
||||
@Bean
|
||||
public Neo4jNodeConverterImpl neo4jConverter() throws Exception {
|
||||
return new Neo4jNodeConverterImpl(nodeEntityStateFactory());
|
||||
return new Neo4jNodeConverterImpl();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -133,9 +134,12 @@ public abstract class Neo4jConfiguration {
|
||||
return new Neo4jMappingContext();
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void setupContext() throws Exception {
|
||||
neo4jConverter().setNodeEntityStateFactory(nodeEntityStateFactory());
|
||||
}
|
||||
@Bean
|
||||
public NodeEntityStateFactory nodeEntityStateFactory() throws Exception {
|
||||
|
||||
NodeEntityStateFactory entityStateFactory = new NodeEntityStateFactory();
|
||||
entityStateFactory.setGraphDatabaseContext(graphDatabaseContext());
|
||||
entityStateFactory.setMappingContext(mappingContext());
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.util.Map;
|
||||
* @since 28.06.11
|
||||
*/
|
||||
public class DefaultConverter<T,R> implements ResultConverter<T,R> {
|
||||
@SuppressWarnings("unchecked")
|
||||
public R convert(Object value, Class type) {
|
||||
if (value == null || type.isInstance(value)) return (R) value;
|
||||
Object singleValue = extractValue(value);
|
||||
@@ -55,6 +56,7 @@ public class DefaultConverter<T,R> implements ResultConverter<T,R> {
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Object doConvert(Object value, Class<?> sourceType, Class type) {
|
||||
if (Node.class.isAssignableFrom(type)) {
|
||||
return toNode(value, sourceType);
|
||||
|
||||
@@ -70,6 +70,7 @@ public abstract class AbstractNodeRelationshipFieldAccessor<STATE extends Proper
|
||||
}
|
||||
}
|
||||
// adding cascade
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Set<STATE> checkTargetIsSetOfNodebacked(Object newVal) {
|
||||
if (!(newVal instanceof Set)) {
|
||||
throw new IllegalArgumentException("New value must be a Set, was: " + newVal.getClass());
|
||||
@@ -109,6 +110,7 @@ public abstract class AbstractNodeRelationshipFieldAccessor<STATE extends Proper
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void createSingleRelationship(STATE start, TSTATE end) {
|
||||
if (end==null) return;
|
||||
switch(direction) {
|
||||
|
||||
@@ -68,7 +68,7 @@ public abstract class DelegatingFieldAccessorFactory implements FieldAccessorFac
|
||||
for (final FieldAccessorFactory fieldAccessorFactory : fieldAccessorFactories) {
|
||||
if (fieldAccessorFactory.accept(property)) {
|
||||
if (log.isInfoEnabled()) log.info("Factory " + fieldAccessorFactory + " used for field: " + property);
|
||||
return (FieldAccessorFactory) fieldAccessorFactory;
|
||||
return fieldAccessorFactory;
|
||||
}
|
||||
}
|
||||
if (log.isWarnEnabled()) log.warn("No FieldAccessor configured for field: " + property);
|
||||
@@ -89,7 +89,7 @@ public abstract class DelegatingFieldAccessorFactory implements FieldAccessorFac
|
||||
final List<FieldAccessorListenerFactory> result = new ArrayList<FieldAccessorListenerFactory>();
|
||||
for (final FieldAccessorListenerFactory fieldAccessorListenerFactory : fieldAccessorListenerFactories) {
|
||||
if (fieldAccessorListenerFactory.accept(property)) {
|
||||
result.add((FieldAccessorListenerFactory) fieldAccessorListenerFactory);
|
||||
result.add(fieldAccessorListenerFactory);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -100,6 +100,7 @@ public abstract class DelegatingFieldAccessorFactory implements FieldAccessorFac
|
||||
|
||||
private final Map<TypeInformation<?>, FieldAccessorFactoryProviders> accessorFactoryProviderCache = new HashMap<TypeInformation<?>, FieldAccessorFactoryProviders>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> FieldAccessorFactoryProviders<T> accessorFactoriesFor(final Neo4jPersistentEntity<?> type) {
|
||||
synchronized (this) {
|
||||
final TypeInformation<?> typeInformation = type.getTypeInformation();
|
||||
@@ -110,7 +111,7 @@ public abstract class DelegatingFieldAccessorFactory implements FieldAccessorFac
|
||||
@Override
|
||||
public void doWithPersistentProperty(Neo4jPersistentProperty property) {
|
||||
final FieldAccessorFactory factory = factoryForField(property);
|
||||
final List<FieldAccessorListenerFactory> listenerFactories = (List<FieldAccessorListenerFactory>) getFieldAccessListenerFactories(property);
|
||||
final List<FieldAccessorListenerFactory> listenerFactories = getFieldAccessListenerFactories(property);
|
||||
newFieldAccessorFactories.add(property, factory, listenerFactories);
|
||||
}
|
||||
});
|
||||
@@ -119,7 +120,7 @@ public abstract class DelegatingFieldAccessorFactory implements FieldAccessorFac
|
||||
public void doWithAssociation(Association<Neo4jPersistentProperty> association) {
|
||||
final Neo4jPersistentProperty property = association.getInverse();
|
||||
final FieldAccessorFactory factory = factoryForField(property);
|
||||
final List<FieldAccessorListenerFactory> listenerFactories = (List<FieldAccessorListenerFactory>) getFieldAccessListenerFactories(property);
|
||||
final List<FieldAccessorListenerFactory> listenerFactories = getFieldAccessListenerFactories(property);
|
||||
newFieldAccessorFactories.add(property, factory, listenerFactories);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.data.neo4j.fieldaccess;
|
||||
|
||||
import org.springframework.data.mapping.PersistentProperty;
|
||||
import org.springframework.data.neo4j.mapping.Neo4jPersistentProperty;
|
||||
import org.springframework.data.neo4j.support.GraphDatabaseContext;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
@@ -37,6 +36,7 @@ public class FieldAccessorFactoryProviders<T> {
|
||||
private final FieldAccessorFactory fieldAccessorFactory;
|
||||
private final List<FieldAccessorListenerFactory> fieldAccessorListenerFactories;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
FieldAccessorFactoryProvider(final Neo4jPersistentProperty property, final FieldAccessorFactory fieldAccessorFactory, final List fieldAccessorListenerFactories) {
|
||||
this.property = property;
|
||||
this.fieldAccessorFactory = fieldAccessorFactory;
|
||||
@@ -90,6 +90,7 @@ public class FieldAccessorFactoryProviders<T> {
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void add(Neo4jPersistentProperty property, FieldAccessorFactory fieldAccessorFactory, List<FieldAccessorListenerFactory> listenerFactories) {
|
||||
fieldAccessorFactoryProviders.add(new FieldAccessorFactoryProvider(property, fieldAccessorFactory, listenerFactories));
|
||||
if (property.isIdProperty()) this.idProperty = property;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class IndexingPropertyFieldAccessorListenerFactory<S extends PropertyCont
|
||||
|
||||
private Index<S> getIndex(Neo4jPersistentProperty property, Object instance) {
|
||||
final Indexed indexedAnnotation = property.getAnnotation(Indexed.class);
|
||||
final Class<T> type = (Class<T>) property.getOwner().getType();
|
||||
@SuppressWarnings("unchecked") final Class<T> type = (Class<T>) property.getOwner().getType();
|
||||
final String providedIndexName = indexedAnnotation.indexName().isEmpty() ? null : indexedAnnotation.indexName();
|
||||
String indexName = Indexed.Name.get(indexedAnnotation.level(), type, providedIndexName, instance.getClass());
|
||||
if (!property.getIndexInfo().isFulltext()) {
|
||||
@@ -113,7 +113,7 @@ public class IndexingPropertyFieldAccessorListenerFactory<S extends PropertyCont
|
||||
|
||||
@Override
|
||||
public void valueChanged(Object entity, Object oldVal, Object newVal) {
|
||||
Index<T> index = indexProvider.getIndex(property, entity);
|
||||
@SuppressWarnings("unchecked") Index<T> index = indexProvider.getIndex(property, entity);
|
||||
if (newVal instanceof Number) newVal = ValueContext.numeric((Number) newVal);
|
||||
|
||||
final T state = graphDatabaseContext.getPersistentState(entity);
|
||||
|
||||
@@ -16,11 +16,6 @@
|
||||
|
||||
package org.springframework.data.neo4j.fieldaccess;
|
||||
|
||||
import org.neo4j.graphdb.Node;
|
||||
import org.neo4j.graphdb.PropertyContainer;
|
||||
import org.springframework.data.neo4j.core.EntityState;
|
||||
|
||||
|
||||
import org.springframework.data.neo4j.mapping.Neo4jPersistentEntity;
|
||||
import org.springframework.data.neo4j.mapping.Neo4jPersistentProperty;
|
||||
import org.springframework.data.neo4j.support.DoReturn;
|
||||
@@ -41,6 +36,7 @@ public class ManagedFieldAccessorSet<T> extends AbstractSet<T> {
|
||||
private final GraphDatabaseContext ctx;
|
||||
private final FieldAccessor fieldAccessor;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ManagedFieldAccessorSet(final Object entity, final Object newVal, final Neo4jPersistentProperty property, GraphDatabaseContext ctx, FieldAccessor fieldAccessor) {
|
||||
this.entity = entity;
|
||||
this.property = property;
|
||||
@@ -73,7 +69,6 @@ public class ManagedFieldAccessorSet<T> extends AbstractSet<T> {
|
||||
|
||||
private void update() {
|
||||
final Neo4jPersistentEntity<?> persistentEntity = property.getOwner();
|
||||
final PropertyContainer persistentState = persistentEntity.getPersistentState(entity, ctx);
|
||||
if (persistentEntity.isNodeEntity()) {
|
||||
updateValue();
|
||||
}
|
||||
|
||||
@@ -33,19 +33,10 @@ import java.lang.reflect.Field;
|
||||
*/
|
||||
public class Neo4jMappingContext extends AbstractMappingContext<Neo4jPersistentEntityImpl<?>, Neo4jPersistentProperty> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.context.AbstractMappingContext#createPersistentEntity(org.springframework.data.util.TypeInformation)
|
||||
*/
|
||||
@Override
|
||||
protected <T> Neo4jPersistentEntityImpl<?> createPersistentEntity(TypeInformation<T> typeInformation) {
|
||||
return new Neo4jPersistentEntityImpl<T>(typeInformation);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.context.AbstractMappingContext#createPersistentProperty(java.lang.reflect.Field, java.beans.PropertyDescriptor, org.springframework.data.mapping.model.MutablePersistentEntity, org.springframework.data.mapping.model.SimpleTypeHolder)
|
||||
*/
|
||||
@Override
|
||||
protected Neo4jPersistentProperty createPersistentProperty(Field field, PropertyDescriptor descriptor,
|
||||
Neo4jPersistentEntityImpl<?> owner, SimpleTypeHolder simpleTypeHolder) {
|
||||
|
||||
@@ -21,19 +21,16 @@ import org.neo4j.graphdb.Transaction;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.data.mapping.Association;
|
||||
import org.springframework.data.mapping.AssociationHandler;
|
||||
import org.springframework.data.mapping.PersistentEntity;
|
||||
import org.springframework.data.mapping.PropertyHandler;
|
||||
import org.springframework.data.mapping.context.MappingContext;
|
||||
import org.springframework.data.mapping.model.BeanWrapper;
|
||||
import org.springframework.data.mapping.model.MappingException;
|
||||
import org.springframework.data.neo4j.core.EntityState;
|
||||
|
||||
import org.springframework.data.neo4j.support.DoReturn;
|
||||
import org.springframework.data.neo4j.support.GraphDatabaseContext;
|
||||
import org.springframework.data.neo4j.support.node.NodeEntityStateFactory;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
/**
|
||||
@@ -41,9 +38,12 @@ import java.lang.reflect.InvocationTargetException;
|
||||
* @since 27.09.11
|
||||
*/
|
||||
public class Neo4jNodeConverterImpl implements Neo4jNodeConverter {
|
||||
private final NodeEntityStateFactory nodeEntityStateFactory;
|
||||
private NodeEntityStateFactory nodeEntityStateFactory;
|
||||
|
||||
public Neo4jNodeConverterImpl(NodeEntityStateFactory nodeEntityStateFactory) {
|
||||
public Neo4jNodeConverterImpl() {
|
||||
}
|
||||
|
||||
public void setNodeEntityStateFactory(NodeEntityStateFactory nodeEntityStateFactory) {
|
||||
this.nodeEntityStateFactory = nodeEntityStateFactory;
|
||||
nodeEntityStateFactory.setCreateDetachableEntities(false);
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class Neo4jNodeConverterImpl implements Neo4jNodeConverter {
|
||||
public <R> R read(Class<R> targetType, Node node) {
|
||||
Assert.notNull(targetType);
|
||||
Assert.notNull(node);
|
||||
final Neo4jPersistentEntity<R> persistentEntity = (Neo4jPersistentEntity<R>) getMappingContext().getPersistentEntity(targetType);
|
||||
@SuppressWarnings("unchecked") final Neo4jPersistentEntity<R> persistentEntity = (Neo4jPersistentEntity<R>) getMappingContext().getPersistentEntity(targetType);
|
||||
final GraphDatabaseContext graphDatabaseContext = nodeEntityStateFactory.getGraphDatabaseContext();
|
||||
final R entity = graphDatabaseContext.createEntityFromState(node, targetType);
|
||||
final BeanWrapper<Neo4jPersistentEntity<R>, R> wrapper = BeanWrapper.create(entity, getConversionService());
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.data.neo4j.mapping;
|
||||
|
||||
import org.neo4j.graphdb.GraphDatabaseService;
|
||||
import org.neo4j.graphdb.PropertyContainer;
|
||||
import org.springframework.data.mapping.PersistentEntity;
|
||||
import org.springframework.data.neo4j.support.GraphDatabaseContext;
|
||||
@@ -95,6 +95,7 @@ public class Neo4jPersistentEntityImpl<T> extends BasicPersistentEntity<T, Neo4j
|
||||
throw new MappingException("Entity has to be annotated with @NodeEntity or @RelationshipEntity"+this);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T extends PropertyContainer> T getPersistentState(Object entity, GraphDatabaseContext service) {
|
||||
final Neo4jPersistentProperty idProperty = getIdProperty();
|
||||
@@ -228,6 +228,7 @@ public abstract class AbstractGraphRepository<S extends PropertyContainer, T> im
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected <T extends Number> NumericRangeQuery<T> createInclusiveRangeQuery(String property, Number from, Number to) {
|
||||
if (from instanceof Long) return (NumericRangeQuery<T>) NumericRangeQuery.newLongRange(property, from.longValue(),to.longValue(),true,true);
|
||||
if (from instanceof Integer) return (NumericRangeQuery<T>) NumericRangeQuery.newIntRange(property, from.intValue(), to.intValue(), true, true);
|
||||
|
||||
@@ -37,11 +37,13 @@ public class NodeGraphRepository<T> extends AbstractGraphRepository<Node, T> imp
|
||||
return graphDatabaseContext.findAllByTraversal(start, clazz, traversalDescription);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public T save(T entity) {
|
||||
return (T)graphDatabaseContext.save(entity);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Iterable<T> save(Iterable<? extends T> entities) {
|
||||
for (T entity : entities) {
|
||||
|
||||
@@ -15,11 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.neo4j.support;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.data.persistence.StateBackedCreator;
|
||||
@@ -27,6 +22,11 @@ import org.springframework.data.persistence.StateProvider;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import sun.reflect.ReflectionFactory;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Try for a constructor taking state: failing that, try a no-arg constructor and then setUnderlyingNode().
|
||||
*
|
||||
@@ -37,7 +37,8 @@ public abstract class AbstractConstructorEntityInstantiator<STATE> implements En
|
||||
private final Log log = LogFactory.getLog(getClass());
|
||||
private final Map<Class<?>, StateBackedCreator<?, STATE>> cache = new HashMap<Class<?>, StateBackedCreator<?, STATE>>();
|
||||
|
||||
public <T> T createEntityFromState(STATE n, Class<T> c) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T createEntityFromState(STATE n, Class<T> c) {
|
||||
try {
|
||||
StateBackedCreator<T, STATE> creator = (StateBackedCreator<T, STATE>) cache.get(c);
|
||||
if (creator != null)
|
||||
@@ -135,7 +136,7 @@ public abstract class AbstractConstructorEntityInstantiator<STATE> implements En
|
||||
|
||||
protected <T> StateBackedCreator<T, STATE> stateTakingConstructorInstantiator(
|
||||
Class<T> type, Class<STATE> stateType) {
|
||||
Class<? extends STATE> stateInterface = (Class<? extends STATE>) stateType.getInterfaces()[0];
|
||||
@SuppressWarnings("unchecked") Class<? extends STATE> stateInterface = (Class<? extends STATE>) stateType.getInterfaces()[0];
|
||||
final Constructor<T> constructor = ClassUtils.getConstructorIfAvailable(type, stateInterface);
|
||||
if (constructor == null)
|
||||
return null;
|
||||
|
||||
@@ -82,6 +82,7 @@ public class DelegatingGraphDatabase implements GraphDatabase {
|
||||
return setProperties(startNode.createRelationshipTo(endNode,type),props);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T extends PropertyContainer> Index<T> getIndex(String indexName) {
|
||||
IndexManager indexManager = delegate.index();
|
||||
@@ -91,6 +92,7 @@ public class DelegatingGraphDatabase implements GraphDatabase {
|
||||
}
|
||||
|
||||
// TODO handle existing indexes
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T extends PropertyContainer> Index<T> createIndex(Class<T> type, String indexName, boolean fullText) {
|
||||
IndexManager indexManager = delegate.index();
|
||||
@@ -127,6 +129,7 @@ public class DelegatingGraphDatabase implements GraphDatabase {
|
||||
return Traversal.description();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> QueryEngine<T> queryEngineFor(QueryType type) {
|
||||
switch (type) {
|
||||
case Cypher: return (QueryEngine<T>)new CypherQueryEngine(delegate, createResultConverter());
|
||||
|
||||
@@ -79,6 +79,7 @@ public class GraphDatabaseContext {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <S extends PropertyContainer, T> Index<S> getIndex(Class<T> type, String indexName, boolean fullText) {
|
||||
if (indexName==null) indexName = Indexed.Name.get(type);
|
||||
Map<String, String> config = fullText ? LuceneIndexImplementation.FULLTEXT_CONFIG : null;
|
||||
@@ -128,6 +129,7 @@ public class GraphDatabaseContext {
|
||||
return getTypeRepresentationStrategy(state, targetType).projectEntity(state, targetType);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <S extends PropertyContainer> S getPersistentState(Object entity) {
|
||||
if (entity instanceof PropertyContainer) {
|
||||
return (S) entity;
|
||||
@@ -141,6 +143,7 @@ public class GraphDatabaseContext {
|
||||
}
|
||||
|
||||
// todo depending on type of mapping
|
||||
@SuppressWarnings("unchecked")
|
||||
public <S extends PropertyContainer> void setPersistentState(Object entity, S state) {
|
||||
if (entity instanceof PropertyContainer) {
|
||||
return;
|
||||
@@ -158,6 +161,7 @@ public class GraphDatabaseContext {
|
||||
getTypeRepresentationStrategy(node, entityClass).postEntityCreation(node, entityClass);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> Iterable<T> findAllByTraversal(Object entity, Class<?> targetType, TraversalDescription traversalDescription) {
|
||||
final Neo4jPersistentEntityImpl<?> persistentEntity = mappingContext.getPersistentEntity(entity.getClass());
|
||||
final PropertyContainer state = persistentEntity.getPersistentState(entity, this);
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.util.Iterator;
|
||||
* @author mh
|
||||
* @since 26.02.11
|
||||
*/
|
||||
@SuppressWarnings("unchecked") // TODO DefaultNode/RelationshipBacked
|
||||
public class ConvertingEntityPath<S,E> implements EntityPath<S,E> {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,6 +30,7 @@ public class ConversionServiceQueryResultConverter<R> extends DefaultConverter<O
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected Object doConvert(Object value, Class<?> sourceType, Class type) {
|
||||
if (conversionService.canConvert(sourceType, type)) {
|
||||
|
||||
@@ -44,6 +44,7 @@ public class CypherQueryEngine implements QueryEngine<Map<String,Object>> {
|
||||
this.executionEngine = new ExecutionEngine(graphDatabaseService);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public QueryResult<Map<String, Object>> query(String statement, Map<String, Object> params) {
|
||||
try {
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.data.neo4j.support.GraphDatabaseContext;
|
||||
* @author mh
|
||||
* @since 28.06.11
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class EntityResultConverter2<R> implements ResultConverter<Object,R> {
|
||||
private final TypeRepresentationStrategy nodeTypeRepresentationStrategy;
|
||||
private final TypeRepresentationStrategy relationshipTypeRepresentationStrategy;
|
||||
|
||||
@@ -40,6 +40,7 @@ public class GremlinQueryEngine implements QueryEngine<Object> {
|
||||
this.gremlinExecutor = new GremlinExecutor(graphDatabaseService);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public QueryResult<Object> query(String statement, Map<String, Object> params) {
|
||||
try {
|
||||
|
||||
@@ -31,6 +31,7 @@ public class RelationshipEntityStateFactory {
|
||||
private DelegatingFieldAccessorFactory relationshipDelegatingFieldAccessorFactory;
|
||||
private Neo4jMappingContext mappingContext;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public EntityState<Relationship> getEntityState(final Object entity) {
|
||||
final Class<?> entityType = entity.getClass();
|
||||
return new RelationshipEntityState(null,entity, entityType, graphDatabaseContext, relationshipDelegatingFieldAccessorFactory, (Neo4jPersistentEntity) mappingContext.getPersistentEntity(entityType));
|
||||
|
||||
@@ -24,12 +24,9 @@ import org.neo4j.helpers.collection.ClosableIterable;
|
||||
import org.neo4j.helpers.collection.CombiningIterable;
|
||||
import org.neo4j.helpers.collection.IterableWrapper;
|
||||
import org.neo4j.kernel.Traversal;
|
||||
|
||||
|
||||
import org.springframework.data.neo4j.core.NodeTypeRepresentationStrategy;
|
||||
import org.springframework.data.neo4j.support.EntityInstantiator;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -224,6 +221,7 @@ public class SubReferenceNodeTypeRepresentationStrategy implements NodeTypeRepre
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <U> U createEntity(Node state) {
|
||||
Class<?> javaType = getJavaType(state);
|
||||
@@ -233,6 +231,7 @@ public class SubReferenceNodeTypeRepresentationStrategy implements NodeTypeRepre
|
||||
return (U) entityInstantiator.createEntityFromState(state, javaType);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <U> U createEntity(Node state, Class<U> type) {
|
||||
Class<?> javaType = getJavaType(state);
|
||||
|
||||
@@ -62,11 +62,6 @@ public class DataGraphNamespaceHandlerTest {
|
||||
assertInjected("-code");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void injectionForCrossStore() {
|
||||
assertInjected("-cross-store");
|
||||
}
|
||||
|
||||
private Config assertInjected(String testCase) {
|
||||
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:org/springframework/data/neo4j/config/DataGraphNamespaceHandlerTest" + testCase + "-context.xml");
|
||||
Config config = ctx.getBean("config", Config.class);
|
||||
|
||||
@@ -18,12 +18,12 @@ package org.springframework.data.neo4j.mapping;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.neo4j.graphdb.*;
|
||||
import org.neo4j.graphdb.Direction;
|
||||
import org.neo4j.graphdb.DynamicRelationshipType;
|
||||
import org.neo4j.graphdb.Node;
|
||||
import org.neo4j.graphdb.Transaction;
|
||||
import org.neo4j.graphdb.index.Index;
|
||||
import org.neo4j.graphdb.index.IndexHits;
|
||||
import org.neo4j.helpers.collection.IteratorUtil;
|
||||
import org.neo4j.test.ImpermanentGraphDatabase;
|
||||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.data.neo4j.Person;
|
||||
import org.springframework.data.neo4j.Personality;
|
||||
import org.springframework.data.neo4j.fieldaccess.Neo4jConversionServiceFactoryBean;
|
||||
@@ -33,7 +33,6 @@ import org.springframework.data.neo4j.support.node.NodeEntityInstantiator;
|
||||
import org.springframework.data.neo4j.support.node.NodeEntityStateFactory;
|
||||
import org.springframework.data.neo4j.support.typerepresentation.NoopNodeTypeRepresentationStrategy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -57,7 +56,8 @@ public class Neo4jNodeConverterTest {
|
||||
nodeEntityStateFactory.setMappingContext(mappingContext);
|
||||
nodeEntityStateFactory.setGraphDatabaseContext(gdc);
|
||||
nodeEntityStateFactory.setNodeDelegatingFieldAccessorFactory(new NodeDelegatingFieldAccessorFactory(gdc));
|
||||
converter = new Neo4jNodeConverterImpl(nodeEntityStateFactory);
|
||||
converter = new Neo4jNodeConverterImpl();
|
||||
converter.setNodeEntityStateFactory(nodeEntityStateFactory);
|
||||
gdc.setConverter(converter);
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ public class Neo4jNodeConverterTest {
|
||||
public void tearDown() throws Exception {
|
||||
tx.failure();
|
||||
tx.finish();
|
||||
gdc.getGraphDatabaseService().shutdown();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.data.neo4j.transaction;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.neo4j.graphdb.GraphDatabaseService;
|
||||
import org.neo4j.graphdb.Node;
|
||||
@@ -37,13 +38,13 @@ import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
/**
|
||||
* @author mh
|
||||
* @since 21.02.11
|
||||
*/
|
||||
|
||||
@Ignore("TODO")
|
||||
public class JOTMIntegrationTest {
|
||||
private ClassPathXmlApplicationContext ctx;
|
||||
private GraphDatabaseService gds;
|
||||
|
||||
Reference in New Issue
Block a user