Search in sources :

Example 1 with BPMNTask

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;
}
Also used : Task(org.activiti.engine.task.Task) BPMNTask(org.wso2.carbon.bpmn.core.mgt.model.BPMNTask) TaskService(org.activiti.engine.TaskService) BPMNTask(org.wso2.carbon.bpmn.core.mgt.model.BPMNTask) ProcessEngine(org.activiti.engine.ProcessEngine)

Aggregations

ProcessEngine (org.activiti.engine.ProcessEngine)1 TaskService (org.activiti.engine.TaskService)1 Task (org.activiti.engine.task.Task)1 BPMNTask (org.wso2.carbon.bpmn.core.mgt.model.BPMNTask)1