cancel
Showing results for 
Search instead for 
Did you mean: 

Help with a subprocess query

rmoskal
Champ in-the-making
Champ in-the-making
I have a little workflow that includes this excerpt here:

     
  <sequenceFlow
            id="flow1"
            sourceRef="theStart"
            targetRef="model"/>
       
        <callActivity id="model" name="Model" calledElement="minimum_concrete_flow" />
       
        <sequenceFlow
            id="flow2"
            sourceRef="model"
            targetRef="Rig"/>
       
        <callActivity id="Rig" name="Animate" calledElement="minimum_concrete_flow" />    

The subprocess has a task in it.  There are many, many instances of the above process.

I would like to be able to get all the tasks for all the subprocess callActivity "model" and then for callActivity "rig".  I'm a little stumped as to how to go about doing this.  I want to set a variable, but the Execution doesn't give me the activity name.

Any pointers would be appreciated.


Rob
Brooklyn, USA
6 REPLIES 6

stroobat
Champ in-the-making
Champ in-the-making
You want to get a list of tasks through the API ?
I give my usertasks certain names, for instance:
 
<userTask id="CORRECT_THE_ORDER" name="CORRECT_ORDER" activiti:formKey="/main/order/submitOrder">
</userTask>
You can then use the name of the usertask as a parameter in the API.

List<TaskEntity> taskList = (ArrayList)taskService.createTaskQuery().taskName("CORRECT_ORDER").taskUnnassigned().list();
Not sure if that's what you mean ??

Tom.

rmoskal
Champ in-the-making
Champ in-the-making
Thanks Tom.  But that's not quite what I mean.  The tasks are in the subprocess and the subprocesses are all the same.  You'll notice the call statements.  Each task is associated with the activity in the main process.  I need to query them in bulk to get all the tasks associated with each node in the top level process.

I think I can create a listener to decorate the subproc with the name of the node.  Then I can use a query that looks at that variable.  I will try it today. 


Thanks,

Robert

jbarrez
Star Contributor
Star Contributor
You coud use the historyService.createHistoricActivityInstance.activityId("your id").
Note that its called 'history', but is is always reflecting the runtime state.
You would need to have history enabled for that though.

mlegnani
Champ in-the-making
Champ in-the-making
Hi all,
I have the same problem rmoskal had last year. I tried your solution but it can't work since it has as an input what I need as a result. In other words, given an HistoricActivityInstance object representing a callActivity, is it possible to access all the activities in the subprocess called? Thanks,
Massimo

campa
Champ in-the-making
Champ in-the-making
Same problem here, Do you find a solution ?

trademak
Star Contributor
Star Contributor
Hi,

In the trunk I've committed an extra method in the HistoricProcessInstance where you can retrieve all sub processes of a specific process instance id.
It's called superProcessInstanceId(). Does this solve your problem?

Best regards,