擷取流程曆史記錄
public List<WfHistoricProcess> findHistoricProcessList(String processDefinitionKey) {
List<HistoricProcessInstance> list = historyService.createHistoricProcessInstanceQuery().finished()
.processDefinitionKey(processDefinitionKey).orderByProcessInstanceEndTime().desc().list();
List<WfHistoricProcess> historicProcessList = new ArrayList<WfHistoricProcess>(list.size());
for (HistoricProcessInstance p : list) {
WfHistoricProcess historicProcess = new WfHistoricProcess();
historicProcess.setProcess(p);
List<HistoricVariableInstance> variableInstances = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(p.getId()).orderByVariableName().desc().list();
Map<String, Object> variablesMap = new HashMap<String, Object>();
for (HistoricVariableInstance variable : variableInstances) {
variablesMap.put(variable.getVariableName(), variable.getValue());
}
historicProcess.setVariablesMap(variablesMap);
historicProcessList.add(historicProcess);
}
return historicProcessList;
}
其中WfHistoricProcess:
public class WfHistoricProcess implements Serializable {
private static final long serialVersionUID = -8437224215907962601L;
private HistoricProcessInstance process;
private Map<String, Object> variablesMap;
public HistoricProcessInstance getProcess() {
return process;
public void setProcess(HistoricProcessInstance process) {
this.process = process;
public Map<String, Object> getVariablesMap() {
return variablesMap;
public void setVariablesMap(Map<String, Object> variablesMap) {
this.variablesMap = variablesMap;
}
本文轉自yunlielai51CTO部落格,原文連結:http://blog.51cto.com/4925054/1352149,如需轉載請自行聯系原作者