Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MDT (Model Development Tools) » [BPMN2] extract information by procedure
[BPMN2] extract information by procedure [message #665811] Sat, 16 April 2011 09:35 Go to next message
Riccardo  is currently offline Riccardo Friend
Messages: 6
Registered: March 2011
Junior Member
Hi!

How can i read bpmn2 file by java code?

For example i need a java void that print all of processes's name of "myBPMNFile..bpmn2" to screen or file.

How can i do that?

Thanks

R.
Re: [BPMN2] extract information by procedure [message #666107 is a reply to message #665811] Tue, 19 April 2011 07:26 Go to previous messageGo to next message
Henning Heitkoetter is currently offline Henning HeitkoetterFriend
Messages: 21
Registered: April 2010
Junior Member
Hello Riccardo,

have a look at the following code:

Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("bpmn2",
        new Bpmn2ResourceFactoryImpl());
// Initialize BPMN 2 Package
Object tmp = Bpmn2Package.eINSTANCE;

Resource res = new ResourceSetImpl().getResource(URI.createFileURI("file.bpmn2"), true);
DocumentRoot root = (DocumentRoot) res.getContents().get(0);
for (RootElement cur : root.getDefinitions().getRootElements())
    if (Bpmn2Package.Literals.PROCESS.isSuperTypeOf(cur.eClass()))
        System.out.println(((Process) cur).getName());


Regards,
Henning
Re: [BPMN2] extract information by procedure [message #666437 is a reply to message #666107] Wed, 20 April 2011 13:21 Go to previous message
Riccardo  is currently offline Riccardo Friend
Messages: 6
Registered: March 2011
Junior Member
Thank you Henning!!!

Wink
Previous Topic:[BPMN2] adding potentialOwner to UserTask
Next Topic:[bpmn2] Convert Expression to FormalExpression
Goto Forum:
  


Current Time: Sat Nov 22 10:30:41 GMT 2014

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

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