将流程发布到jbpm数据库中

package cn.oa.jbpm.test;

import java.io.File;
import java.io.FileInputStream;
import java.util.zip.ZipInputStream;

import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.graph.def.ProcessDefinition;
//将流程发布到jbpm数据库中
public class ProcessDeploymentTest {

public static void main(String[] args) throws Exception {
JbpmContext jbpmContext=JbpmConfiguration.getInstance().createJbpmContext();
try {
// String zippath="c:/helloworld.zip";
// String zippath="c:/ProcessException.zip";
// String zippath="c:/nodeprocesss3.zip";
// String zippath="c:/script.zip";
// String zippath="c:/tasknodes.zip";
String zippath="c:/fork2.zip";
FileInputStream in=new FileInputStream(new File(zippath));
ZipInputStream zin=new ZipInputStream(in);
ProcessDefinition processDefinition=ProcessDefinition.parseParZipInputStream(zin);
//利用jbpmContext将流程发布到数据库中
jbpmContext.deployProcessDefinition(processDefinition);
zin.close();
in.close();
} finally {
jbpmContext.close();

}
System.out.println("流程已发布到jbpm数据库");
}
}

你可能感兴趣的:(jbpm)