Package com.io7m.idstore.database.api

# Interface IdDatabaseTransactionType

All Superinterfaces:
  `AutoCloseable`

public interface IdDatabaseTransactionType extends AutoCloseable
A database transaction. If the transaction is closed, it is automatically rolled back.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `UUID`
  `adminId()`
  `void`
  `adminIdSet(UUID adminId)`
  Set the admin ID for the transaction.
  `void`
  `close()`
  `void`
  `commit()`
  Commit the transaction.
  `UUID`
  `executorId()`
  Determine the executor ID.
  `<T extends IdDatabaseQueriesType>
  T`
  `queries(Class<T> queryClass)`
  Obtain queries for the transaction.
  `void`
  `rollback()`
  Roll back the transaction.
  `UUID`
  `userId()`
  `void`
  `userIdSet(UUID userId)`
  Set the user ID for the transaction.

- ## Method Details

  - ### close

    void close() throws IdDatabaseException
    Specified by:
      `close` in interface `AutoCloseable`
    Throws:
      `IdDatabaseException`

  - ### queries

    <T extends IdDatabaseQueriesType> T queries(Class<T> queryClass) throws IdDatabaseException
    Obtain queries for the transaction.
    Type Parameters:
      `T` - The query type
    Parameters:
      `queryClass` - The query type
    Returns:
      Queries
    Throws:
      `IdDatabaseException` - On errors

  - ### rollback

    void rollback() throws IdDatabaseException
    Roll back the transaction.
    Throws:
      `IdDatabaseException` - On errors

  - ### commit

    void commit() throws IdDatabaseException
    Commit the transaction.
    Throws:
      `IdDatabaseException` - On errors

  - ### userIdSet

    void userIdSet(UUID userId) throws IdDatabaseException
    Set the user ID for the transaction. This is the ID that will typically end up in audit events.
    Parameters:
      `userId` - The user ID
    Throws:
      `IdDatabaseException` - On errors

  - ### userId

    UUID userId() throws IdDatabaseException
    Returns:
      The current user ID
    Throws:
      `IdDatabaseException` - On errors

  - ### adminIdSet

    void adminIdSet(UUID adminId) throws IdDatabaseException
    Set the admin ID for the transaction. This is the ID that will typically end up in audit events.
    Parameters:
      `adminId` - The admin ID
    Throws:
      `IdDatabaseException` - On errors

  - ### adminId

    UUID adminId() throws IdDatabaseException
    Returns:
      The current admin ID
    Throws:
      `IdDatabaseException` - On errors

  - ### executorId

    UUID executorId() throws IdDatabaseException
    Determine the executor ID. This is the value set by whichever of `adminIdSet(UUID)` or `userIdSet(UUID)` has been called most recently.
    Returns:
      The current executor ID
    Throws:
      `IdDatabaseException` - On errors