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
-
Constructor Summary
ConstructorDescriptionEventTransaction
(org.apache.cayenne.tx.Transaction txn) Create an EventTransaction and set the txn with the given parameter -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(org.apache.cayenne.tx.TransactionListener listener) void
begin()
void
commit()
getOrCreateConnection
(String connectionName, DataSource dataSource) boolean
boolean
Return true if changes in the current transaction should raise event or false otherwise.boolean
void
rollback()
void
setGenerateEvent
(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:
begin
in interfaceorg.apache.cayenne.tx.Transaction
-
commit
public void commit()- Specified by:
commit
in interfaceorg.apache.cayenne.tx.Transaction
-
rollback
public void rollback()- Specified by:
rollback
in interfaceorg.apache.cayenne.tx.Transaction
-
setRollbackOnly
public void setRollbackOnly()- Specified by:
setRollbackOnly
in interfaceorg.apache.cayenne.tx.Transaction
-
isRollbackOnly
public boolean isRollbackOnly()- Specified by:
isRollbackOnly
in interfaceorg.apache.cayenne.tx.Transaction
-
getOrCreateConnection
public Connection getOrCreateConnection(String connectionName, DataSource dataSource) throws SQLException - Specified by:
getOrCreateConnection
in interfaceorg.apache.cayenne.tx.Transaction
- Throws:
SQLException
-
getConnections
- Specified by:
getConnections
in interfaceorg.apache.cayenne.tx.Transaction
-
addListener
public void addListener(org.apache.cayenne.tx.TransactionListener listener) - Specified by:
addListener
in interfaceorg.apache.cayenne.tx.Transaction
-
isExternal
public boolean isExternal()- Specified by:
isExternal
in 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
-