本文整理匯總了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);
}