Package com.avoka.fc.core.tx
Class EventTransaction
java.lang.Object
com.avoka.fc.core.tx.EventTransaction
- All Implemented Interfaces:
org.apache.cayenne.tx.Transaction
This class follows Decorator pattern.
It gets a cayenne Transaction Object and performs additional functionality without changing the original behavior of that Object.
We are using this class to recognise transaction Object which is created in Groovy Console and might be rollback.
Also, if generateEvent flag is enabled, EventListener will raise events, otherwise does nothing.
- Since:
- 23.04.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEventTransaction(org.apache.cayenne.tx.Transaction txn) Create an EventTransaction and set the txn with the given parameter -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(org.apache.cayenne.tx.TransactionListener listener) voidbegin()voidcommit()getOrCreateConnection(String connectionName, DataSource dataSource) booleanbooleanReturn true if changes in the current transaction should raise event or false otherwise.booleanvoidrollback()voidsetGenerateEvent(boolean generateEvent) set the generateEvent value.void
-
Field Details
-
txn
protected org.apache.cayenne.tx.Transaction txn
-
-
Constructor Details
-
EventTransaction
public EventTransaction(org.apache.cayenne.tx.Transaction txn) Create an EventTransaction and set the txn with the given parameter- Parameters:
txn- the original Cayenne Transaction
-
-
Method Details
-
begin
public void begin()- Specified by:
beginin interfaceorg.apache.cayenne.tx.Transaction
-
commit
public void commit()- Specified by:
commitin interfaceorg.apache.cayenne.tx.Transaction
-
rollback
public void rollback()- Specified by:
rollbackin interfaceorg.apache.cayenne.tx.Transaction
-
setRollbackOnly
public void setRollbackOnly()- Specified by:
setRollbackOnlyin interfaceorg.apache.cayenne.tx.Transaction
-
isRollbackOnly
public boolean isRollbackOnly()- Specified by:
isRollbackOnlyin interfaceorg.apache.cayenne.tx.Transaction
-
getOrCreateConnection
public Connection getOrCreateConnection(String connectionName, DataSource dataSource) throws SQLException - Specified by:
getOrCreateConnectionin interfaceorg.apache.cayenne.tx.Transaction- Throws:
SQLException
-
getConnections
- Specified by:
getConnectionsin interfaceorg.apache.cayenne.tx.Transaction
-
addListener
public void addListener(org.apache.cayenne.tx.TransactionListener listener) - Specified by:
addListenerin interfaceorg.apache.cayenne.tx.Transaction
-
isExternal
public boolean isExternal()- Specified by:
isExternalin interfaceorg.apache.cayenne.tx.Transaction
-
isGenerateEvent
public boolean isGenerateEvent()Return true if changes in the current transaction should raise event or false otherwise.- Returns:
- true if changes in the current transaction should raise event or false otherwise
-
setGenerateEvent
public void setGenerateEvent(boolean generateEvent) set the generateEvent value. if set to true, changes in the current transaction should raise event.- Parameters:
generateEvent- the generateEvent value
-