Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BPMN Modeler » Reading BPMN Models
Reading BPMN Models [message #9280] Tue, 17 February 2009 16:45 Go to next message
BPMNbeginner is currently offline BPMNbeginner
Messages: 7
Registered: July 2009
Junior Member
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 19:14 Go to previous messageGo to next message
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 #10226 is a reply to message #9305] Fri, 13 March 2009 11:34 Go to previous messageGo to next message
BPMNbeginner is currently offline BPMNbeginner
Messages: 7
Registered: July 2009
Junior Member
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
Re: Reading BPMN Models [message #10251 is a reply to message #10226] Sat, 14 March 2009 05:22 Go to previous message
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
>
Previous Topic:Removing Palette Items Tutorial Help
Next Topic:BPMN Modeler Extension Help !!
Goto Forum:
  


Current Time: Mon Sep 22 02:29:26 GMT 2014

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

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