serviceTask inputParameter list order


#1

We have the following serviceTask:

<bpmn:serviceTask camunda:class="actio.engine.servicetasks.SignDocument" 
 [...]>
  <bpmn:extensionElements>
    <camunda:inputOutput>
      <camunda:inputParameter name="signataris">
        <camunda:list>
          <camunda:map>
            <camunda:entry key="nomComplet">${nif1}</camunda:entry>
            <camunda:entry key="nif">${nif1}</camunda:entry>
          </camunda:map>
         <camunda:map>
             <camunda:entry key="nomComplet">${nif2}</camunda:entry>
            <camunda:entry key="nif">${nif2}</camunda:entry>
         </camunda:map>
         <camunda:map>
           <camunda:entry key="nomComplet">${nif3}</camunda:entry>
           <camunda:entry key="nif">${nif3}</camunda:entry>
        </camunda:map>
      </camunda:list>
    </camunda:inputParameter>
  </camunda:inputOutput>
[...]
  </bpmn:extensionElements>
[...]
</bpmn:serviceTask>

The implementation of such task is a groovy class:

class SignDocument implements JavaDelegate {
[...]

   public void execute (DelegateExecution ex) {
       [...]

        def signataris = []
        ex.getVariable('signataris')?.each {
            signataris << it
        }
        if (log.debugEnabled) log.debug "SIGNATARIS: " + signtaris           
        [...]
   }
   [...]
}

THE PROBLEM
The problem is when variable ‘signataris’ (people that may sign a document) is printed, they appear in a different order than the list is declared. It seems to be a random behaviour, but I get most times the corresponding ${nif3} in the 1st place of the list.

Has anybody faced such problem? Any solution?

I could add an index to the list and sort it in the implementation class as a workaround, but I think the order in the list should be kept as declared in the camunda:inputParameter element.


#2

Hi,

I agree that list elements should be ordered in the way declared in the process definition. Could you please provide a test case that reproduces this for use to track the issue down? You can use the unit testing template to get started quickly.

Cheers,
Thorben


#3

I’ll do it as soon as possible!