org.springframework.batch.item.data

## Class Neo4jItemWriter<T>

- java.lang.Object
- - org.springframework.batch.item.data.Neo4jItemWriter<T>

- All Implemented Interfaces:
    ItemWriter<T>, org.springframework.beans.factory.InitializingBean

      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 using an implementation of Spring Data's `Neo4jOperations`.

  This writer is thread-safe once all properties are set (normal singleton behavior) so it can be used in multiple concurrent transactions.

  Author:
    Michael Minella

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.apache.commons.logging.Log` | `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Neo4jItemWriter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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)`
    `void` | `setTemplate(org.springframework.data.neo4j.template.Neo4jOperations template)` Set the `Neo4jOperations` to be used to save items
    `void` | `write(java.util.List<? extends T> items)` Write all items to the data store.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### logger

          protected static final org.apache.commons.logging.Log logger

  - ### Constructor Detail

    - #### Neo4jItemWriter

          public Neo4jItemWriter()

  - ### Method Detail

    - #### setDelete

          public void setDelete(boolean delete)

    - #### setTemplate

          public void setTemplate(org.springframework.data.neo4j.template.Neo4jOperations template)

      Set the `Neo4jOperations` to be used to save items
      Parameters:
        `template` - the template implementation to be used

    - #### afterPropertiesSet

          public void afterPropertiesSet()
                                  throws java.lang.Exception

      Checks mandatory properties
      Specified by:
        `afterPropertiesSet` in interface `org.springframework.beans.factory.InitializingBean`
      Throws:
        `java.lang.Exception`
      See Also:
        `InitializingBean.afterPropertiesSet()`

    - #### write

          public void write(java.util.List<? extends T> items)
                     throws java.lang.Exception

      Write all items to the data store.
      Specified by:
        `write` in interface `ItemWriter<T>`
      Parameters:
        `items` - items to be written
      Throws:
        `java.lang.Exception` - if there are errors. The framework will catch the exception and convert or rethrow it as appropriate.
      See Also:
        `ItemWriter.write(java.util.List)`

    - #### doWrite

          protected void doWrite(java.util.List<? extends T> items)

      Performs the actual write using the template. This can be overriden by a subclass if necessary.
      Parameters:
        `items` - the list of items to be persisted.