Class EventTransaction

java.lang.Object
com.avoka.fc.core.tx.EventTransaction
All Implemented Interfaces:
org.apache.cayenne.tx.Transaction

public class EventTransaction extends Object implements 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 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 interface org.apache.cayenne.tx.Transaction
    • commit

      public void commit()
      Specified by:
      commit in interface org.apache.cayenne.tx.Transaction
    • rollback

      public void rollback()
      Specified by:
      rollback in interface org.apache.cayenne.tx.Transaction
    • setRollbackOnly

      public void setRollbackOnly()
      Specified by:
      setRollbackOnly in interface org.apache.cayenne.tx.Transaction
    • isRollbackOnly

      public boolean isRollbackOnly()
      Specified by:
      isRollbackOnly in interface org.apache.cayenne.tx.Transaction
    • getOrCreateConnection

      public Connection getOrCreateConnection(String connectionName, DataSource dataSource) throws SQLException
      Specified by:
      getOrCreateConnection in interface org.apache.cayenne.tx.Transaction
      Throws:
      SQLException
    • getConnections

      public Map<String,Connection> getConnections()
      Specified by:
      getConnections in interface org.apache.cayenne.tx.Transaction
    • addListener

      public void addListener(org.apache.cayenne.tx.TransactionListener listener)
      Specified by:
      addListener in interface org.apache.cayenne.tx.Transaction
    • isExternal

      public boolean isExternal()
      Specified by:
      isExternal in interface org.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