org.activiti.engine.history.HistoricVariableUpdate Java Examples
The following examples show how to use
org.activiti.engine.history.HistoricVariableUpdate.
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: LeaveFormKeyTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #2
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #3
Source File: LeaveFormKeyTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #4
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #5
Source File: LeaveFormKeyTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #6
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #7
Source File: LeaveFormKeyTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #8
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #9
Source File: LeaveFormKeyTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #10
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #11
Source File: LeaveFormKeyTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #12
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #13
Source File: LeaveFormKeyTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #14
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #15
Source File: LeaveFormKeyTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #16
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #17
Source File: LeaveFormKeyTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #18
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #19
Source File: LeaveFormKeyTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #20
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #21
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #22
Source File: TaskServiceTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testGetVariableByHistoricActivityInstance() { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess"); assertNotNull(processInstance); Task task = taskService.createTaskQuery().singleResult(); taskService.setVariable(task.getId(), "variable1", "value1"); taskService.setVariable(task.getId(), "variable1", "value2"); HistoricActivityInstance historicActivitiInstance = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstance.getId()) .activityId("theTask").singleResult(); assertNotNull(historicActivitiInstance); List<HistoricDetail> resultSet = historyService.createHistoricDetailQuery().variableUpdates().activityInstanceId(historicActivitiInstance.getId()) .orderByTime().asc().list(); assertEquals(2, resultSet.size()); assertEquals("variable1", ((HistoricVariableUpdate) resultSet.get(0)).getVariableName()); assertEquals("value1", ((HistoricVariableUpdate) resultSet.get(0)).getValue()); assertEquals("variable1", ((HistoricVariableUpdate) resultSet.get(1)).getVariableName()); assertEquals("value2", ((HistoricVariableUpdate) resultSet.get(1)).getValue()); } }
Example #23
Source File: ProcessInstanceLogQueryAndByteArrayTypeVariableTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public void testIncludeVariableUpdates() { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { HistoricVariableInstance historicVariableInstance = historyService.createHistoricVariableInstanceQuery() .processInstanceId(processInstanceId).variableName("var").singleResult(); assertEquals(historicVariableInstance.getValue(), LARGE_STRING_VALUE); ProcessInstanceHistoryLog log = historyService.createProcessInstanceHistoryLogQuery(processInstanceId) .includeVariableUpdates() .singleResult(); List<HistoricData> events = log.getHistoricData(); assertEquals(1, events.size()); for (HistoricData event : events) { assertTrue(event instanceof HistoricVariableUpdate); assertEquals(((HistoricDetailVariableInstanceUpdateEntity) event).getValue(), LARGE_STRING_VALUE); } } }
Example #24
Source File: ProcessInstanceLogQueryAndByteArrayTypeVariableTest.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public void testIncludeVariableUpdates() { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { HistoricVariableInstance historicVariableInstance = historyService.createHistoricVariableInstanceQuery() .processInstanceId(processInstanceId).variableName("var").singleResult(); assertEquals(historicVariableInstance.getValue(), LARGE_STRING_VALUE); ProcessInstanceHistoryLog log = historyService.createProcessInstanceHistoryLogQuery(processInstanceId) .includeVariableUpdates() .singleResult(); List<HistoricData> events = log.getHistoricData(); assertEquals(1, events.size()); for (HistoricData event : events) { assertTrue(event instanceof HistoricVariableUpdate); assertEquals(((HistoricDetailVariableInstanceUpdateEntity) event).getValue(), LARGE_STRING_VALUE); } } }
Example #25
Source File: LeaveFormKeyTest.java From activiti-in-action-codes with Apache License 2.0 | 6 votes |
/** * 读取历史变量并封装到Map中 */ private Map<String, Object> packageVariables(ProcessInstance processInstance) { Map<String, Object> historyVariables = new HashMap<String, Object>(); List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list(); for (HistoricDetail historicDetail : list) { if (historicDetail instanceof HistoricFormProperty) { // 表单中的字段 HistoricFormProperty field = (HistoricFormProperty) historicDetail; historyVariables.put(field.getPropertyId(), field.getPropertyValue()); System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue()); } else if (historicDetail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail; historyVariables.put(variable.getVariableName(), variable.getValue()); System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue()); } } return historyVariables; }
Example #26
Source File: FullHistoryTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment(resources = { "org/activiti5/standalone/jpa/JPAVariableTest.testQueryJPAVariable.bpmn20.xml" }) public void testReadJpaVariableValueFromHistoricVariableUpdate() { org.activiti5.engine.impl.cfg.ProcessEngineConfigurationImpl activiti5ProcessEngineConfig = (org.activiti5.engine.impl.cfg.ProcessEngineConfigurationImpl) processEngineConfiguration.getActiviti5CompatibilityHandler().getRawProcessConfiguration(); EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) activiti5ProcessEngineConfig .getSessionFactories() .get(EntityManagerSession.class); EntityManagerFactory entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory(); String executionId = runtimeService.startProcessInstanceByKey("JPAVariableProcess").getProcessInstanceId(); String variableName = "name"; FieldAccessJPAEntity entity = new FieldAccessJPAEntity(); entity.setId(1L); entity.setValue("Test"); EntityManager manager = entityManagerFactory.createEntityManager(); manager.getTransaction().begin(); manager.persist(entity); manager.flush(); manager.getTransaction().commit(); manager.close(); Task task = taskService.createTaskQuery().processInstanceId(executionId).taskName("my task").singleResult(); runtimeService.setVariable(executionId, variableName, entity); taskService.complete(task.getId()); List<org.activiti5.engine.history.HistoricDetail> variableUpdates = activiti5ProcessEngineConfig.getHistoryService().createHistoricDetailQuery().processInstanceId(executionId).variableUpdates().list(); assertEquals(1, variableUpdates.size()); org.activiti5.engine.history.HistoricVariableUpdate update = (org.activiti5.engine.history.HistoricVariableUpdate) variableUpdates.get(0); assertNotNull(update.getValue()); assertTrue(update.getValue() instanceof FieldAccessJPAEntity); assertEquals(entity.getId(), ((FieldAccessJPAEntity) update.getValue()).getId()); }
Example #27
Source File: ProcessInstanceLogQueryTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testIncludeVariableUpdates() { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) { ProcessInstanceHistoryLog log = historyService.createProcessInstanceHistoryLogQuery(processInstanceId) .includeVariableUpdates() .singleResult(); List<HistoricData> events = log.getHistoricData(); assertEquals(3, events.size()); for (HistoricData event : events) { assertTrue(event instanceof HistoricVariableUpdate); } } }
Example #28
Source File: RestResponseFactory.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public HistoricDetailResponse createHistoricDetailResponse(HistoricDetail detail, RestUrlBuilder urlBuilder) { HistoricDetailResponse result = new HistoricDetailResponse(); result.setId(detail.getId()); result.setProcessInstanceId(detail.getProcessInstanceId()); if (StringUtils.isNotEmpty(detail.getProcessInstanceId())) { result.setProcessInstanceUrl(urlBuilder.buildUrl(RestUrls.URL_HISTORIC_PROCESS_INSTANCE, detail.getProcessInstanceId())); } result.setExecutionId(detail.getExecutionId()); result.setActivityInstanceId(detail.getActivityInstanceId()); result.setTaskId(detail.getTaskId()); if (StringUtils.isNotEmpty(detail.getTaskId())) { result.setTaskUrl(urlBuilder.buildUrl(RestUrls.URL_HISTORIC_TASK_INSTANCE, detail.getTaskId())); } result.setTime(detail.getTime()); if (detail instanceof HistoricFormProperty) { HistoricFormProperty formProperty = (HistoricFormProperty) detail; result.setDetailType(HistoricDetailResponse.FORM_PROPERTY); result.setPropertyId(formProperty.getPropertyId()); result.setPropertyValue(formProperty.getPropertyValue()); } else if (detail instanceof HistoricVariableUpdate) { HistoricVariableUpdate variableUpdate = (HistoricVariableUpdate) detail; result.setDetailType(HistoricDetailResponse.VARIABLE_UPDATE); result.setRevision(variableUpdate.getRevision()); result.setVariable(createRestVariable(variableUpdate.getVariableName(), variableUpdate.getValue(), null, detail.getId(), VARIABLE_HISTORY_DETAIL, false, urlBuilder)); } return result; }
Example #29
Source File: FullHistoryTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment(resources = { "org/activiti/standalone/jpa/JPAVariableTest.testQueryJPAVariable.bpmn20.xml" }) public void testReadJpaVariableValueFromHistoricVariableUpdate() { EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) processEngineConfiguration.getSessionFactories().get(EntityManagerSession.class); EntityManagerFactory entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory(); String executionId = runtimeService.startProcessInstanceByKey("JPAVariableProcess").getProcessInstanceId(); String variableName = "name"; FieldAccessJPAEntity entity = new FieldAccessJPAEntity(); entity.setId(1L); entity.setValue("Test"); EntityManager manager = entityManagerFactory.createEntityManager(); manager.getTransaction().begin(); manager.persist(entity); manager.flush(); manager.getTransaction().commit(); manager.close(); Task task = taskService.createTaskQuery().processInstanceId(executionId).taskName("my task").singleResult(); runtimeService.setVariable(executionId, variableName, entity); taskService.complete(task.getId()); List<HistoricDetail> variableUpdates = historyService.createHistoricDetailQuery().processInstanceId(executionId).variableUpdates().list(); assertEquals(1, variableUpdates.size()); HistoricVariableUpdate update = (HistoricVariableUpdate) variableUpdates.get(0); assertNotNull(update.getValue()); assertTrue(update.getValue() instanceof FieldAccessJPAEntity); assertEquals(entity.getId(), ((FieldAccessJPAEntity) update.getValue()).getId()); }
Example #30
Source File: FullHistoryTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment public void testHistoricDetailQueryMixed() throws Exception { Map<String, String> formProperties = new HashMap<String, String>(); formProperties.put("formProp1", "activiti rocks!"); formProperties.put("formProp2", "12345"); ProcessDefinition procDef = repositoryService.createProcessDefinitionQuery().processDefinitionKey("historicDetailMixed").singleResult(); ProcessInstance processInstance = formService.submitStartFormData(procDef.getId(), formProperties); List<HistoricDetail> details = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).orderByVariableName().asc().list(); assertEquals(4, details.size()); assertTrue(details.get(0) instanceof HistoricFormProperty); HistoricFormProperty formProp1 = (HistoricFormProperty) details.get(0); assertEquals("formProp1", formProp1.getPropertyId()); assertEquals("activiti rocks!", formProp1.getPropertyValue()); assertTrue(details.get(1) instanceof HistoricFormProperty); HistoricFormProperty formProp2 = (HistoricFormProperty) details.get(1); assertEquals("formProp2", formProp2.getPropertyId()); assertEquals("12345", formProp2.getPropertyValue()); assertTrue(details.get(2) instanceof HistoricVariableUpdate); HistoricVariableUpdate varUpdate1 = (HistoricVariableUpdate) details.get(2); assertEquals("variable1", varUpdate1.getVariableName()); assertEquals("activiti rocks!", varUpdate1.getValue()); // This variable should be of type LONG since this is defined in the // process-definition assertTrue(details.get(3) instanceof HistoricVariableUpdate); HistoricVariableUpdate varUpdate2 = (HistoricVariableUpdate) details.get(3); assertEquals("variable2", varUpdate2.getVariableName()); assertEquals(12345L, varUpdate2.getValue()); }