Java Code Examples for org.flowable.task.api.history.HistoricTaskInstance#getTaskLocalVariables()
The following examples show how to use
org.flowable.task.api.history.HistoricTaskInstance#getTaskLocalVariables() .
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: HistoricTaskAndVariablesQueryTest.java From flowable-engine with Apache License 2.0 | 4 votes |
public void testQueryWithPagingAndVariables() { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery() .includeProcessVariables() .includeTaskLocalVariables() .orderByTaskPriority() .desc() .listPage(0, 1); assertEquals(1, tasks.size()); HistoricTaskInstance task = tasks.get(0); Map<String, Object> variableMap = task.getTaskLocalVariables(); assertEquals(2, variableMap.size()); assertEquals("someVariable", variableMap.get("testVar")); assertEquals(123, variableMap.get("testVar2")); tasks = historyService.createHistoricTaskInstanceQuery() .includeProcessVariables() .includeTaskLocalVariables() .orderByTaskPriority() .asc() .listPage(1, 2); assertEquals(2, tasks.size()); task = tasks.get(1); variableMap = task.getTaskLocalVariables(); assertEquals(2, variableMap.size()); assertEquals("someVariable", variableMap.get("testVar")); assertEquals(123, variableMap.get("testVar2")); tasks = historyService.createHistoricTaskInstanceQuery() .includeProcessVariables() .includeTaskLocalVariables() .orderByTaskPriority() .asc() .listPage(2, 4); assertEquals(1, tasks.size()); task = tasks.get(0); variableMap = task.getTaskLocalVariables(); assertEquals(2, variableMap.size()); assertEquals("someVariable", variableMap.get("testVar")); assertEquals(123, variableMap.get("testVar2")); tasks = historyService.createHistoricTaskInstanceQuery() .includeProcessVariables() .includeTaskLocalVariables() .orderByTaskPriority() .asc() .listPage(4, 2); assertEquals(0, tasks.size()); } }
Example 2
Source File: HistoricTaskAndVariablesQueryTest.java From flowable-engine with Apache License 2.0 | 4 votes |
@Test public void testQueryWithPagingAndVariables() { if (HistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.AUDIT, processEngineConfiguration)) { List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().includeTaskLocalVariables() .orderByTaskPriority().desc().listPage(0, 1); assertThat(tasks).hasSize(1); HistoricTaskInstance task = tasks.get(0); Map<String, Object> variableMap = task.getTaskLocalVariables(); assertThat(variableMap) .containsOnly( entry("testVar", "someVariable"), entry("testVar2", 123) ); tasks = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().includeTaskLocalVariables().orderByTaskPriority().asc() .listPage(1, 2); assertThat(tasks).hasSize(2); task = tasks.get(1); variableMap = task.getTaskLocalVariables(); assertThat(variableMap) .containsOnly( entry("testVar", "someVariable"), entry("testVar2", 123) ); tasks = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().includeTaskLocalVariables().orderByTaskPriority().asc() .listPage(2, 4); assertThat(tasks).hasSize(1); task = tasks.get(0); variableMap = task.getTaskLocalVariables(); assertThat(variableMap) .containsOnly( entry("testVar", "someVariable"), entry("testVar2", 123) ); tasks = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().includeTaskLocalVariables().orderByTaskPriority().asc() .listPage(4, 2); assertThat(tasks).isEmpty(); } }
Example 3
Source File: HistoricTaskAndVariablesQueryTest.java From flowable-engine with Apache License 2.0 | 4 votes |
@Test public void testQueryWithPagingVariablesAndIdentityLinks() { if (HistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.AUDIT, processEngineConfiguration)) { List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().includeTaskLocalVariables() .includeIdentityLinks().orderByTaskPriority().desc().listPage(0, 1); assertThat(tasks).hasSize(1); HistoricTaskInstance task = tasks.get(0); Map<String, Object> variableMap = task.getTaskLocalVariables(); assertThat(variableMap) .containsOnly( entry("testVar", "someVariable"), entry("testVar2", 123) ); assertThat(task.getIdentityLinks()).hasSize(1); IdentityLinkInfo identityLink = task.getIdentityLinks().get(0); assertThat(identityLink.getProcessInstanceId()).isNull(); assertThat(identityLink.getType()).isEqualTo("assignee"); assertThat(identityLink.getGroupId()).isNull(); assertThat(identityLink.getUserId()).isEqualTo("gonzo"); assertThat(identityLink.getTaskId()).isEqualTo(task.getId()); tasks = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().includeTaskLocalVariables().includeIdentityLinks() .orderByTaskPriority().asc().listPage(1, 2); assertThat(tasks).hasSize(2); task = tasks.get(1); variableMap = task.getTaskLocalVariables(); assertThat(variableMap) .containsOnly( entry("testVar", "someVariable"), entry("testVar2", 123) ); assertThat(task.getIdentityLinks()).hasSize(1); identityLink = task.getIdentityLinks().get(0); assertThat(identityLink.getProcessInstanceId()).isNull(); assertThat(identityLink.getType()).isEqualTo("assignee"); assertThat(identityLink.getGroupId()).isNull(); assertThat(identityLink.getUserId()).isEqualTo("gonzo"); assertThat(identityLink.getTaskId()).isEqualTo(task.getId()); tasks = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().includeTaskLocalVariables().includeIdentityLinks() .orderByTaskPriority().asc().listPage(2, 4); assertThat(tasks).hasSize(1); task = tasks.get(0); variableMap = task.getTaskLocalVariables(); assertThat(variableMap) .containsOnly( entry("testVar", "someVariable"), entry("testVar2", 123) ); assertThat(task.getIdentityLinks()).hasSize(1); identityLink = task.getIdentityLinks().get(0); assertThat(identityLink.getProcessInstanceId()).isNull(); assertThat(identityLink.getType()).isEqualTo("assignee"); assertThat(identityLink.getGroupId()).isNull(); assertThat(identityLink.getUserId()).isEqualTo("gonzo"); assertThat(identityLink.getTaskId()).isEqualTo(task.getId()); tasks = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().includeTaskLocalVariables().includeIdentityLinks() .orderByTaskPriority().asc().listPage(4, 2); assertThat(tasks).isEmpty(); } }
Example 4
Source File: TestCacheTaskListener.java From flowable-engine with Apache License 2.0 | 4 votes |
@Override public void notify(DelegateTask delegateTask) { ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(); TaskService taskService = processEngineConfiguration.getTaskService(); Task task = taskService.createTaskQuery().taskId(delegateTask.getId()).singleResult(); if (task != null && task.getId().equals(delegateTask.getId())) { TASK_ID = task.getId(); } HistoryService historyService = processEngineConfiguration.getHistoryService(); HistoricTaskInstance historicTask = historyService.createHistoricTaskInstanceQuery().taskId(delegateTask.getId()).singleResult(); if (historicTask != null && historicTask.getId().equals(delegateTask.getId())) { HISTORIC_TASK_ID = historicTask.getId(); } delegateTask.setVariable("varFromTheListener", "valueFromTheListener"); delegateTask.setVariableLocal("localVar", "localValue"); // Used in CacheTaskTest#testTaskQueryWithIncludeVariables ProcessInstance processInstance = processEngineConfiguration.getRuntimeService().createProcessInstanceQuery() .processInstanceId(task.getProcessInstanceId()) .includeProcessVariables() .singleResult(); PROCESS_VARIABLES = processInstance.getProcessVariables(); HistoricProcessInstance historicProcessInstance = processEngineConfiguration.getHistoryService().createHistoricProcessInstanceQuery() .processInstanceId(task.getProcessInstanceId()) .includeProcessVariables() .singleResult(); HISTORIC_PROCESS_VARIABLES = historicProcessInstance.getProcessVariables(); // Used in CacheTaskTest#testTaskQueryWithIncludeVariables Task taskFromQuery = processEngineConfiguration.getTaskService().createTaskQuery() .taskId(delegateTask.getId()) .includeProcessVariables() .includeTaskLocalVariables() .singleResult(); TASK_PROCESS_VARIABLES = taskFromQuery.getProcessVariables(); TASK_LOCAL_VARIABLES = taskFromQuery.getTaskLocalVariables(); HistoricTaskInstance historicTaskFromQuery = processEngineConfiguration.getHistoryService().createHistoricTaskInstanceQuery() .taskId(delegateTask.getId()) .includeProcessVariables() .includeTaskLocalVariables() .singleResult(); HISTORIC_TASK_PROCESS_VARIABLES = historicTaskFromQuery.getProcessVariables(); HISTORIC_TASK_LOCAL_VARIABLES = historicTaskFromQuery.getTaskLocalVariables(); }