for (Entry<String, Object> entry : entrySet) {
System.out.println(entry.getKey() + "=" + entry.getValue());
}
// 历史记录
HistoryService historyService = activitiRule.getHistoryService();
List<HistoricDetail> list = historyService.createHistoricDetailQuery().formProperties().list();
assertEquals(1, list.size());
// 获取第一个节点
TaskService taskService = activitiRule.getTaskService();
Task task = taskService.createTaskQuery().singleResult();
assertEquals("First Step", task.getName());
TaskFormData taskFormData = formService.getTaskFormData(task.getId());
assertNotNull(taskFormData);
assertNull(taskFormData.getFormKey());
List<FormProperty> taskFormProperties = taskFormData.getFormProperties();
assertNotNull(taskFormProperties);
for (FormProperty formProperty : taskFormProperties) {
System.out.println(ToStringBuilder.reflectionToString(formProperty));
}
formProperties = new HashMap<String, String>();
formProperties.put("setInFirstStep", "01/12/2012");
formService.submitTaskFormData(task.getId(), formProperties);
// 获取第二个节点
task = taskService.createTaskQuery().taskName("Second Step").singleResult();
assertNotNull(task);
taskFormData = formService.getTaskFormData(task.getId());
assertNotNull(taskFormData);
List<FormProperty> formProperties2 = taskFormData.getFormProperties();
assertNotNull(formProperties2);
assertEquals(1, formProperties2.size());
assertNotNull(formProperties2.get(0).getValue());
assertEquals(formProperties2.get(0).getValue(), "01/12/2012");
List<HistoricDetail> details = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
for (HistoricDetail historicDetail : details) {
if (historicDetail instanceof HistoricFormPropertyEntity) {
HistoricFormPropertyEntity formEntity = (HistoricFormPropertyEntity) historicDetail;
System.out.println(String.format("form->, key: %s, value: %s", formEntity.getPropertyId(), formEntity.getPropertyValue()));
} else if (historicDetail instanceof HistoricVariableUpdate) {
HistoricVariableUpdate varEntity = (HistoricVariableUpdate) historicDetail;
System.out.println(String.format("variable->, key: %s, value: %s", varEntity.getVariableName(), varEntity.getValue()));
}
}
long count = historyService.createHistoricDetailQuery().count();
System.out.println(count);
}