将流程发布到jbpm数据库中

packagecn.oa.jbpm.test;

importjava.io.File;

importjava.io.FileInputStream;

importjava.util.zip.ZipInputStream;

importorg.jbpm.JbpmConfiguration;

importorg.jbpm.JbpmContext;

importorg.jbpm.graph.def.ProcessDefinition;

//将流程发布到jbpm数据库中

publicclassProcessDeploymentTest{

publicstaticvoidmain(String[]args)throwsException{

JbpmContextjbpmContext=JbpmConfiguration.getInstance().createJbpmContext();

try{

//Stringzippath="c:/helloworld.zip";

//Stringzippath="c:/ProcessException.zip";

//Stringzippath="c:/nodeprocesss3.zip";

//Stringzippath="c:/script.zip";

//Stringzippath="c:/tasknodes.zip";

Stringzippath="c:/fork2.zip";

FileInputStreamin=newFileInputStream(newFile(zippath));

ZipInputStreamzin=newZipInputStream(in);

ProcessDefinitionprocessDefinition=ProcessDefinition.parseParZipInputStream(zin);

//利用jbpmContext将流程发布到数据库中

jbpmContext.deployProcessDefinition(processDefinition);

zin.close();

in.close();

}finally{

jbpmContext.close();

}

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

}

}

相关推荐