Hi there!
Im working on script for BPMN model creation (transformation), the idea behind is to create new (e)BPMN collaboraation diagram via report script. I can create pool and lane inside with standard methods:
// targetGroup defined in dialog window
targetModel = targetGroup.CreateModel(Constants.MT_ENTERPRISE_BPMN_COLLABORATION, "Model Name", locale);
// access BPMN 2 support component
var bpmnComponent = Context.getComponent("Designer");
bpmnSupport = bpmnComponent.getBPMNSupport(targetModel);
// create the pool and the system lane
var pool = targetGroup.CreateObjDef(Constants.OT_BPMN_POOL,"Test Process", locale);
var defaultPool = bpmnSupport.createBpmnObject(pool, null, Constants.ST_BPMN_POOL_1);
var lane = targetGroup.CreateObjDef(Constants.OT_BPMN_LANE,"Application System Lane 1"), locale);
var defaultLane = bpmnSupport.createBpmnObject(lane, null, Constants.ST_BPMN_LANE_1);
bpmnSupport.setBpmnParent(defaultLane, defaultPool); // set parent for Lane
This part is OK. Now Im struggling with specific task - to create Lane in Lane and here appears a question if it is possible to create Lane in Lane via script?
In Aris Architect you can create it manually very easy - just click on big "+" inside a Lane in which you want to create, let´s say "nested" lane, define number of lanes, symbol, position and that´s all:
My idea is to create a Role lane in Application system type lane.
When I try an approach from code above, similar code but instead of pool I use Lane and try to set parent of Lane to other Lane:
var ObjDefForLane = systemObjDef
var ObjDefForLaneChild = targetGroup.CreateObjDef(Constants.OT_BPMN_LANE, "Automatic", locale);
var laneOcc = createLane(typeNum, symbolNum, ObjDefForLane) // lane from Object definition created in pool - adjusted method similar to bpmnSupport.createBpmnObject(arisObject, defaultPool, symbolNum)
var laneOccChild = bpmnSupport.createBpmnObject(ObjDefForLaneChild, null, Constants.ST_BPMN_LANE_1); //( ObjDef objDef, ObjOcc parent, int symbolNum )
bpmnSupport.setBpmnParent(laneOccChild, laneOcc);
I get an error on last "setBpmnParent" method"Error: JavaException: java.lang.IllegalArgumentException: lanes can only have pools as parent"
Does somebody know, if it is possible to create such think as in my example "Automatic" Role lane in "Application System Lane"? Thank you a lot in advance..
Libor