Skip to Content
Author's profile photo Reiner Hille-Doering

Code corrections for the BPMN 2.0 article

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);
    }
}
 

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      Hi,
      I have followed the blog but in the step 3,4 "Enter http://git.eclipse.org/c/bpmn2/ into URI field:" appear an error.
      the status bar does not rise 40%.
      any idea?
      Author's profile photo Reiner Hille-Doering
      Reiner Hille-Doering
      Blog 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.

      Author's profile photo Former Member
      Former Member
      perfect!!
      thanks and best regards
      Author's profile photo Former Member
      Former Member
      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?