Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BPMN 2.0 Modeler » Import existing Pool from other file to Collaboration diagram
Import existing Pool from other file to Collaboration diagram [message #1719414] Thu, 07 January 2016 17:38 Go to next message
Jonas Anseeuw is currently offline Jonas AnseeuwFriend
Messages: 4
Registered: April 2015
Junior Member
Hi,

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:
collaborationA.getParticipants().add(collaborationB.getParticipants().get(0));


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?

Cheers,
Jonas

Re: Import existing Pool from other file to Collaboration diagram [message #1723892 is a reply to message #1719414] Thu, 18 February 2016 20:23 Go to previous message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Hi Jonas,

Sorry for the late reply...I've got no excuse Wink

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.

HTH,
Bob
Previous Topic:Is anyone using WSIL support?
Next Topic:Schema Read Problem After Update
Goto Forum:
  


Current Time: Sun Feb 18 02:04:12 GMT 2018

Powered by FUDForum. Page generated in 0.01645 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software