|Import existing Pool from other file to Collaboration diagram [message #1719414]
||Thu, 07 January 2016 17:38
| Jonas Anseeuw
Registered: April 2015
I would like to import an existing Participant's Pool (and Process) to a Collaboration diagram. I tried copy/pasting but receive the same error as mentioned in https://www.eclipse.org/forums/index.php/t/1066360.
I then tried to do it in code. I first loaded two Collaborations A and B as EMF objects from file. Then, I added the (only) Participant from Collaboration B to the Participants of Collaboration A.
More or less like this:
However, when I save the Resource I receive an exception:
Caused by: java.lang.IllegalArgumentException: Path must include project and resource name: /collaborationB.bpmn
collaborationB.bpmn is the file from Collaboration B, which I want to import.
When I check the BPMN XML after saving I see the Participant has been succesfully added, but not its Process.
<bpmn2:participant id="Participant_1" name="Initiating Pool" processRef="/Demo/collaborationB.bpmn#Process_2"/>
What am I doing wrong or how can I move Pools from one Collaboration diagram to an other Collaboration diagram?
|Re: Import existing Pool from other file to Collaboration diagram [message #1723892 is a reply to message #1719414]
||Thu, 18 February 2016 20:23
Sorry for the late reply...I've got no excuse
Copy/Paste was not designed to work between files, only within the same file. Please file an Enhancement Request bug here.
The reason you're getting that exception is probably because the Process being referenced by the Participant being copied has disappeared somehow. Since it is only being referenced by the Participant, the Process definition and all of its contents still remain in the source file. If the source file is deleted or the Process in the source file is deleted, the references can no longer be resolved and your target file is corrupt.
This problem is not as easy as it sounds. Not only do you need to copy the Participant, but also the Process it references, and all of its contents (i.e. Lanes, Activities, Events, Gateways, SequenceFlows etc.) You also need to copy the BPMNDI elements involved, all of the BPMNShape and BPMNEdge elements, and paste them into the same BPMNPlane as your Collaboration. You also need to make sure that the IDs of the elements you copied do not collide with IDs of existing elements in the target Collaboration. Your best bet is to use an XML editor to accomplish this.
If this is something you're going to need to do more than once, you could possibly write java code. The problem is that each copied element needs to be "cloned", since moving the element from one file to another simply creates a reference from the target file to the source, as you've already discovered.
Powered by FUDForum
. Page generated in 0.01931 seconds