Class TransactionEvent
java.lang.Object
com.aquima.interactions.profile.events.TransactionEvent
- All Implemented Interfaces:
IEvent
,ITransactionEvent
Event class which holds the information about a transaction related event.
- Since:
- 5.0
- Author:
- O. Kerpershoek
-
Method Summary
Modifier and TypeMethodDescriptionstatic IEvent
Constructs a commit transaction event for the specified name and level.int
The level inside the transaction.A created transaction has a name, to enforce nested transactions to return to the desired level on a commit or rollback.int
getType()
This method will return the type of the event.void
invokeEventHook
(IEventListener listener) The invoke event hook method will be triggered for every listener that is registered to receive events.static IEvent
Constructs a roll-back transaction event for the specified name and level.static IEvent
Constructs a start transaction event for the specified name and level.
-
Method Details
-
start
Constructs a start transaction event for the specified name and level.- Parameters:
transactionName
- The name of the transaction.transactionLevel
- The level of the transaction.- Returns:
- The transaction event for the specified parameters.
-
commit
Constructs a commit transaction event for the specified name and level.- Parameters:
transactionName
- The name of the transaction.transactionLevel
- The level of the transaction.- Returns:
- The transaction event for the specified parameters.
-
rollback
Constructs a roll-back transaction event for the specified name and level.- Parameters:
transactionName
- The name of the transaction.transactionLevel
- The level of the transaction.- Returns:
- The transaction event for the specified parameters.
-
getType
public int getType()Description copied from interface:IEvent
This method will return the type of the event. The type of the event is used to determine which event listeners should be invoked. -
getTransactionName
Description copied from interface:ITransactionEvent
A created transaction has a name, to enforce nested transactions to return to the desired level on a commit or rollback.- Specified by:
getTransactionName
in interfaceITransactionEvent
- Returns:
- The name of the transaction.
-
getTransactionLevel
public int getTransactionLevel()Description copied from interface:ITransactionEvent
The level inside the transaction. Just before the action is executed. At the first startTransaction this level will be 0, at the last commit action before all actions are committed the level will be 1.- Specified by:
getTransactionLevel
in interfaceITransactionEvent
- Returns:
- Integer with the level of the transaction.
-
invokeEventHook
Description copied from interface:IEvent
The invoke event hook method will be triggered for every listener that is registered to receive events. The event class that implements this interface should check if the listener that is passed as argument supports this event, and invoke the correct method of the listener to notify the listener.
For example: A context switch event can check if the listener contains a method 'onContextSwitch' and invoke that method when found.- Specified by:
invokeEventHook
in interfaceIEvent
- Parameters:
listener
- IEventListener that should be notified of the event.
-