public interface TransactionManager
ReadOnlyModelException
Modifier and Type | Interface and Description |
---|---|
static class |
TransactionManager.TransactionOptions
Transaction options.
|
Modifier and Type | Method and Description |
---|---|
void |
addTransactionCommitListener(TransactionCommitListener listener)
Adds new listener to listen transaction commits (post commits) events.
|
void |
commit()
Stops transaction.
|
java.util.Collection<TransactionCommitListener> |
getListeners() |
java.util.Collection<TransactionCommitListener> |
getListenersForFiring() |
ModelValidator |
getModelValidator()
Get validation hook which validates model integrity.
|
boolean |
isStarted() |
void |
removeTransactionCommitListener(TransactionCommitListener listener)
Removes listener from transaction commit listeners.
|
void |
runTransaction(java.lang.Runnable r)
Runs given code in new transaction.
|
void |
runTransaction(java.lang.Runnable r,
TransactionManager.TransactionOptions options)
Runs given code in new transaction.
|
void |
setInvalidModelHandler(InvalidModelHandler handler)
Sets handler which fixes model with verification errors.
|
void |
setModelValidator(ModelValidator validator)
Sets validation hook which validates model integrity.
|
void |
start()
Starts transaction.
|
void |
start(TransactionManager.TransactionOptions options)
Starts with given options.
|
void runTransaction(java.lang.Runnable r, TransactionManager.TransactionOptions options) throws RollbackException, TransactionAlreadyStartedException
r
- code to run.options
- transaction options to run.RollbackException
- when model verification fails, and InvalidModelHandler
TransactionAlreadyStartedException
- when transaction already running.void runTransaction(java.lang.Runnable r) throws RollbackException, TransactionAlreadyStartedException
TransactionAlreadyStartedException
is thrown.r
- code to run.RollbackException
- when model verification fails, and InvalidModelHandler
TransactionAlreadyStartedException
- If currently transaction is running.void start() throws TransactionAlreadyStartedException
TransactionAlreadyStartedException
- when there is running transaction.boolean isStarted()
void commit() throws RollbackException, TransactionAlreadyCommitedException
RollbackException
is thrownRollbackException
- when transaction validation fails, and there is no way to fix model
except undoing last action.TransactionAlreadyCommitedException
- when transaction is not started.void start(TransactionManager.TransactionOptions options) throws TransactionAlreadyStartedException
ReadOnlyModelException
If transaction
Read only transactions are deprecated - normally queries on model can be done without
transaction, and all modifications must be done through transaction.options
- transaction optionsTransactionAlreadyStartedException
- if transaction is already startedvoid setInvalidModelHandler(InvalidModelHandler handler)
handler
- handler which fixes model.void setModelValidator(ModelValidator validator)
validator
- which validates model integrity.ModelValidator getModelValidator()
void addTransactionCommitListener(TransactionCommitListener listener)
listener
- listener to add.void removeTransactionCommitListener(TransactionCommitListener listener)
listener
- listener to remove.java.util.Collection<TransactionCommitListener> getListeners()
java.util.Collection<TransactionCommitListener> getListenersForFiring()