|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mentawai.filter.TransactionFilter
public class TransactionFilter
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.
| Field Summary | |
|---|---|
static String |
TRANSACTION_KEY
|
| Constructor Summary | |
|---|---|
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)
|
|
| Method Summary | |
|---|---|
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)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static String TRANSACTION_KEY
| Constructor Detail |
|---|
public TransactionFilter()
public TransactionFilter(boolean onlyPost)
public TransactionFilter(String transaction_key)
transaction_key -
public TransactionFilter(String transaction_key,
boolean onlyPost)
| Method Detail |
|---|
public TransactionFilter commitOn(String... results)
public TransactionFilter rollbackOn(String... results)
public String filter(InvocationChain chain)
throws Exception
filter in interface Filterchain - The InvocationChain for the action this filter is being applied to.
Exceptionpublic Set<String> getResultsForCommit()
public Set<String> getResultsForRollback()
public void destroy()
destroy in interface Filter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||