From ef6ad1c0c3665ee0d92f2fac0a43cb6342a39036 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Bergamin Date: Tue, 18 Oct 2011 14:01:01 +0200 Subject: [PATCH] Some cosmetical changes --- .../data/neo4j/mapping/EntityPersister.java | 2 +- .../data/neo4j/support/Neo4jTemplate.java | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/mapping/EntityPersister.java b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/mapping/EntityPersister.java index a372c9a07d..923771b3e2 100644 --- a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/mapping/EntityPersister.java +++ b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/mapping/EntityPersister.java @@ -27,5 +27,5 @@ public interface EntityPersister { T createEntityFromState(S state, Class type); T createEntityFromStoredType(S state); boolean isNodeEntity(Class targetType); - boolean isRelationshipEntity(Class targetType); + boolean isRelationshipEntity(Class targetType); } diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/Neo4jTemplate.java b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/Neo4jTemplate.java index 08b9a19b76..0c8d49cd6b 100644 --- a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/Neo4jTemplate.java +++ b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/Neo4jTemplate.java @@ -28,7 +28,6 @@ import org.springframework.data.neo4j.annotation.QueryType; import org.springframework.data.neo4j.conversion.QueryResultBuilder; import org.springframework.data.neo4j.conversion.Result; -import org.springframework.data.neo4j.conversion.ResultConverter; import org.springframework.data.neo4j.core.GraphDatabase; import org.springframework.data.neo4j.core.TypeRepresentationStrategy; import org.springframework.data.neo4j.core.UncategorizedGraphStoreException; @@ -96,11 +95,10 @@ public Neo4jTemplate(MappingInfrastructure infrastructure) { @Override - @SuppressWarnings({"unchecked"}) public GraphRepository repositoryFor(Class clazz) { notNull(clazz,"entity type"); - if (isNodeEntity(clazz)) return new NodeGraphRepository(clazz, this); - if (isRelationshipEntity(clazz)) return new RelationshipGraphRepository(clazz, this); + if (isNodeEntity(clazz)) return new NodeGraphRepository(clazz, this); + if (isRelationshipEntity(clazz)) return new RelationshipGraphRepository(clazz, this); throw new IllegalArgumentException("Can't create graph repository for non graph entity of type " + clazz); } @@ -120,7 +118,6 @@ public Index getIndex(Class type, String return infrastructure.getIndexProvider().getIndex(type, indexName, null); } - @SuppressWarnings("unchecked") public Index getIndex(Class type, String indexName, Boolean fullText) { return infrastructure.getIndexProvider().getIndex(type, indexName, fullText); } @@ -160,11 +157,13 @@ public long count(final Class entityClass) { return infrastructure.getTypeRepresentationStrategies().count(entityClass); } + @Override public T createEntityFromStoredType(S state) { notNull(state,"node or relationship"); return infrastructure.getEntityPersister().createEntityFromStoredType(state); } + @Override public T createEntityFromState(S state, Class type) { notNull(state,"node or relationship",type,"entity class"); return infrastructure.getEntityPersister().createEntityFromState(state, type); @@ -177,13 +176,11 @@ public T projectTo(Object entity, Class targetType) { } @Override - @SuppressWarnings("unchecked") public S getPersistentState(Object entity) { notNull(entity,"entity"); return infrastructure.getEntityPersister().getPersistentState(entity); } - @SuppressWarnings("unchecked") public T setPersistentState(T entity, S state) { notNull(entity,"entity",state,"node or relationship"); infrastructure.getEntityPersister().setPersistentState(entity, state); @@ -231,6 +228,7 @@ public T createNodeAs(Class target, Map properties) { return convert(node, target); } + @SuppressWarnings("unused") private Node createNode(Map properties, Class target, TypeRepresentationStrategy nodeTypeRepresentationStrategy) { final Node node = createNode(properties); if (nodeTypeRepresentationStrategy != null) { @@ -242,22 +240,24 @@ private Node createNode(Map properties, Class target, Typ /** * Delegates to {@link GraphDatabaseService} */ - public Transaction beginTx() { // todo remove ! + public Transaction beginTx() { // TODO remove ! return infrastructure.getGraphDatabaseService().beginTx(); } + @SuppressWarnings("unused") @PostConstruct public Neo4jTemplate postConstruct() { infrastructure.postConstruct(); return this; } - + @Override public boolean isNodeEntity(Class targetType) { return infrastructure.getMappingContext().isNodeEntity(targetType); } - public boolean isRelationshipEntity(Class targetType) { + @Override + public boolean isRelationshipEntity(Class targetType) { return infrastructure.getMappingContext().isRelationshipEntity(targetType); } @@ -350,6 +350,7 @@ public T exec(final GraphCallback callback) { TransactionTemplate template = new TransactionTemplate(infrastructure.getTransactionManager()); return template.execute(new TransactionCallback() { + @Override public T doInTransaction(TransactionStatus status) { return doExecute(callback); } @@ -357,7 +358,6 @@ public T doInTransaction(TransactionStatus status) { } @Override - @SuppressWarnings("unchecked") public Node getReferenceNode() { try { return infrastructure.getGraphDatabase().getReferenceNode(); @@ -408,7 +408,7 @@ public void doWithGraphWithoutResult(GraphDatabase graph) throws Exception { @Override @SuppressWarnings("unchecked") public Result convert(Iterable iterable) { - return new QueryResultBuilder(iterable, (ResultConverter) infrastructure.getResultConverter()); + return new QueryResultBuilder(iterable, infrastructure.getResultConverter()); } @Override