How to create Participant programatically


I am using the Modeler on my webapp, and I would like to start the Model with Participants created and visible in the Canvas. I would prefer to do it using Javascript to add the components instead of creating a XML for that. Is that possible?

Imagine the user would have provided some Actors on my business case before going to model it.

I tried something like this, but it appears to not be assigned to the BPMNPlane, as any action I try it shows me issues :

var bpmnObj = bpmnFactory.create(_obj['type'], Ext.apply({
    id: _obj['id']
}, _obj['bo']));

var el = elFactory.createShape(Ext.apply({
    type: _obj['type'],
    id: _obj['id'],
    businessObject: bpmnObj
}, _obj['graph']));

modeling.createShape(el, _obj['graph'], root);

//canvas.addShape(el, root);
var p = elementFactory.createParticipantShape(false);