protected TransactionStatus getTransaction() {
    if (null == transactionManager) {
      return null;
    }

    final TransactionStatus status = transactionManager.getTransaction(TRANSACTION_DEFINITION);
    return status;
  }
  /** Borrowed from Seam */
  public int getStatus() {
    if (ptm == null) {
      return TransactionManager.STATUS_NO_TRANSACTION;
    }

    // logger.debug( "Current TX name (According to TransactionSynchronizationManager) : " +
    // TransactionSynchronizationManager.getCurrentTransactionName() );
    if (TransactionSynchronizationManager.isActualTransactionActive()) {
      TransactionStatus transaction = null;
      boolean commitNewTransaction = false;
      try {
        if (currentTransaction.size() == 0) {
          transaction = ptm.getTransaction(td);
          currentTransaction.push(transaction);
          commitNewTransaction = true;
          if (transaction.isNewTransaction()) {
            return TransactionManager.STATUS_COMMITTED;
          }
        } else {
          transaction = currentTransaction.peek();
        }
        logger.debug("Current TX: " + transaction);
        // If SynchronizationManager thinks it has an active transaction but
        // our transaction is a new one
        // then we must be in the middle of committing
        if (transaction.isCompleted()) {
          if (transaction.isRollbackOnly()) {
            return TransactionManager.STATUS_ROLLEDBACK;
          }
          return TransactionManager.STATUS_COMMITTED;
        } else {
          if (transaction.isRollbackOnly()) {
            return 5;
          }
          return TransactionManager.STATUS_ACTIVE;
        }
      } finally {
        if (commitNewTransaction) {
          ptm.commit(transaction);
        }
      }
    }
    return TransactionManager.STATUS_NO_TRANSACTION;
  }
 protected void rollbackTransaction(TransactionStatus status) {
   if (null != transactionManager && null != status && !status.isCompleted()) {
     LOG.warn("Transaction Rollback");
     transactionManager.rollback(status);
   }
 }
 protected void commitTransaction(TransactionStatus status) {
   if (null != transactionManager && null != status) {
     transactionManager.commit(status);
   }
 }
 public HumanTaskSpringTransactionManager(AbstractPlatformTransactionManager ptm) {
   this.ptm = ptm;
   this.nestedTransactions = ptm.isNestedTransactionAllowed();
 }