Java Code Examples for org.activiti.engine.task.Task#setFormKey()
The following examples show how to use
org.activiti.engine.task.Task#setFormKey() .
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: TaskServiceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment public void testFormKeyExpression() { runtimeService.startProcessInstanceByKey("testFormExpression", CollectionUtil.singletonMap("var", "abc")); Task task = taskService.createTaskQuery().singleResult(); assertEquals("first-form.json", task.getFormKey()); taskService.complete(task.getId()); task = taskService.createTaskQuery().singleResult(); assertEquals("form-abc.json", task.getFormKey()); task.setFormKey("form-changed.json"); taskService.saveTask(task); task = taskService.createTaskQuery().singleResult(); assertEquals("form-changed.json", task.getFormKey()); if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().taskId(task.getId()).singleResult(); assertEquals("form-changed.json", historicTaskInstance.getFormKey()); } }
Example 2
Source File: UserTaskTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public void testTaskFormKeyWhenUsingIncludeVariables() { deployOneTaskTestProcess(); runtimeService.startProcessInstanceByKey("oneTaskProcess"); // Set variables Task task = taskService.createTaskQuery().singleResult(); assertNotNull(task); Map<String, Object> vars = new HashMap<String, Object>(); for (int i=0; i<20; i++) { vars.put("var" + i, i*2); } taskService.setVariables(task.getId(), vars); // Set form key task = taskService.createTaskQuery().singleResult(); task.setFormKey("test123"); taskService.saveTask(task); // Verify query and check form key task = taskService.createTaskQuery().includeProcessVariables().singleResult(); assertEquals(vars.size(), task.getProcessVariables().size()); assertEquals("test123", task.getFormKey()); }
Example 3
Source File: TaskServiceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment public void testFormKeyExpression() { runtimeService.startProcessInstanceByKey("testFormExpression", CollectionUtil.singletonMap("var", "abc")); Task task = taskService.createTaskQuery().singleResult(); assertEquals("first-form.json", task.getFormKey()); taskService.complete(task.getId()); task = taskService.createTaskQuery().singleResult(); assertEquals("form-abc.json", task.getFormKey()); task.setFormKey("form-changed.json"); taskService.saveTask(task); task = taskService.createTaskQuery().singleResult(); assertEquals("form-changed.json", task.getFormKey()); if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().taskId(task.getId()).singleResult(); assertEquals("form-changed.json", historicTaskInstance.getFormKey()); } }
Example 4
Source File: UserTaskTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public void testTaskFormKeyWhenUsingIncludeVariables() { deployOneTaskTestProcess(); runtimeService.startProcessInstanceByKey("oneTaskProcess"); // Set variables Task task = taskService.createTaskQuery().singleResult(); assertNotNull(task); Map<String, Object> vars = new HashMap<String, Object>(); for (int i=0; i<20; i++) { vars.put("var" + i, i*2); } taskService.setVariables(task.getId(), vars); // Set form key task = taskService.createTaskQuery().singleResult(); task.setFormKey("test123"); taskService.saveTask(task); // Verify query and check form key task = taskService.createTaskQuery().includeProcessVariables().singleResult(); assertEquals(vars.size(), task.getProcessVariables().size()); assertEquals("test123", task.getFormKey()); }
Example 5
Source File: TaskBaseResource.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
/** * Populate the task based on the values that are present in the given {@link TaskRequest}. */ protected void populateTaskFromRequest(Task task, TaskRequest taskRequest) { if (taskRequest.isNameSet()) { task.setName(taskRequest.getName()); } if (taskRequest.isAssigneeSet()) { task.setAssignee(taskRequest.getAssignee()); } if (taskRequest.isDescriptionSet()) { task.setDescription(taskRequest.getDescription()); } if (taskRequest.isDuedateSet()) { task.setDueDate(taskRequest.getDueDate()); } if (taskRequest.isOwnerSet()) { task.setOwner(taskRequest.getOwner()); } if (taskRequest.isParentTaskIdSet()) { task.setParentTaskId(taskRequest.getParentTaskId()); } if (taskRequest.isPrioritySet()) { task.setPriority(taskRequest.getPriority()); } if (taskRequest.isCategorySet()) { task.setCategory(taskRequest.getCategory()); } if (taskRequest.isTenantIdSet()) { task.setTenantId(taskRequest.getTenantId()); } if (taskRequest.isFormKeySet()) { task.setFormKey(taskRequest.getFormKey()); } if (taskRequest.isDelegationStateSet()) { DelegationState delegationState = getDelegationState(taskRequest.getDelegationState()); task.setDelegationState(delegationState); } }