Class FHIRUserTransactionAdapter

  • All Implemented Interfaces:
    com.ibm.fhir.persistence.FHIRPersistenceTransaction

    public class FHIRUserTransactionAdapter
    extends Object
    implements com.ibm.fhir.persistence.FHIRPersistenceTransaction
    Adapter to simplify transaction handling. This object is returned by FHIRPersistenceJDBCImpl and can be used instead of the old FHIRTransactionHelper
    • Method Detail

      • begin

        public void begin()
                   throws com.ibm.fhir.persistence.exception.FHIRPersistenceException
        If a transaction has not yet been started on this thread, then start one.
        Specified by:
        begin in interface com.ibm.fhir.persistence.FHIRPersistenceTransaction
        Throws:
        com.ibm.fhir.persistence.exception.FHIRPersistenceException
      • end

        public void end()
                 throws com.ibm.fhir.persistence.exception.FHIRPersistenceException
        If we previously started a transaction on this thread using this helper instance, then commit it now.
        Specified by:
        end in interface com.ibm.fhir.persistence.FHIRPersistenceTransaction
        Throws:
        com.ibm.fhir.persistence.exception.FHIRPersistenceException
      • setRollbackOnly

        public void setRollbackOnly()
                             throws com.ibm.fhir.persistence.exception.FHIRPersistenceException
        Specified by:
        setRollbackOnly in interface com.ibm.fhir.persistence.FHIRPersistenceTransaction
        Throws:
        com.ibm.fhir.persistence.exception.FHIRPersistenceException
      • isTransactional

        public boolean isTransactional()
        Specified by:
        isTransactional in interface com.ibm.fhir.persistence.FHIRPersistenceTransaction
      • isActive

        protected boolean isActive​(int status)
        Is there a transaction currently on this thread?
        Returns:
        true if a global transaction is active on the current thread
      • isMarkedForRollback

        protected boolean isMarkedForRollback​(int status)
        Has this transaction been marked for rollback?
        Returns:
      • isNoTransaction

        protected boolean isNoTransaction​(int status)
        Are we in the NO TRANSACTION state?
        Parameters:
        status -
        Returns:
      • func

        <T> T func​(Supplier<T> s)
            throws com.ibm.fhir.persistence.exception.FHIRPersistenceException
        Call the supplier function within a begin/end
        Type Parameters:
        T -
        Parameters:
        s -
        Returns:
        Throws:
        com.ibm.fhir.persistence.exception.FHIRPersistenceException
      • hasBegun

        public boolean hasBegun()
                         throws com.ibm.fhir.persistence.exception.FHIRPersistenceException
        Specified by:
        hasBegun in interface com.ibm.fhir.persistence.FHIRPersistenceTransaction
        Throws:
        com.ibm.fhir.persistence.exception.FHIRPersistenceException