ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.vci.transaction;
 
import org.jbpm.api.JbpmException;
import org.jbpm.api.cmd.Command;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.svc.Interceptor;
import org.jbpm.pvm.internal.tx.StandardTransaction;
 
public class JBPMTransactionInterceptor extends Interceptor {
 
    public <T> T execute(Command<T> command) {
        EnvironmentImpl environment = EnvironmentImpl.getCurrent();
        if (environment == null) {
            throw new JbpmException("no environment for managing hibernate transaction");
        }
        
        StandardTransaction standardTransaction = (StandardTransaction)environment.get(StandardTransaction.class);
        if (standardTransaction == null) {
            throw new JbpmException("no standard-transaction in environment");
        }
        try
            {
                return this.next.execute(command);
            }
            catch (RuntimeException e)
            {
                throw e;
            }
        finally {
        }
    }
 
}