Hi,
I am using bpmn.io to generate XML, I want to write java code to validate this XML against common issues in the diagram (missing start, missing end, disconnected nodes, …)
What I could find that BpmnModelInstance.validate(ModelElementValidator collection)
should do this, but I can’t find any implementations of this interface to choose what I need from.
Are there any implementation of this validator interface implemented by camunda or the community than I can use to make diagram validation ?
Thanks
Thanks for your recommendation.
This seems a Javascript library, is there a similar library in java part ?
I know that Camunda BPM Engine makes such validations before executing the process, but can’t find if there is a re-usable code that can do this ?
Hi @zmadel,
you can hook into the engine’s validation with a parse-listener.
Have a look at this example for further details: camunda-bpm-examples/process-engine-plugin/bpmn-parse-listener-on-user-task at master · camunda/camunda-bpm-examples · GitHub.
Hope this helps, Ingo
@vicmosin
Yes, I found a good way to validate this
try { BpmnModelInstance bpmnModel = Bpmn.readModelFromStream(new ByteArrayInputStream(bpmnXMLBytes)); Bpmn.validateModel(bpmnModel); } catch (Exception e){ //Handle invalid code exceptions }
1 Like