Java Process Management JBPM Process instance publish, view, terminate, delete

Source: Internet
Author: User
Package com.jiaocaigen002.processinstance;

Import java.util.List;

Import org.jbpm.api.*;

Import Junit.framework.TestCase;  /** * Process Instance * @author Leiwei 2012-3-20 * * */public class Processinstancetest extends TestCase {//Process engine Processengine

	Processengine;
	Public Processinstancetest () {processengine = Configuration.getprocessengine (); /** * Release process definition/protected void setUp () {//Process resource service interface, such as process definition Publishing, query, delete processengine.getrepositoryservice (). CRE
	Atedeployment (). Addresourcefromclasspath ("Helloworld.jpdl.xml"). deploy (); /** * NEW Process * * * * public void Newprocessinstance () {//service for the operation of human tasks, can perform task creation, query, acquisition, submission, save, delete, etc. Executionservic
		E Executionservice = Processengine.getexecutionservice ();
		
		ProcessInstance processinstance = Executionservice.startprocessinstancebykey ("HelloWorld");
		
		To see if the process has ended System.out.println ("The process has ended:" +processinstance.isended ()); Skip the wait directly and end processinstance = Executionservice.signalexecutionbyid (proceSsinstance.getid ());
	System.out.println ("Whether the process is finished:" +processinstance.isended ()); /** * Terminate the process */public void endprocessinstance () {Executionservice Executionservice = Processengine.getexecutio
		Nservice ();
		ProcessInstance processinstance = Executionservice.startprocessinstancebykey ("HelloWorld");
	Executionservice.endprocessinstance (Processinstance.getid (), "cancle"); /** * Delete process * * public void Deleteprocessinstance () {Executionservice Executionservice = Processengine.getexecu
		Tionservice ();
		ProcessInstance processinstance = Executionservice.startprocessinstancebykey ("HelloWorld");
	Executionservice.deleteprocessinstancecascade (Processinstance.getid ()); /** * View Process * * * public void Selectprocessinstance () {Executionservice Executionservice = Processengine.getexecu
		Tionservice ();
		ProcessInstance ProcessInstance1 = Executionservice.startprocessinstancebykey ("HelloWorld"); ProcessInstance ProcessInstance2 = Executionservice.startprocessinstancebyKey ("HelloWorld"); List<processinstance> processinstancelist= Executionservice. Createprocessinstancequer
		
		Y (). List ();
		for (ProcessInstance processinstance:processinstancelist) {System.out.println ("Number of processes:" +processinstance.getid ());
 }
	}
	
}


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.