cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically Accessing Call Activity's Extension elements

jorell
Champ in-the-making
Champ in-the-making
Since activiti doesnt support out parameters for call activity nodes that use multiInstanceLoops I am trying to implement my own solution to this. Basically every subprocess would right back its out variable in a Map. I have hit a snag though. I can' t figure out how to get the list of the parent process' call activity's out variables. I can get the FlowElement object of the call activity using the following code:

    RepositoryServiceImpl repositoryServiceImpl = (RepositoryServiceImpl) repositoryService;
    BpmnModel model = repositoryServiceImpl.getBpmnModel(processDefinitionId);
    Process process = model.getProcesses().get(0);
    FlowElement flowElement = process.getFlowElement(activityId);


And this flowElement is of type CallActivity. But the call activity has no extension elements. My bpmn snippet for this node is below:


<callActivity id="testSubCallACtivity" name="test sub call activity" calledElement="testSubProcess">
      <extensionElements>
        <activiti:out source="approver" target="s_approver"/>
      </extensionElements>
      <multiInstanceLoopCharacteristics isSequential="false"
          activiti:collection="IdList" activiti:elementVariable="Id">
      </multiInstanceLoopCharacteristics>
    </callActivity>


Please let me know if I'm doing something wrong here. Thanks
3 REPLIES 3

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Jorell,

activiti doesnt support out parameters for call activity nodes that use multiInstanceLoops

I did not test it, but it can make sense -> variable can be overridden by the next loop. Some kind of mapping is needed.

But the call activity has no extension elements.
org.activiti.bpmn.model.CallActivity has lists of inParameter and outParameters.


  protected List<IOParameter> inParameters = new ArrayList<IOParameter>();
  protected List<IOParameter> outParameters = new ArrayList<IOParameter>();

Is there something in case of multi instance loop?


Regards
Martin

jorell
Champ in-the-making
Champ in-the-making
Thanks Martin. Yes I am trying to create a custom mapping for each multiInstance loop in a call activity.

Yes the CallActivity object does have inParamaters, outParameters and it also has a list of ExtensionElements. But all these are empty at run time when I put a break point and and inspect the CallActivity. They don't seem to be getting set.

jorell
Champ in-the-making
Champ in-the-making
Actually scratch that, the out parameter is set and I can see my variables correctly in there. Not sure why I missed it earlier. Thanks for your help Martin!