Class ThrowingTransactionTemplate
java.lang.Object
com.atlassian.confluence.plugins.contentproperty.transaction.ThrowingTransactionTemplate
TransactionTemplate that supports throwing checked exceptions.
- Since:
- 5.6
-
Constructor Summary
ConstructorsConstructorDescriptionThrowingTransactionTemplate
(TransactionalHostContextAccessor hostContextAccessor) -
Method Summary
Modifier and TypeMethodDescription<T,
X extends Exception>
Texecute
(Class<X> exceptionType, TransactionalHostContextAccessor.Permission permission, ThrowingTransactionCallback<T, X> callback) Runs an action in a transaction and returns a optional value.<T,
X extends Exception>
Texecute
(Class<X> exceptionType, TransactionalHostContextAccessor.Propagation propagation, ThrowingTransactionCallback<T, X> callback) Runs an action in a transaction and returns a optional value.<T,
X extends Exception>
Texecute
(Class<X> exceptionType, TransactionalHostContextAccessor.Propagation propagation, TransactionalHostContextAccessor.Permission permission, ThrowingTransactionCallback<T, X> callback) Runs an action in a transaction and returns a optional value.execute
(Class<X1> exceptionType, Class<X2> exceptionType2, TransactionalHostContextAccessor.Permission permission, Throwing2TransactionCallback<T, X1, X2> callback) Runs an action in a transaction and returns a optional value.execute
(Class<X1> exceptionType, Class<X2> exceptionType2, TransactionalHostContextAccessor.Propagation propagation, Throwing2TransactionCallback<T, X1, X2> callback) Runs an action in a transaction and returns a optional value.execute
(Class<X1> exceptionType, Class<X2> exceptionType2, TransactionalHostContextAccessor.Propagation propagation, TransactionalHostContextAccessor.Permission permission, Throwing2TransactionCallback<T, X1, X2> callback) Runs an action in a transaction and returns a optional value.
-
Constructor Details
-
ThrowingTransactionTemplate
-
-
Method Details
-
execute
public <T,X extends Exception> T execute(Class<X> exceptionType, TransactionalHostContextAccessor.Propagation propagation, ThrowingTransactionCallback<T, X> callback) throws XRuns an action in a transaction and returns a optional value.- Parameters:
propagation
- the propagation mode to usecallback
- The callback class to execute- Returns:
- Optional result of the operation. May be null
- Throws:
X
- if it was thrown by the callbackRuntimeException
- if anything went wrong. The caller will be responsible for rolling back.
-
execute
public <T,X extends Exception> T execute(Class<X> exceptionType, TransactionalHostContextAccessor.Permission permission, ThrowingTransactionCallback<T, X> callback) throws XRuns an action in a transaction and returns a optional value. The transaction isTransactionalHostContextAccessor.Propagation.REQUIRED
.- Parameters:
permission
- ifTransactionalHostContextAccessor.Permission.READ_ONLY
, attempt to use a read only transactioncallback
- The callback class to execute- Returns:
- Optional result of the operation. May be null
- Throws:
X
- if it was thrown by the callbackRuntimeException
- if anything went wrong. The caller will be responsible for rolling back.
-
execute
public <T,X extends Exception> T execute(Class<X> exceptionType, TransactionalHostContextAccessor.Propagation propagation, TransactionalHostContextAccessor.Permission permission, ThrowingTransactionCallback<T, X> callback) throws XRuns an action in a transaction and returns a optional value.- Parameters:
propagation
- the propagation mode to usepermission
- ifTransactionalHostContextAccessor.Permission.READ_ONLY
, attempt to use a read only transactioncallback
- The callback class to execute- Returns:
- Optional result of the operation. May be null
- Throws:
X
- if it was thrown by the callbackRuntimeException
- if anything went wrong. The caller will be responsible for rolling back.
-
execute
public <T,X1 extends Exception, T executeX2 extends Exception> (Class<X1> exceptionType, Class<X2> exceptionType2, TransactionalHostContextAccessor.Propagation propagation, Throwing2TransactionCallback<T, X1, throws X1, X2X2> callback) Runs an action in a transaction and returns a optional value.- Parameters:
propagation
- the propagation mode to usecallback
- The callback class to execute- Returns:
- Optional result of the operation. May be null
- Throws:
X1
- if it was thrown by the callbackX2
- if it was thrown by the callbackRuntimeException
- if anything went wrong. The caller will be responsible for rolling back.
-
execute
public <T,X1 extends Exception, T executeX2 extends Exception> (Class<X1> exceptionType, Class<X2> exceptionType2, TransactionalHostContextAccessor.Permission permission, Throwing2TransactionCallback<T, X1, throws X1, X2X2> callback) Runs an action in a transaction and returns a optional value. The transaction isTransactionalHostContextAccessor.Propagation.REQUIRED
.- Parameters:
permission
- ifTransactionalHostContextAccessor.Permission.READ_ONLY
, attempt to use a read only transactioncallback
- The callback class to execute- Returns:
- Optional result of the operation. May be null
- Throws:
X1
- if it was thrown by the callbackX2
- if it was thrown by the callbackRuntimeException
- if anything went wrong. The caller will be responsible for rolling back.
-
execute
public <T,X1 extends Exception, T executeX2 extends Exception> (Class<X1> exceptionType, Class<X2> exceptionType2, TransactionalHostContextAccessor.Propagation propagation, TransactionalHostContextAccessor.Permission permission, Throwing2TransactionCallback<T, X1, throws X1, X2X2> callback) Runs an action in a transaction and returns a optional value.- Parameters:
propagation
- the propagation mode to usepermission
- ifTransactionalHostContextAccessor.Permission.READ_ONLY
, attempt to use a read only transactioncallback
- The callback class to execute- Returns:
- Optional result of the operation. May be null
- Throws:
X1
- if it was thrown by the callbackX2
- if it was thrown by the callbackRuntimeException
- if anything went wrong. The caller will be responsible for rolling back.
-