drools-eclipse/org.jbpm.eclipse/src/main/java/org/jbpm/eclipse/wizard/project/NewJBPMProjectWizard.java
private void createProcess(IJavaProject project, IProgressMonitor monitor, String exampleType)
			throws CoreException, IOException {
		// create the process (sample.bpmn) file
		String fileName = "org/jbpm/eclipse/wizard/project/" + exampleType + ".bpmn.template";
		IFolder folder = null;
		folder = project.getProject().getFolder("src/main/resources/com/sample");
		FileUtils.createFolder(folder, monitor);
		IFile file = folder.getFile("sample.bpmn");
		InputStream inputstream = getClass().getClassLoader().getResourceAsStream(fileName);
		if (!file.exists()) {
			file.create(inputstream, true, monitor);
		} else {
			file.setContents(inputstream, true, false, monitor);
		}

		// create a Java main class to invoke the process
		fileName = "org/jbpm/eclipse/wizard/project/ProcessMain-" + exampleType + ".java";
		IRuntime runtime = startPage.getRuntime();
		if (runtime.getVersion().getMajor() == 5) {
			fileName += ".v5.template";
		} else {
			fileName += ".template";
		}
		
		folder = project.getProject().getFolder("src/main/java");
		IPackageFragmentRoot packageFragmentRoot = project.getPackageFragmentRoot(folder);
		IPackageFragment packageFragment = packageFragmentRoot.createPackageFragment("com.sample", true, monitor);
		inputstream = getClass().getClassLoader().getResourceAsStream(fileName);
		packageFragment.createCompilationUnit("ProcessMain.java", new String(FileUtils.readStream(inputstream)), true,
				monitor);

		
		// create persistence.xml
		if (runtime.getVersion().getMajor() == 5) {
			if ("advanced".equals(exampleType)) {
	        	folder = project.getProject().getFolder("src/main/resources/META-INF");
	    		FileUtils.createFolder(folder, monitor);
	            inputstream = getClass().getClassLoader().getResourceAsStream(
	            	"org/jbpm/eclipse/wizard/project/ProcessLauncher-advanced-persistence.xml.template");
	            file = folder.getFile("persistence.xml");
	            if (!file.exists()) {
	                file.create(inputstream, true, monitor);
	            } else {
	                file.setContents(inputstream, true, false, monitor);
	            }
			}
		}
	}
private void createProcess(IJavaProject project, IProgressMonitor monitor, String exampleType)
			throws CoreException, IOException {
		// create the process (sample.bpmn) file
		String fileName = "org/jbpm/eclipse/wizard/project/" + exampleType + ".bpmn.template";
		IFolder folder = null;
		folder = project.getProject().getFolder("src/main/resources/com/sample");
		FileUtils.createFolder(folder, monitor);
		IFile file = folder.getFile("sample.bpmn");
		InputStream inputstream = getClass().getClassLoader().getResourceAsStream(fileName);
		if (!file.exists()) {
			file.create(inputstream, true, monitor);
		} else {
			file.setContents(inputstream, true, false, monitor);
		}

		// create a Java main class to invoke the process
		fileName = "org/jbpm/eclipse/wizard/project/ProcessMain-" + exampleType + ".java";
		IRuntime runtime = startPage.getRuntime();
		if (runtime.getVersion().getMajor() == 5) {
			fileName += ".v5.template";
		} else {
			fileName += ".template";
		}
		
		folder = project.getProject().getFolder("src/main/java");
		IPackageFragmentRoot packageFragmentRoot = project.getPackageFragmentRoot(folder);
		IPackageFragment packageFragment = packageFragmentRoot.createPackageFragment("com.sample", true, monitor);
		inputstream = getClass().getClassLoader().getResourceAsStream(fileName);
		packageFragment.createCompilationUnit("ProcessMain.java", new String(FileUtils.readStream(inputstream)), true,
				monitor);

		
		// create persistence.xml
		if (runtime.getVersion().getMajor() == 5) {
			if ("advanced".equals(exampleType)) {
	        	folder = project.getProject().getFolder("src/main/resources/META-INF");
	    		FileUtils.createFolder(folder, monitor);
	            inputstream = getClass().getClassLoader().getResourceAsStream(
	            	"org/jbpm/eclipse/wizard/project/ProcessLauncher-advanced-persistence.xml.template");
	            file = folder.getFile("persistence.xml");
	            if (!file.exists()) {
	                file.create(inputstream, true, monitor);
	            } else {
	                file.setContents(inputstream, true, false, monitor);
	            }
			}
		}
	}
private void createProcess ( IJavaProject project , IProgressMonitor monitor , String exampleType ) throws CoreException , IOException { // create the process (sample.bpmn) file String fileName = "org/jbpm/eclipse/wizard/project/" + exampleType + ".bpmn.template" ; IFolder folder = null ; folder = project . getProject ( ) . getFolder ( "src/main/resources/com/sample" ) ; FileUtils . createFolder ( folder , monitor ) ; IFile file = folder . getFile ( "sample.bpmn" ) ; InputStream inputstream = getClass ( ) . getClassLoader ( ) . getResourceAsStream ( fileName ) ; if ( ! file . exists ( ) ) { file . create ( inputstream , true , monitor ) ; } else { file . setContents ( inputstream , true , false , monitor ) ; } // create a Java main class to invoke the process fileName = "org/jbpm/eclipse/wizard/project/ProcessMain-" + exampleType + ".java" ; IRuntime runtime = startPage . getRuntime ( ) ; if ( runtime . getVersion ( ) . getMajor ( ) == 5 ) { fileName += ".v5.template" ; } else { fileName += ".template" ; } folder = project . getProject ( ) . getFolder ( "src/main/java" ) ; IPackageFragmentRoot packageFragmentRoot = project . getPackageFragmentRoot ( folder ) ; IPackageFragment packageFragment = packageFragmentRoot . createPackageFragment ( "com.sample" , true , monitor ) ; inputstream = getClass ( ) . getClassLoader ( ) . getResourceAsStream ( fileName ) ; packageFragment . createCompilationUnit ( "ProcessMain.java" , new String ( FileUtils . readStream ( inputstream ) ) , true , monitor ) ; // create persistence.xml if ( runtime . getVersion ( ) . getMajor ( ) == 5 ) { if ( "advanced" . equals ( exampleType ) ) { folder = project . getProject ( ) . getFolder ( "src/main/resources/META-INF" ) ; FileUtils . createFolder ( folder , monitor ) ; inputstream = getClass ( ) . getClassLoader ( ) . getResourceAsStream ( "org/jbpm/eclipse/wizard/project/ProcessLauncher-advanced-persistence.xml.template" ) ; file = folder . getFile ( "persistence.xml" ) ; if ( ! file . exists ( ) ) { file . create ( inputstream , true , monitor ) ; } else { file . setContents ( inputstream , true , false , monitor ) ; } } } }
Create the sample process file.
@throws IOException
Create the sample process file .