Reading BPMN Models [message #9280] |
Tue, 17 February 2009 11:45  |
Eclipse User |
|
|
|
Hi,
When creating BPMN models two different files are created; .bpmn and
bpmn_diagram. I want to read the BPMN models and then modify them and
save the modified file as new BPMN model. Therefore I have to create both
files; the .bpmn and .bpmn_diagram.
My questions are:
- Are there classes and methods to read and parse models by giving them
the file names?
- If yes, do these classes provide methods to easily parse the given file,
such as getAllActivites(), getAllGateways() or such methods?
- How can I modify existing model elements and save the modification in
new files; .bpmn and .bpmn_diagram and how to deal with the elements
appearance and positions in .bpmn_diagram?
Thanks a lot!
|
|
|
Re: Reading BPMN Models [message #9305 is a reply to message #9280] |
Tue, 17 February 2009 14:14   |
Eclipse User |
|
|
|
Originally posted by: atoulme.intalio.com
BPMNbeginner wrote:
> Hi,
>
> When creating BPMN models two different files are created; .bpmn and
> bpmn_diagram. I want to read the BPMN models and then modify them and
> save the modified file as new BPMN model. Therefore I have to create
> both files; the .bpmn and .bpmn_diagram.
Well, you can create an EMF ResourceSet with the right BpmnFactory
loaded on it, and it will effectively take care of that.
>
> My questions are:
> - Are there classes and methods to read and parse models by giving them
> the file names?
> - If yes, do these classes provide methods to easily parse the given
> file, such as getAllActivites(), getAllGateways() or such methods?
This is EMF. You can read the model, and you can use a TreeIterator to
do some filtering and get the elements you are after.
> - How can I modify existing model elements and save the modification in
> new files; .bpmn and .bpmn_diagram and how to deal with the elements
> appearance and positions in .bpmn_diagram?
EMF should help with most of what you try to achieve. You should load
the bpmn_diagram Resource, and it will load the semantic resource.
For the notation and appearances, you can modify the Nodes and the Edges
at will.
Thanks,
Antoine
|
|
|
|
Re: Reading BPMN Models [message #10251 is a reply to message #10226] |
Sat, 14 March 2009 01:22  |
Eclipse User |
|
|
|
Originally posted by: atoulme.intalio.com
You should use the BPMN factory to read bpmn_diagram files I think.
BPMNbeginner wrote:
> Hi,
>
> I still have problems when reading the .bpmn files. I don't know which
> file I should load (the .bpmn or .bpmn_diagram file)? I used the
> following code and got an Exception:
> org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'version'
> not found.
>
> // Create a resource set.
> ResourceSet resourceSet = new ResourceSetImpl();
> // Register the appropriate resource factory to handle all file extensions.
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put
> ("bpmn", new BpmnResourceFactoryImpl());
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap()
> .put(Resource.Factory.Registry.DEFAULT_EXTENSION,
> new XMIResourceFactoryImpl());
>
> If I remove the BpmnResourceFactoryImpl, I can load the file without
> problems. If file I am loading was generated by the BPMN Modeler itself
> and I did not change the content of it. I need to read this file and
> make changes on the model and then save it as a new file. Which file
> should I load? Should I use the BPMN factory or the XMI one?
>
> Thx
>
|
|
|
Powered by
FUDForum. Page generated in 0.03180 seconds