/** * 获取流程详细及工作流参数 * * @param id */ @SuppressWarnings("unchecked") public Leave get(String id) { Leave leave = leaveDao.get(id); Map<String, Object> variables = null; HistoricProcessInstance historicProcessInstance = historyService .createHistoricProcessInstanceQuery() .processInstanceId(leave.getProcessInstanceId()) .singleResult(); if (historicProcessInstance != null) { variables = Collections3.extractToMap( historyService .createHistoricVariableInstanceQuery() .processInstanceId(historicProcessInstance.getId()) .list(), "variableName", "value"); } else { variables = runtimeService.getVariables( runtimeService .createProcessInstanceQuery() .processInstanceId(leave.getProcessInstanceId()) .active() .singleResult() .getId()); } leave.setVariables(variables); return leave; }
// 获取字段所有的关联关系 public List<SourceRelation> getSourceRelationList() { List<SourceRelation> list = Lists.newArrayList(); if (!Collections3.isEmpty(normalColumn.getRelationList())) { for (Relation relation : normalColumn.getRelationList()) { SourceRelation sourceRelation = new SourceRelation(relation, false); list.add(sourceRelation); } } if (!Collections3.isEmpty(normalColumn.getOutgoingRelationList())) { for (Relation relation : normalColumn.getOutgoingRelationList()) { SourceRelation sourceRelation = new SourceRelation(relation, true); list.add(sourceRelation); } } return list; }