public class Neo4jItemWriter<T> extends java.lang.Object implements ItemWriter<T>, org.springframework.beans.factory.InitializingBean
A ItemWriter
implementation that writes to a Neo4j database.
This writer is thread-safe once all properties are set (normal singleton behavior) so it can be used in multiple concurrent transactions.
Modifier and Type | Field and Description |
---|---|
protected static org.apache.commons.logging.Log |
logger |
Constructor and Description |
---|
Neo4jItemWriter() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Checks mandatory properties
|
protected void |
doWrite(java.util.List<? extends T> items)
Performs the actual write using the template.
|
void |
setDelete(boolean delete)
Boolean flag indicating whether the writer should save or delete the item at write
time.
|
void |
setSessionFactory(org.neo4j.ogm.session.SessionFactory sessionFactory)
Establish the session factory that will be used to create
Session instances
for interacting with Neo4j. |
void |
write(java.util.List<? extends T> items)
Write all items to the data store.
|
public void setDelete(boolean delete)
delete
- true if write should delete item, false if item should be saved.
Default is false.public void setSessionFactory(org.neo4j.ogm.session.SessionFactory sessionFactory)
Session
instances
for interacting with Neo4j.sessionFactory
- sessionFactory to be used.public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
InitializingBean.afterPropertiesSet()
public void write(java.util.List<? extends T> items) throws java.lang.Exception
write
in interface ItemWriter<T>
items
- items to be writtenjava.lang.Exception
- if there are errors. The framework will catch the
exception and convert or rethrow it as appropriate.ItemWriter.write(java.util.List)
protected void doWrite(java.util.List<? extends T> items)
items
- the list of items to be persisted.