本文整理汇总了Java中org.activiti.engine.RuntimeService.startProcessInstanceById方法的典型用法代码示例。如果您正苦于以下问题:Java RuntimeService.startProcessInstanceById方法的具体用法?Java RuntimeService.startProcessInstanceById怎么用?Java RuntimeService.startProcessInstanceById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.RuntimeService
的用法示例。
在下文中一共展示了RuntimeService.startProcessInstanceById方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doExecute
import org.activiti.engine.RuntimeService; //导入方法依赖的package包/类
@Override
protected Object doExecute() {
ProcessEngine pe = this.getProcessEngine();
if (pe == null) {
out().println("Process Engine NOT Found!");
return null;
}
RuntimeService rt = pe.getRuntimeService();
if (definitionID != null) {
ProcessInstance pi = rt.startProcessInstanceById(definitionID);
out().printf("Process instance %s Started\n", pi.getProcessInstanceId());
}
return null;
}
示例2: startProcess
import org.activiti.engine.RuntimeService; //导入方法依赖的package包/类
/**
* Start process by process ID
*
* @param processID
* @throws BPSFault
*/
public void startProcess(String processID) throws BPSFault {
ProcessEngine engine = BPMNServerHolder.getInstance().getEngine();
RuntimeService runtimeService = engine.getRuntimeService();
runtimeService.startProcessInstanceById(processID);
}
示例3: testDeployRevisedProcessAfterDeleteOnOtherProcessEngine
import org.activiti.engine.RuntimeService; //导入方法依赖的package包/类
public void testDeployRevisedProcessAfterDeleteOnOtherProcessEngine() {
// Setup both process engines
ProcessEngine processEngine1 = new StandaloneProcessEngineConfiguration()
.setProcessEngineName("reboot-test-schema")
.setDatabaseSchemaUpdate(org.activiti.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
.setJdbcUrl("jdbc:h2:mem:activiti-process-cache-test;DB_CLOSE_DELAY=1000")
.setJobExecutorActivate(false)
.buildProcessEngine();
RepositoryService repositoryService1 = processEngine1.getRepositoryService();
ProcessEngine processEngine2 = new StandaloneProcessEngineConfiguration()
.setProcessEngineName("reboot-test")
.setDatabaseSchemaUpdate(org.activiti.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)
.setJdbcUrl("jdbc:h2:mem:activiti-process-cache-test;DB_CLOSE_DELAY=1000")
.setJobExecutorActivate(false)
.buildProcessEngine();
RepositoryService repositoryService2 = processEngine2.getRepositoryService();
RuntimeService runtimeService2 = processEngine2.getRuntimeService();
TaskService taskService2 = processEngine2.getTaskService();
// Deploy first version of process: start->originalTask->end on first process engine
String deploymentId = repositoryService1.createDeployment()
.addClasspathResource("org/activiti/engine/test/cache/originalProcess.bpmn20.xml")
.deploy()
.getId();
// Start process instance on second engine
String processDefinitionId = repositoryService2.createProcessDefinitionQuery().singleResult().getId();
runtimeService2.startProcessInstanceById(processDefinitionId);
Task task = taskService2.createTaskQuery().singleResult();
assertEquals("original task", task.getName());
// Delete the deployment on second process engine
repositoryService2.deleteDeployment(deploymentId, true);
assertEquals(0, repositoryService2.createDeploymentQuery().count());
assertEquals(0, runtimeService2.createProcessInstanceQuery().count());
// deploy a revised version of the process: start->revisedTask->end on first process engine
//
// Before the bugfix, this would set the cache on the first process engine,
// but the second process engine still has the original process definition in his cache.
// Since there is a deployment delete in between, the new generated process definition id is the same
// as in the original deployment, making the second process engine using the old cached process definition.
deploymentId = repositoryService1.createDeployment()
.addClasspathResource("org/activiti/engine/test/cache/revisedProcess.bpmn20.xml")
.deploy()
.getId();
// Start process instance on second process engine -> must use revised process definition
processDefinitionId = repositoryService2.createProcessDefinitionQuery().singleResult().getId();
runtimeService2.startProcessInstanceByKey("oneTaskProcess");
task = taskService2.createTaskQuery().singleResult();
assertEquals("revised task", task.getName());
// cleanup
repositoryService1.deleteDeployment(deploymentId, true);
processEngine1.close();
processEngine2.close();
}
示例4: triggerEvent
import org.activiti.engine.RuntimeService; //导入方法依赖的package包/类
public void triggerEvent(String sentItem) throws Exception {
RuntimeService runtimeService = ProcessEngines.getDefaultProcessEngine().getRuntimeService();
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("sentItem", sentItem);
runtimeService.startProcessInstanceById(processDefinitionID, variables);
}