Skip to Content

In my technical article about the BPMN 2.0 Metamodel Implementation for Eclipse there was a little mistake in the sample code (section “Code on it” on page 11).

Reason is that we planned to rename everything containing “Bpmn2” in the name to “Bpmn”. As this didn’t happen, the source code looks a little different. Here is the correct version, also containing the required import statements:

 

package org.eclipse.bpmn.sample;

import java.io.IOException;

import org.eclipse.bpmn2.Bpmn2Factory;
import org.eclipse.bpmn2.Definitions;
import org.eclipse.bpmn2.Process;
import org.eclipse.bpmn2.util.Bpmn2ResourceFactoryImpl;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;

public class Sample1 {

    public static void main(String[] args) throws IOException {
        Bpmn2Factory factory = Bpmn2Factory.eINSTANCE;

        Definitions definitions = new Bpmn2ResourceFactoryImpl().createAndInitResource(URI.createFileURI(“c:/temp/sample.bpmn2”));
        Process simpleProcess = factory.createProcess();
        definitions.getRootElements().add(simpleProcess);
        simpleProcess.getFlowElements().add(factory.createStartEvent());
        simpleProcess.getFlowElements().add(factory.createEndEvent());

        ResourceSet resourceSet = new ResourceSetImpl();
        Resource resource = definitions.eResource();
        resourceSet.getResources().add(resource);
        resource.save(null);
    }
}
 

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

    1. Reiner Hille-Doering Post author
      Hi Guillermo,
      thanks for trying.
      Could you please first check if you can reach URL http://git.eclipse.org/c/bpmn2 with a browser.
      If yes, please check the network/proxy settings of Eclipse. Go to Window->Preferences->General->Network Connections.
      E.g. in SAP inhouse network, we need “Active Provider” set to “Manual” and have proxy server and port defined for HTTP and HTTPS protocoll, but NOT for SOCKS.
      You might need other settings, depending on your network.

      Regards,
      Reiner.

      (0) 
  1. Marcel Michel
    Hi,
    thanks for your great bpmn2 implementation.
    Now I am looking for a visual 2d editor to display the created bpmn2 files. I’ve already tried to build an editor with the gm framework, but it seems to be later an administrative overhead. Thus I am searching a third party component, which supports your bpmn2 files, currently I am testing a Signavio product, but there are several problems during the import.

    Any suggestions?

    (0) 

Leave a Reply