Search in sources :

Example 1 with ProcessInstanceStartResponse

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;
}
Also used : Task(org.flowable.engine.task.Task) HashMap(java.util.HashMap) ProcessInstanceStartResponse(com.plumdo.flow.rest.instance.ProcessInstanceStartResponse) ArrayList(java.util.ArrayList) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

ProcessInstanceStartResponse (com.plumdo.flow.rest.instance.ProcessInstanceStartResponse)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Task (org.flowable.engine.task.Task)1