I would like to change BPMN models programmatically during process deployment. I have tried to impl. that requirement in a BpmnParseHandler, configured as a preBpmnParseHandlers in the activiti.cfg.xml. Changes like the called java class of a service task works perfectly. Also adding a execution listener is fine. Then tried to add a complete new task like:
final ServiceTask myTask = new ServiceTask();
... (add and correct the sequence flows) ...
(Optional, re-render the model picture)
final BpmnAutoLayout layoutDesigner = new BpmnAutoLayout(bpmnParse.getBpmnModel());
Unfortunately that is not working. The picture is updated correctly, but the new task itself will be ignored from engine. I assume this is because the BpmnParseHandler works element based and new once are not re-read in some processors before.
However, is there another possibility to implement my requirement of adding new task in an existing model programmatically? Also hacks / workarounds are welcome ;-)
Thanks for your response and best regards