AnsweredAssumed Answered

Adding extension attributes on boundaryEvents

Question asked by lmollea on Dec 16, 2014
Hello,

we need to add some extra attributes on a BPMN we are generating from a config file. We tried to add some ExtensionAttributes (we're using the org.activiti.bpmn.model package API) on some boundaryEvents (timer events we placed on some userTasks), but when producing the XML with org.activiti.bpmn.converter.BpmnXMLConverter such attributes are not serialized in the XML.

Is that a bug or a feature (joking of course, I mean, is that on purpose?)

This would be the code for adding the attributes:


      String id = "boundaryevent" + idx.incrementAndGet();
      BoundaryEvent be = new BoundaryEvent();
      be.setId(id);
      be.setName("Timer");
      be.setAttachedToRef((Activity) process.getFlowElement(attached));
      be.setCancelActivity(false);
      TimerEventDefinition event = new TimerEventDefinition();
      event.setTimeDate(expression);
      be.addEventDefinition(event);

      ExtensionAttribute attr = new ExtensionAttribute("reference");
      attr.setNamespace("…");
      attr.setValue(refValue);
      be.addAttribute(attr);

      process.addFlowElement(be);


But the resulting XML shows no sign of the "reference" attribute added.


    <boundaryEvent id="boundaryevent15" name="Timer" attachedToRef="usertask13" cancelActivity="false">
      <timerEventDefinition>
        <timeDate>${checkpointHelper.mktime(processDateTime, -45)}</timeDate>
      </timerEventDefinition>
    </boundaryEvent>


AFAIK, the BpmnXMLUtil.writeCustomAttributes is used only by UserTasks

Outcomes