📄 executionservicebean.java
字号:
package org.jbpm.ejb.impl;
import java.rmi.*;
import java.util.*;
import javax.ejb.*;
import org.apache.commons.logging.*;
import org.jbpm.*;
import org.jbpm.model.definition.*;
import org.jbpm.model.log.*;
import org.jbpm.service.*;
/**
* @ejb.bean
* name="JbpmExecutionService"
* view-type="remote"
* type="Stateless"
* jndi-name="java/JbpmExecutionService"
* transaction-type="Container"
*
* @ejb.transaction
* type="Required"
*
* @ejb.home
* remote-class="org.jbpm.ejb.ExecutionServiceRemoteHome"
*
* @ejb.interface
* remote-class="org.jbpm.ejb.ExecutionServiceRemote"
*
* @jboss.clustered
* @jboss.cluster-config
*/
public class ExecutionServiceBean implements SessionBean {
private SessionContext ejbSessionContext = null;
private ExecutionServiceImpl executionService = null;
public void setSessionContext(SessionContext ejbSessionContext) throws EJBException, RemoteException {
this.ejbSessionContext = ejbSessionContext;
}
public void ejbCreate() {
JbpmConfiguration.configure( ExecutionServiceBean.class.getClassLoader(), "jbpm.server.properties" );
executionService = new ExecutionServiceImpl( JbpmConfiguration.getInstance() );
}
public void ejbActivate() throws EJBException, RemoteException {}
public void ejbPassivate() throws EJBException, RemoteException {}
public void ejbRemove() throws EJBException, RemoteException {}
public Definition getLatestDefinition( String name ) throws RemoteException {
return executionService.getLatestDefinition( name );
}
public InvocationLog startProcessInstance( String actorId, Long definitionId, Map variables, String transitionName ) throws ExecutionException {
InvocationLog invocationLog = null;
try {
invocationLog = executionService.startProcessInstance( actorId, definitionId, variables, transitionName );
} catch ( ExecutionException e ) {
log.error( "ExecutionException in ExecutionServiceBean. Forcing the container transaction to rollback...", e );
ejbSessionContext.setRollbackOnly();
throw e;
} catch ( RuntimeException e ) {
log.error( "RuntimeException in ExecutionServiceBean. Forcing the container transaction to rollback...", e );
ejbSessionContext.setRollbackOnly();
throw e;
}
return invocationLog;
}
public InvocationLog endOfState( String actorId, Long tokenId, Map variables, String transitionName ) throws ExecutionException, RemoteException {
InvocationLog invocationLog = null;
try {
invocationLog = executionService.endOfState( actorId, tokenId, variables, transitionName );
} catch ( ExecutionException e ) {
log.error( "ExecutionException in ExecutionServiceBean. Forcing the container transaction to rollback...", e );
ejbSessionContext.setRollbackOnly();
throw e;
} catch ( RuntimeException e ) {
log.error( "RuntimeException in ExecutionServiceBean. Forcing the container transaction to rollback...", e );
ejbSessionContext.setRollbackOnly();
throw e;
}
return invocationLog;
}
private static Log log = LogFactory.getLog(ExecutionServiceBean.class);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -