AnsweredAssumed Answered

How to get the WorkflowTask -> WorkflowInstance mapping in one query?

Question asked by xiebo on May 26, 2015
My requirement: For each WorkflowInstance, lists all WorkflowTasks for it.

My issue: I have 10,000 WorkflowInstances, and org.alfresco.service.cmr.workflow.WorkflowService.queryTasks can list all WorkflowTasks for ONE specified WorkflowInstance. Then I have to call queryTasks 10,000 times to list all WorkflowTasks for each WorkflowInstance, and the queryTasks is time consuming because it accesses the database.

My question: How to get the WorkflowTask -> WorkflowInstance mapping in one query?
I plan to call queryTasks one time to get all WorkflowTasks for all WorkflowInstances, and then get one WorkflowInstance's WorkflowTasks according to the WorkflowTask -> WorkflowInstance mapping IN MEMORY, which can improve the performance. I know I can query the ACT_HI_TASKINST table to get the WorkflowTask -> WorkflowInstance mapping, but is there any existing Alfresco API to get the WorkflowTask -> WorkflowInstance mapping?

BTW, The WorkflowTask class (http://dev.alfresco.com/resource/AlfrescoOne/5.0/PublicAPI/org/alfresco/service/cmr/workflow/WorkflowTask.html) has not a member "WorkflowInstanceID" to record the WorkflowTask's WorkflowInstance ID. :-(

Thanks!

Outcomes