public class TransactionFilter extends Object implements Filter
Mentawai filter for transaction managment. This filters starts a transaction before the action's execution and commits or rollbacks the transaction after the action's execution, depending on the the action's execution result.
The default value for commiting the transaction is SUCCESS but this can be configurated, passing a list of results that allow the commit of the transactionon.
Also, if a exception is throwed by the action's execution, the transaction is rollbacked.
The transaction filter requires that in the moment that the action's executed is filtered the action's input have an object of a org.mentawai.transaction.Transation implementation class. This object may be injected by the IoCFilter. See the site documentation for details.
The default expected key of the transaction is "transaction", but that can be changed.
| Modifier and Type | Field and Description |
|---|---|
static String |
TRANSACTION_KEY |
| Constructor and Description |
|---|
TransactionFilter()
Creates a new TransactionFilter using the default key for the transaction and the default result for the transaction commit.
|
TransactionFilter(boolean onlyPost) |
TransactionFilter(String transaction_key)
Creates a new TransactionFilter using the given key for the transaction and the default result for the transaction commit.
|
TransactionFilter(String transaction_key,
boolean onlyPost) |
| Modifier and Type | Method and Description |
|---|---|
TransactionFilter |
commitOn(String... results) |
void |
destroy()
Do nothing.
|
String |
filter(InvocationChain chain)
Filters the action, begining a transaction before the action's execution and commiting or rollbacking the trasaction after the action's exection depending on the result.
|
Set<String> |
getResultsForCommit() |
Set<String> |
getResultsForRollback() |
TransactionFilter |
rollbackOn(String... results) |
public static String TRANSACTION_KEY
public TransactionFilter()
public TransactionFilter(boolean onlyPost)
public TransactionFilter(String transaction_key)
transaction_key - public TransactionFilter(String transaction_key, boolean onlyPost)
public TransactionFilter commitOn(String... results)
public TransactionFilter rollbackOn(String... results)
public String filter(InvocationChain chain) throws Exception
public Set<String> getResultsForCommit()
Copyright © 2015. All Rights Reserved.