Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BPMN Modeler » Adding a Pool using the BPMNVisual2ProcessGenerator
Adding a Pool using the BPMNVisual2ProcessGenerator [message #669536] Tue, 10 May 2011 11:51
richard.mrasek is currently offline richard.mrasek
Messages: 2
Registered: May 2011
Junior Member
Hallo,

I try to load my .bpmn_diagram file and add a new Pool to it. My Program throws a java.lang.NullPointerException in BPMNProcessGenerator.addPool method. I think the problem is how I read the file.

thank you for Reading.

import java.io.File;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.stp.bpmn.BpmnPackage;
import org.eclipse.stp.bpmn.diagram.generation.impl.BPMNVisual2ProcessGenerator;

public class TestingGenerator {
	private String Path = "src/bpmnDia.bpmn";
	
	public static void main(String[] args) {
		TestingGenerator tg = new TestingGenerator();
		Diagram graphicalModel = (Diagram) tg.load_BpmnDiagram(tg.Path+"_diagram");
		BPMNVisual2ProcessGenerator generator = new BPMNVisual2ProcessGenerator(graphicalModel);
		generator.addPool("test");
		generator.save();
	}
	private EObject load_BpmnDiagram(String FilePath){
		BpmnPackage.eINSTANCE.eClass();
		NotationPackage.eINSTANCE.eClass();
		File bpmnFile = new File(FilePath);
		ResourceSet rs = new ResourceSetImpl();
		rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("bpmn_diagram", new XMIResourceFactoryImpl());
		URI uri = URI.createFileURI(bpmnFile.getAbsolutePath());
		Resource resource = rs.getResource(uri, true);
		return resource.getContents().get(0);
	}
}



Exception in thread "main" java.lang.NullPointerException
	at org.eclipse.stp.bpmn.diagram.generation.impl.BPMNProcessGenerator.addPool(BPMNProcessGenerator.java:285)
	at TestingGenerator.main(TestingGenerator.java:20)
Previous Topic:How to enable the Save button once a tabbed propertySections is modified
Next Topic:Run BPMN Modeler
Goto Forum:
  


Current Time: Thu Aug 21 16:15:37 EDT 2014

Powered by FUDForum. Page generated in 0.01672 seconds