TransactionEventHandler.Adapter (Neo4j Community 2.1.0-M01 API)
Date: 2014-02-20

org.neo4j.graphdb.event

## Class TransactionEventHandler.Adapter<T>

- java.lang.Object
- - org.neo4j.graphdb.event.TransactionEventHandler.Adapter<T>

- Type Parameters:
    `T` - the type of object communicated from a successful `beforeCommit(TransactionData)` to `afterCommit(TransactionData, Object)`.
  All Implemented Interfaces:
    TransactionEventHandler<T>
  Enclosing interface:
    TransactionEventHandler<T>

      public static class TransactionEventHandler.Adapter<T>
      extends Object
      implements TransactionEventHandler<T>

  Adapter for a `TransactionEventHandler`

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.neo4j.graphdb.event.TransactionEventHandler

      `TransactionEventHandler.Adapter<T>`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TransactionEventHandler.Adapter()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterCommit(TransactionData data, T state)` Invoked after the transaction has been committed successfully.
    `void` | `afterRollback(TransactionData data, T state)` Invoked after the transaction has been rolled back if committing the transaction failed for some reason.
    `T` | `beforeCommit(TransactionData data)` Invoked when a transaction is about to be committed.

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

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

- - ### Constructor Detail

    - #### TransactionEventHandler.Adapter

          public TransactionEventHandler.Adapter()

  - ### Method Detail

    - #### beforeCommit

          public T beforeCommit(TransactionData data)
                         throws Exception

      Description copied from interface: `TransactionEventHandler`
      Invoked when a transaction is about to be committed. If this method throws an exception the transaction will be rolled back and a `TransactionFailureException` will be thrown from `Transaction.close()`. The transaction is still open when this method is invoked, making it possible to perform mutating operations in this method. This is however highly discouraged. Changes made in this method are not guaranteed to be visible by this or other `TransactionEventHandler`s.
      Specified by:
        `beforeCommit` in interface `TransactionEventHandler<T>`
      Parameters:
        `data` - the changes that will be committed in this transaction.
      Returns:
        a state object (or `null`) that will be passed on to `TransactionEventHandler.afterCommit(TransactionData, Object)` or `TransactionEventHandler.afterRollback(TransactionData, Object)` of this object.
      Throws:
        `Exception` - to indicate that the transaction should be rolled back.

    - #### afterCommit

          public void afterCommit(TransactionData data,
                         T state)

      Description copied from interface: `TransactionEventHandler`
      Invoked after the transaction has been committed successfully.
      Specified by:
        `afterCommit` in interface `TransactionEventHandler<T>`
      Parameters:
        `data` - the changes that were committed in this transaction.
        `state` - the object returned by `TransactionEventHandler.beforeCommit(TransactionData)`.

    - #### afterRollback

          public void afterRollback(TransactionData data,
                           T state)

      Description copied from interface: `TransactionEventHandler`
      Invoked after the transaction has been rolled back if committing the transaction failed for some reason.
      Specified by:
        `afterRollback` in interface `TransactionEventHandler<T>`
      Parameters:
        `data` - the changes that were committed in this transaction.
        `state` - the object returned by `TransactionEventHandler.beforeCommit(TransactionData)`.

Copyright © 2002–2014 The Neo4j Graph Database Project. All rights reserved.