How to access the bpmn xml of a process definition without parsing it

Hi,

we use custom types in our process definitions which are provided by our backend.
The provided custom types may change, thus making a formerly valid bpmn xml invalid.

We need a way to access, as well as download the underling xml of such invalid definitions via the java API.

neither
processEngine().getRepositoryService().getProcessModel("id");
nor
processEngine().getRepositoryService().getBpmnModelInstance("id");
do as both try to parse the invalid model, resulting in a ParseException.

One thing I could find out is that while
processEngine().getRepositoryService().getProcessDefinition("id");
does also try to parse the model,
processEngine().getRepositoryService().createProcessDefinitionQuery().processDefinitionId("id").singleResult();
does not.
Unfortunately it seems like there is no way to access the xml from the ProcessDefinition interface.

Any help is greatly appreciated!

best regards
Jannis

A little additional question:

is there a drawback using a processDefinitionQuery instead of the shorter statement to get a process definition? It seems to me that the returned object is the same.

any thoughts on this @Niall ?

Hi @jannisEis,

your options are either to create models that are compliant to the BPMN standard and use the current libraries to access the details or do the parsing with plain XML tools by yourself.

BPMN is is highly extensible, as each element offers an extensionElement where you can put your elements.

Camunda use these extensions as well. One example of my last model that I created:

    <bpmn:callActivity id="Activity_1tpqvxe" name="Item handling">
      <bpmn:extensionElements>
        <zeebe:calledElement processId="ItemHandlingSubprocess" propagateAllChildVariables="false" />
        <zeebe:ioMapping>
          <zeebe:input source="= item" target="item" />
        </zeebe:ioMapping>
      </bpmn:extensionElements>
    </bpmn:callActivity>

Here is an example from the modeler team how to use the extension points: bpmn-js-examples/custom-elements at master · bpmn-io/bpmn-js-examples · GitHub

Hope this helps, Ingo

Hi @Ingo_Richtsmeier,

thank you for your reply.

I feel like you misunderstood the question though, probably due to unnecessary details provided by me.

The essential part of my question was to download the xml of any process model from the camunda db.

I was able to achieve this by using
CamundaRepositoryService#getResourceAsStream

All the best
Jannis