org.camunda.bpm.engine.task.Task.getFormKey()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(191)

本文整理了Java中org.camunda.bpm.engine.task.Task.getFormKey()方法的一些代码示例,展示了Task.getFormKey()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.getFormKey()方法的具体详情如下:
包路径:org.camunda.bpm.engine.task.Task
类名称:Task
方法名:getFormKey

Task.getFormKey介绍

[英]Provides the form key for the task.

NOTE: If the task instance us obtained through a query, this property is only populated in case the TaskQuery#initializeFormKeys() method is called. If this method is called without a prior call to TaskQuery#initializeFormKeys(), it will throw a BadUserRequestException.
[中]提供任务的表单键。
注意:如果任务实例是通过查询获得的,则仅在调用TaskQuery#initializeFormKeys()方法时才会填充此属性。如果调用此方法之前未调用TaskQuery#initializeFormKeys(),它将抛出BadUserRequestException。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

public Task build() {
 Task mockTask = mock(Task.class);
 when(mockTask.getId()).thenReturn(id);
 when(mockTask.getName()).thenReturn(name);
 when(mockTask.getAssignee()).thenReturn(assignee);
 when(mockTask.getCreateTime()).thenReturn(createTime);
 when(mockTask.getDueDate()).thenReturn(dueDate);
 when(mockTask.getFollowUpDate()).thenReturn(followUpDate);
 when(mockTask.getDelegationState()).thenReturn(delegationState);
 when(mockTask.getDescription()).thenReturn(description);
 when(mockTask.getExecutionId()).thenReturn(executionId);
 when(mockTask.getOwner()).thenReturn(owner);
 when(mockTask.getParentTaskId()).thenReturn(parentTaskId);
 when(mockTask.getPriority()).thenReturn(priority);
 when(mockTask.getProcessDefinitionId()).thenReturn(processDefinitionId);
 when(mockTask.getProcessInstanceId()).thenReturn(processInstanceId);
 when(mockTask.getTaskDefinitionKey()).thenReturn(taskDefinitionKey);
 when(mockTask.getCaseDefinitionId()).thenReturn(caseDefinitionId);
 when(mockTask.getCaseInstanceId()).thenReturn(caseInstanceId);
 when(mockTask.getCaseExecutionId()).thenReturn(caseExecutionId);
 when(mockTask.getFormKey()).thenReturn(formKey);
 when(mockTask.getTenantId()).thenReturn(tenantId);
 return mockTask;
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Deployment(resources={"org/camunda/bpm/engine/test/api/task/oneTaskWithFormKeyProcess.bpmn20.xml"})
 public void testInitializeFormKeysEnabled() {
 ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess");
 TaskQuery query = taskService.createTaskQuery()
  .processInstanceId(processInstance.getId());
 saveQuery(query);
 Task task = (Task) filterService.list(filter.getId()).get(0);
 assertEquals("exampleFormKey", task.getFormKey());
 task = filterService.singleResult(filter.getId());
 assertEquals("exampleFormKey", task.getFormKey());
 runtimeService.deleteProcessInstance(processInstance.getId(), "test");
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Deployment(resources={"org/camunda/bpm/engine/test/api/task/oneTaskWithFormKeyProcess.bpmn20.xml"})
public void testInitializeFormKeys() {
 ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess");
 // if initializeFormKeys
 Task task = taskService.createTaskQuery()
  .processInstanceId(processInstance.getId())
  .initializeFormKeys()
  .singleResult();
 // then the form key is present
 assertEquals("exampleFormKey", task.getFormKey());
 // if NOT initializeFormKeys
 task = taskService.createTaskQuery()
  .processInstanceId(processInstance.getId())
  .singleResult();
 try {
  // then the form key is not retrievable
  task.getFormKey();
  fail("exception expected.");
 } catch (BadUserRequestException e) {
  assertEquals("ENGINE-03052 The form key is not initialized. You must call initializeFormKeys() on the task query before you can retrieve the form key.", e.getMessage());
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

assertEquals("aFormKey", tasks.get(0).getFormKey());
assertEquals("anotherFormKey", tasks.get(1).getFormKey());

代码示例来源:origin: camunda/camunda-bpm-platform

dto.formKey = task.getFormKey();

代码示例来源:origin: camunda/camunda-bpm-platform

dto.formKey = task.getFormKey();

代码示例来源:origin: camunda/camunda-bpm-platform

dto.tenantId = task.getTenantId();
try {
 dto.formKey = task.getFormKey();

代码示例来源:origin: camunda/camunda-bpm-platform

dto.tenantId = task.getTenantId();
try {
 dto.formKey = task.getFormKey();

代码示例来源:origin: OrienteerBAP/Orienteer

@Override
protected FormKey obtainFormKey() {
          ProcessEngine processEngine = BpmPlatform.getDefaultProcessEngine();
          TaskService taskService = processEngine.getTaskService();
          Task task = taskService.createTaskQuery()
                    .taskId((String)getModelObject().field("id"))
                    .initializeFormKeys()
                    .singleResult();
          return FormKey.parse(task.getFormKey());
}

代码示例来源:origin: org.camunda.bpm/camunda-engine

@Deployment(resources={"org/camunda/bpm/engine/test/api/task/oneTaskWithFormKeyProcess.bpmn20.xml"})
 public void testInitializeFormKeysEnabled() {
 ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess");
 TaskQuery query = taskService.createTaskQuery()
  .processInstanceId(processInstance.getId());
 saveQuery(query);
 Task task = (Task) filterService.list(filter.getId()).get(0);
 assertEquals("exampleFormKey", task.getFormKey());
 task = filterService.singleResult(filter.getId());
 assertEquals("exampleFormKey", task.getFormKey());
 runtimeService.deleteProcessInstance(processInstance.getId(), "test");
}

代码示例来源:origin: org.camunda.bpm/camunda-engine

@Deployment(resources={"org/camunda/bpm/engine/test/api/task/oneTaskWithFormKeyProcess.bpmn20.xml"})
public void testInitializeFormKeys() {
 ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess");
 // if initializeFormKeys
 Task task = taskService.createTaskQuery()
  .processInstanceId(processInstance.getId())
  .initializeFormKeys()
  .singleResult();
 // then the form key is present
 assertEquals("exampleFormKey", task.getFormKey());
 // if NOT initializeFormKeys
 task = taskService.createTaskQuery()
  .processInstanceId(processInstance.getId())
  .singleResult();
 try {
  // then the form key is not retrievable
  task.getFormKey();
  fail("exception expected.");
 } catch (BadUserRequestException e) {
  assertEquals("ENGINE-03052 The form key is not initialized. You must call initializeFormKeys() on the task query before you can retrieve the form key.", e.getMessage());
 }
}

代码示例来源:origin: org.camunda.bpm/camunda-engine

assertEquals("aFormKey", tasks.get(0).getFormKey());
assertEquals("anotherFormKey", tasks.get(1).getFormKey());

代码示例来源:origin: org.camunda.bpm/camunda-engine-rest-jaxrs2

dto.formKey = task.getFormKey();

代码示例来源:origin: org.camunda.bpm/camunda-engine-rest-jaxrs2

dto.tenantId = task.getTenantId();
try {
 dto.formKey = task.getFormKey();

相关文章