Java Code Examples for org.camunda.bpm.engine.RuntimeService#getActivityInstance()

The following examples show how to use org.camunda.bpm.engine.RuntimeService#getActivityInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RuntimeServiceTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
public void execute(DelegateExecution execution) throws Exception {
  RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
  TaskService taskService = execution.getProcessEngineServices().getTaskService();

  String instanceToDelete = (String) execution.getVariable("instanceToComplete");
  Task taskToTrigger = taskService.createTaskQuery().processInstanceId(instanceToDelete).singleResult();
  taskService.complete(taskToTrigger.getId());

  ActivityInstance activityInstance = runtimeService.getActivityInstance(instanceToDelete);
  execution.setVariable("activityInstanceNull", activityInstance == null);
}
 
Example 2
Source File: SequenceFlowListener.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public void execute(DelegateExecution execution) throws Exception {
  ProcessEngineServices processEngineServices = execution.getProcessEngineServices();
  RuntimeService runtimeService = processEngineServices.getRuntimeService();
  runtimeService.getActivityInstance(execution.getProcessInstanceId());
}
 
Example 3
Source File: NestedExecutionAPIInvocationTest.java    From camunda-bpm-platform with Apache License 2.0 3 votes vote down vote up
@Override
public void execute(DelegateExecution execution) throws Exception {

  RuntimeService runtimeService = engine.getRuntimeService();

  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);

  // then the wait state is reached immediately after instantiation
  ActivityInstance activityInstance = runtimeService.getActivityInstance(processInstance.getId());
  ActivityInstance[] activityInstances = activityInstance.getActivityInstances("waitState");
  Assert.assertEquals(1, activityInstances.length);

}
 
Example 4
Source File: NestedExecutionAPIInvocationTest.java    From camunda-bpm-platform with Apache License 2.0 3 votes vote down vote up
@Override
public void execute(DelegateExecution execution) throws Exception {

  RuntimeService runtimeService = engine.getRuntimeService();

  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");

  // then the wait state is reached immediately after instantiation
  ActivityInstance activityInstance = runtimeService.getActivityInstance(processInstance.getId());
  ActivityInstance[] activityInstances = activityInstance.getActivityInstances("waitState");
  Assert.assertEquals(1, activityInstances.length);

}