本文整理汇总了Java中org.camunda.bpm.engine.runtime.ProcessInstance.getId方法的典型用法代码示例。如果您正苦于以下问题:Java ProcessInstance.getId方法的具体用法?Java ProcessInstance.getId怎么用?Java ProcessInstance.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.camunda.bpm.engine.runtime.ProcessInstance
的用法示例。
在下文中一共展示了ProcessInstance.getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
/**
* Creates process instance from process definition.
*
* <p>
* Only parameters corresponding to form attributes defined on Start task will be stored.
* Others will be silently ignored.
* </p>
*
* @param key Specified key of {@link WorkflowDto}
* @param businessKey Specified business key (reference to external resource)
* @param params Initial process variables
* @return New process instance ID
*/
public String create(String key, String businessKey, Map<String, Object> params) {
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery()
.processDefinitionKey(key)
.latestVersion()
.singleResult();
notNull(definition, () -> new MissingObject(ProcessDefinition.class, key));
BpmnModelInstance modelInstance = repositoryService.getBpmnModelInstance(definition.getId());
if(!canStart(modelInstance, unwrap(user))) {
throw new ForbiddenOperation(null);
}
StartFormData formData = formService.getStartFormData(definition.getId());
Map<String, Object> filteredParams = filterDefinedFields(formData, params);
ProcessInstance instance = formService.submitStartForm(
definition.getId(), businessKey, filteredParams
);
return instance.getId();
}
示例2: migrates_active_instances_only
import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
@Test
public void migrates_active_instances_only() {
final String completedProcessInstanceId;
{
ProcessInstance processInstance = startInstance();
complete(task(processInstance));
assertThat(processInstance).isEnded();
completedProcessInstanceId = processInstance.getId();
}
String processInstanceId = startInstance().getId();
migrationPlan.setSteps(Collections.singletonList(step));
migrator.migrate(migrationPlan);
InOrder inOrder = inOrder(step);
inOrder.verify(step).prepare(stepExecutionContextCaptor.capture());
inOrder.verify(step).perform(stepExecutionContextCaptor.capture());
inOrder.verifyNoMoreInteractions();
Set<String> processInstanceIds = stepExecutionContextCaptor.getAllValues().stream()
.map(StepExecutionContext::getProcessInstanceId)
.collect(Collectors.toSet());
assertThat(processInstanceIds).hasSize(1).contains(processInstanceId);
}
示例3: testCancellationAndStartBefore
import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
@Deployment(resources = EXCLUSIVE_GATEWAY_PROCESS)
public void testCancellationAndStartBefore() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("exclusiveGateway");
String processInstanceId = processInstance.getId();
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
runtimeService.createProcessInstanceModification(processInstance.getId()).cancelActivityInstance(getInstanceIdForActivity(tree, "task1"))
.startBeforeActivity("task2").execute();
ActivityInstance activityInstanceTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(activityInstanceTree);
assertEquals(processInstanceId, activityInstanceTree.getProcessInstanceId());
assertThat(activityInstanceTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("task2").done());
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree).matches(describeExecutionTree("task2").scope().done());
completeTasksInOrder("task2");
assertProcessEnded(processInstanceId);
}
示例4: testStartTransitionWithAncestorInstanceId
import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
@Deployment(resources = EXCLUSIVE_GATEWAY_PROCESS)
public void testStartTransitionWithAncestorInstanceId() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("exclusiveGateway");
String processInstanceId = processInstance.getId();
ActivityInstance tree = runtimeService.getActivityInstance(processInstanceId);
runtimeService.createProcessInstanceModification(processInstance.getId()).startTransition("flow4", tree.getId()).execute();
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("task1").activity("task2").done());
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree)
.matches(describeExecutionTree(null).scope().child("task1").concurrent().noScope().up().child("task2").concurrent().noScope().done());
assertEquals(2, taskService.createTaskQuery().count());
// complete the process
completeTasksInOrder("task1", "task2");
assertProcessEnded(processInstanceId);
}
示例5: testDeleteProcessInstanceWithSubprocessInstances
import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
@Test
public void testDeleteProcessInstanceWithSubprocessInstances() {
// given a process instance with subprocesses
BpmnModelInstance calling = prepareComplexProcess("A", "B", "A");
BpmnModelInstance calledA = prepareSimpleProcess("A");
BpmnModelInstance calledB = prepareSimpleProcess("B");
testRule.deploy(calling, calledA, calledB);
ProcessInstance instance = runtimeService.startProcessInstanceByKey("calling");
List<ProcessInstance> subInstances = runtimeService.createProcessInstanceQuery().superProcessInstanceId(instance.getId()).list();
// when the process instance is deleted and we do not skip sub processes
String id = instance.getId();
runtimeService.deleteProcessInstance(id, "test_purposes", false, true, false, false);
// then
testRule.assertProcessEnded(id);
for (ProcessInstance subInstance : subInstances) {
testRule.assertProcessEnded(subInstance.getId());
}
}
示例6: testStartTransitionCase2
import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
@Deployment(resources = EXCLUSIVE_GATEWAY_PROCESS)
public void testStartTransitionCase2() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("exclusiveGateway");
String processInstanceId = processInstance.getId();
runtimeService.createProcessInstanceModification(processInstance.getId()).startTransition("flow2").execute();
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("task1").activity("task1").done());
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree)
.matches(describeExecutionTree(null).scope().child("task1").concurrent().noScope().up().child("task1").concurrent().noScope().done());
assertEquals(2, taskService.createTaskQuery().count());
// complete the process
completeTasksInOrder("task1", "task1");
assertProcessEnded(processInstanceId);
}
示例7: testCancelAllInOneScopeTaskProcess
import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
@Deployment(resources = ONE_SCOPE_TASK_PROCESS)
public void testCancelAllInOneScopeTaskProcess() {
// given
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
String processInstanceId = processInstance.getId();
// two instances of theTask
runtimeService
.createProcessInstanceModification(processInstance.getId())
.startBeforeActivity("theTask")
.execute();
// then
runtimeService
.createProcessInstanceModification(processInstance.getId())
.cancelAllForActivity("theTask")
.execute();
assertProcessEnded(processInstanceId);
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:ProcessInstanceModificationCancellationTest.java
示例8: signalMessage
import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
/**
* Signals a BPMN Message to whole engine to start new process instance.
*
* todo: describe what will happen if non existing message is signalized.
*
* @param messageName Message name to signalize
* @return Id of newly created Process instance
* @throws BadArgument Thrown if no process definition with specified message start event found
*/
public String signalMessage(String messageName, Map<String, Object> params) {
try {
ProcessInstance instance = runtimeService
.createMessageCorrelation(messageName)
.setVariables(params)
.correlateStartMessage();
return instance.getId();
} catch (MismatchingMessageCorrelationException ex) {
log.error("Failed to correlate message.", ex);
throw new BadArgument("messageName");
}
}
示例9: start
import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
@GetMapping("/startProcess")
public String start() {
log.info("Starting process main-v1");
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("main", "Nr. 123", Variables.putValue("FormField_19huq07", "Nr. 123"));
return "<a href=\"http://localhost:8080/app/cockpit/default/#/process-instance/"
+ processInstance.getId()
+ "?viewbox=%7B%22Definitions_1%22%3A%7B%22x%22%3A-248%2C%22y%22%3A-30%2C%22width%22%3A1342%2C%22height%22%3A430%7D%7D\">click</a>";
}
示例10: testStartBeforeNonInterruptingBoundaryEvent
import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
@Deployment(resources = NON_INTERRUPTING_BOUNDARY_EVENT_WITH_PARALLEL_GATEWAY)
public void testStartBeforeNonInterruptingBoundaryEvent() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
String processInstanceId = processInstance.getId();
runtimeService
.createProcessInstanceModification(processInstanceId)
.startBeforeActivity("boundaryEvent")
.execute();
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(
describeActivityInstanceTree(processInstance.getProcessDefinitionId())
.activity("task1")
.activity("task2")
.activity("taskAfterBoundaryEvent")
.done());
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree)
.matches(
describeExecutionTree(null).scope()
.child("task1").concurrent().noScope().up()
.child(null).concurrent().noScope()
.child("task2").scope().up().up()
.child("taskAfterBoundaryEvent").concurrent().noScope()
.done());
completeTasksInOrder("task1", "task2", "taskAfterBoundaryEvent");
assertProcessEnded(processInstanceId);
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:36,代码来源:ProcessInstanceModificationBoundaryEventTest.java
示例11: testCancellationInOneScopeTaskProcess
import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
@Deployment(resources = ONE_SCOPE_TASK_PROCESS)
public void testCancellationInOneScopeTaskProcess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
String processInstanceId = processInstance.getId();
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
runtimeService
.createProcessInstanceModification(processInstance.getId())
.cancelActivityInstance(getInstanceIdForActivity(tree, "theTask"))
.execute();
assertProcessEnded(processInstanceId);
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:15,代码来源:ProcessInstanceModificationCancellationTest.java
示例12: testScopeCancellationInNestedConcurrentScopeTasksProcess
import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
@Deployment(resources = NESTED_PARALLEL_CONCURRENT_SCOPE_TASKS_PROCESS)
public void testScopeCancellationInNestedConcurrentScopeTasksProcess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("nestedParallelGatewayScopeTasks");
String processInstanceId = processInstance.getId();
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
runtimeService
.createProcessInstanceModification(processInstance.getId())
.cancelActivityInstance(getInstanceIdForActivity(tree, "subProcess"))
.execute();
assertProcessNotEnded(processInstanceId);
// assert activity instance
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(
describeActivityInstanceTree(processInstance.getProcessDefinitionId())
.activity("outerTask")
.done());
// assert executions
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree)
.matches(
describeExecutionTree("outerTask").scope()
.done());
// assert successful completion of process
Task task = taskService.createTaskQuery().singleResult();
assertNotNull(task);
taskService.complete(task.getId());
assertProcessEnded(processInstanceId);
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:39,代码来源:ProcessInstanceModificationCancellationTest.java
示例13: testStartBeforeTaskInsideEventSubProcessInsideSubProcess
import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
@Deployment(resources = INTERRUPTING_EVENT_SUBPROCESS_INSIDE_SUBPROCESS)
public void testStartBeforeTaskInsideEventSubProcessInsideSubProcess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
String processInstanceId = processInstance.getId();
runtimeService
.createProcessInstanceModification(processInstanceId)
.startBeforeActivity("eventSubProcessTask")
.execute();
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(
describeActivityInstanceTree(processInstance.getProcessDefinitionId())
.activity("task1")
.beginScope("subProcess")
.beginScope("eventSubProcess")
.activity("eventSubProcessTask")
.done());
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree)
.matches(
describeExecutionTree(null).scope()
.child("task1").concurrent().noScope().up()
.child(null).concurrent().noScope()
.child(null).scope()
.child("eventSubProcessTask").scope()
.done());
completeTasksInOrder("task1", "eventSubProcessTask", "task2");
assertProcessEnded(processInstanceId);
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:37,代码来源:ProcessInstanceModificationEventSubProcessTest.java
示例14: testStartBeforeEventSubProcessInsideSubProcessTask2ShouldBeCancelled
import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
@Deployment(resources = INTERRUPTING_EVENT_SUBPROCESS_INSIDE_SUBPROCESS)
public void testStartBeforeEventSubProcessInsideSubProcessTask2ShouldBeCancelled() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
String processInstanceId = processInstance.getId();
String taskId = taskService.createTaskQuery().singleResult().getId();
taskService.complete(taskId);
runtimeService
.createProcessInstanceModification(processInstanceId)
.startBeforeActivity("eventSubProcess")
.execute();
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(
describeActivityInstanceTree(processInstance.getProcessDefinitionId())
.beginScope("subProcess")
.beginScope("eventSubProcess")
.activity("eventSubProcessTask")
.done());
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree)
.matches(
describeExecutionTree(null).scope()
.child(null).scope()
.child("eventSubProcessTask").scope()
.done());
completeTasksInOrder("eventSubProcessTask");
assertProcessEnded(processInstanceId);
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:37,代码来源:ProcessInstanceModificationEventSubProcessTest.java
示例15: testCancellationInNestedOneTaskProcess
import org.camunda.bpm.engine.runtime.ProcessInstance; //导入方法依赖的package包/类
@Deployment(resources = NESTED_PARALLEL_ONE_TASK_PROCESS)
public void testCancellationInNestedOneTaskProcess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("nestedOneTaskProcess");
String processInstanceId = processInstance.getId();
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
runtimeService
.createProcessInstanceModification(processInstance.getId())
.cancelActivityInstance(getInstanceIdForActivity(tree, "innerTask"))
.execute();
assertProcessNotEnded(processInstanceId);
// assert activity instance
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(
describeActivityInstanceTree(processInstance.getProcessDefinitionId())
.activity("outerTask")
.done());
// assert executions
ExecutionTree executionTree = ExecutionTree.forExecution(processInstanceId, processEngine);
assertThat(executionTree)
.matches(
describeExecutionTree("outerTask").scope()
.done());
// assert successful completion of process
Task task = taskService.createTaskQuery().singleResult();
taskService.complete(task.getId());
assertProcessEnded(processInstanceId);
assertProcessEnded(processInstanceId);
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:40,代码来源:ProcessInstanceModificationCancellationTest.java