use of com.plumdo.flow.rest.instance.ProcessInstanceStartResponse in project plumdo-work by wengwh.
the class RestResponseFactory method createProcessInstanceStartResponse.
public ProcessInstanceStartResponse createProcessInstanceStartResponse(ProcessInstance processInstance, List<Task> tasks) {
ProcessInstanceStartResponse result = new ProcessInstanceStartResponse();
result.setId(processInstance.getId());
result.setBusinessKey(processInstance.getBusinessKey());
result.setProcessDefinitionId(processInstance.getProcessDefinitionId());
// 接口有提供获取定义名称和key但是在启动api里面没有设置进去,只能通过获取定义获取
// result.setProcessDefinitionName(((ExecutionEntity)processInstance).getProcessDefinition().getName());
// result.setProcessDefinitionKey(((ExecutionEntity)processInstance).getProcessDefinition().getKey());
result.setCurrentActivityId(processInstance.getActivityId());
result.setTenantId(processInstance.getTenantId());
List<Map<String, String>> taskInfo = new ArrayList<Map<String, String>>();
for (Task task : tasks) {
Map<String, String> taskMap = new HashMap<String, String>();
taskMap.put("taskId", task.getId());
taskMap.put("taskName", task.getName());
taskMap.put("taskDefinitionKey", task.getTaskDefinitionKey());
taskInfo.add(taskMap);
}
result.setTaskInfo(taskInfo);
return result;
}
Aggregations