## org.eclipse.emf.transaction.impl
Interface InternalTransaction

All Superinterfaces:
  Transaction

All Known Implementing Classes:
  EMFCommandTransaction, EMFOperationTransaction, NonEMFTransaction, TransactionImpl, TriggerCommandTransaction

    public interface InternalTransaction

extends Transaction

An internal interface that must be provided by any implementation of the public `Transaction` interface, in order to function correctly in the transactional editing domain framework.

Nested Class Summary

Nested classes/interfaces inherited from interface org.eclipse.emf.transaction.Transaction
`Transaction.OptionMetadata`

Field Summary

Fields inherited from interface org.eclipse.emf.transaction.Transaction
`OPTION_IS_UNDO_REDO_TRANSACTION, OPTION_NO_NOTIFICATIONS, OPTION_NO_TRIGGERS, OPTION_NO_UNDO, OPTION_NO_VALIDATION, OPTION_UNPROTECTED, OPTION_VALIDATE_EDIT, OPTION_VALIDATE_EDIT_CONTEXT`

Method Summary
`void` `abort(IStatus status)` Aborts the transaction with a reason given by the specified status.
`void` `add(org.eclipse.emf.common.notify.Notification notification)` Adds the specified notification to the list of notifications received during this transaction.
`void` `addTriggers(TriggerCommand triggers)` Adds a group of triggers that were executed during my commit.
`void` `endPrivileged(PrivilegedRunnable<?> runnable)` Returns me to my previous owner, upon completion of the specified privileged runnable.
`List<org.eclipse.emf.common.notify.Notification>` `getNotifications()` Obtains the list of notifications that were received during execution of this transaction.
`InternalTransaction` `getRoot()` Obtains the root transaction (the one that has no parent).
`org.eclipse.emf.common.command.Command` `getTriggers()` Obtains the triggers that were executed during my commit.
`boolean` `isRollingBack()` Queries whether this transaction or any of its ancestors is in the process of rolling back.
`void` `pause()` Pauses me while a child transaction is active, so that I do not collect either notifications or recorded changes during that time.
`void` `resume(TransactionChangeDescription nestedChanges)` Resumes me after completion of a child transaction.
`void` `setParent(InternalTransaction parent)` Assigns my parent transaction (the one in which I am nested).
`void` `setStatus(IStatus status)` Sets the status of the transaction.
`void` `start()` Starts me.
`void` `startPrivileged(PrivilegedRunnable<?> runnable)` Transfers ownership of this transaction to the specified privileged runnable.

Methods inherited from interface org.eclipse.emf.transaction.Transaction
`commit, getChangeDescription, getEditingDomain, getOptions, getOwner, getParent, getStatus, isActive, isReadOnly, rollback, yield`

Method Detail

### getRoot

    InternalTransaction getRoot()

  Obtains the root transaction (the one that has no parent). This could be me if I am the root.

  Returns:
    the root transaction in a nested transaction structure

### setParent

    void setParent(InternalTransaction parent)

  Assigns my parent transaction (the one in which I am nested). This must be done by the editing domain immediately upon activating me.

  Parameters:
    `parent` - my parent transaction

### start

    void start()
               throws InterruptedException

  Starts me. Usually, this will delegate to the editing domain to `activate` me.

  Note that this call should block the current thread until the editing domain grants exclusive access.

  Throws:
    `InterruptedException` - if the current thread is interrupted while waiting for activation

### abort

    void abort(IStatus status)

  Aborts the transaction with a reason given by the specified status. This is used, for example, when a transaction is corrupted by another thread concurrently writing the model (obviously without an active transaction!). The transaction is expected to rollback when it attempts to commit, and to propagate this status up to the root transaction.

  Parameters:
    `status` - a status object providing the reason. It should be the status attached to the eventual `RollbackException`, and should be set as my `status`

### add

    void add(org.eclipse.emf.common.notify.Notification notification)

  Adds the specified notification to the list of notifications received during this transaction.

  Parameters:
    `notification` - the notification to add
  See Also:
    `getNotifications()`

### getNotifications

    List<org.eclipse.emf.common.notify.Notification> getNotifications()

  Obtains the list of notifications that were received during execution of this transaction. These are the notifications that later will be sent to pre-commit listeners, validation, and eventually to post-commit listeners (if I successfully commit).

  Returns:
    my notifications
  See Also:
    `add(Notification)`

### pause

    void pause()

  Pauses me while a child transaction is active, so that I do not collect either notifications or recorded changes during that time.

### resume

    void resume(TransactionChangeDescription nestedChanges)

  Resumes me after completion of a child transaction. If the child committed, then I add its change description to my changes.

  Parameters:
    `nestedChanges` - the nested transaction's recorded changes, or `null` if it rolled back (in which case, I do not add anything to my changes)

### setStatus

    void setStatus(IStatus status)

  Sets the status of the transaction.

  Parameters:
    `status` - my status

### isRollingBack

    boolean isRollingBack()

  Queries whether this transaction or any of its ancestors is in the process of rolling back.

  Returns:
    `true` if I or my `parent` (if any) am rolling back; `false` otherwise

### getTriggers

    org.eclipse.emf.common.command.Command getTriggers()

  Obtains the triggers that were executed during my commit.

  Returns:
    my pre-commit trigger commands, or `null` if I have no triggers (perhaps because the `Transaction.OPTION_NO_TRIGGERS` was applied). This may be a single `Command` or a compound of multiple

### addTriggers

    void addTriggers(TriggerCommand triggers)

  Adds a group of triggers that were executed during my commit.

  Parameters:
    `triggers` - the triggers to add

### startPrivileged

    void startPrivileged(PrivilegedRunnable<?> runnable)

  Transfers ownership of this transaction to the specified privileged runnable.

  Parameters:
    `runnable` - the runnable whose thread is to borrow me

### endPrivileged

    void endPrivileged(PrivilegedRunnable<?> runnable)

  Returns me to my previous owner, upon completion of the specified privileged runnable.

  Parameters:
    `runnable` - the runnable whose thread had borrowed me

Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved.