use of org.wso2.carbon.bpmn.core.mgt.model.BPMNTask in project carbon-business-process by wso2.
the class BPMNHumanTasksService method getTasksOfUser.
public BPMNTask[] getTasksOfUser(String username) throws BPSFault {
Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
ProcessEngine engine = BPMNServerHolder.getInstance().getEngine();
TaskService taskService = engine.getTaskService();
List<Task> tasks = taskService.createTaskQuery().taskTenantId(tenantId.toString()).taskAssignee(username).list();
BPMNTask[] bpmnTasks = new BPMNTask[tasks.size() + 1];
int i = 0;
for (Task t : tasks) {
BPMNTask bpmnTask = new BPMNTask();
bpmnTask.setId(t.getId());
bpmnTask.setName(t.getName());
bpmnTask.setProcessInstanceId(t.getProcessInstanceId());
bpmnTasks[i] = bpmnTask;
i++;
}
return bpmnTasks;
}
Aggregations