1. Deployment Rules
2. Open process
3. Get the first Excution execution object
4. According to the conditions, the next execution of the Excution execution object, and complete the corresponding logic
Note: There are 3 scenarios where the default flow option in the Judgment node is selected to point to the default node The Sequence Flow connection
Packagecom.tabchanj.activiti.receive;Importorg.activiti.engine.runtime.Execution;Importorg.activiti.engine.runtime.ProcessInstance;ImportOrg.junit.Assert;Importorg.junit.Test; Public classReceivetestextendsbaseprocess {@Test Public voidTESTPSS ()throwsException {//Deployment RulesDeploy ("PSS.BPMN"); //Open ProcessProcessInstance pi = Runservice.startprocessinstancebykey ("Pssid"); System.out.println ("Process ID:" +Pi.getid ()); //gets the ID of the current process instanceString PID =Pi.getid (); //gets the execution object with the ID name of the sales ID for the current dayExecution e1=runservice.createexecutionquery (). Processinstanceid (PID). ActivityID ("Statistics Day sales ID"). Singleresult (); //using assertions, expected results should not be emptyAssert.assertnotnull (E1); Double Money=2888.8d; //set the process variable money as the basis of judgment to the process variableRunservice.setvariable (E1.getid (), "Money", Money); //signals that the current node execution is completerunservice.signal (E1.getid ()); //Process Judgment if(money<1000) {Execution E2=runservice.createexecutionquery (). Processinstanceid (PID). ActivityID ("Send SMS ID to Boss"). Singleresult (); Assert.assertnotnull (E2); System.out.println ("SMS: Boss, small profit Today" +runservice.getvariable (E2.getid (), "money") + "Yuan"); Runservice.signal (E2.getid ()); }Else if(money>=10000) {Execution E3=runservice.createexecutionquery (). Processinstanceid (PID). ActivityID ("e-mail ID to the Boss"). Singleresult (); Assert.assertnotnull (E3); System.out.println ("Mail: Boss, today Hao earn" +money+ "Yuan"); Runservice.signal (E3.getid ()); }Else{execution E4=runservice.createexecutionquery (). Processinstanceid (PID). ActivityID ("Default ID"). Singleresult (); Assert.assertnotnull (E4); System.out.println ("Default: Boss, earn Today" +money+ "Yuan"); Runservice.signal (E4.getid ()); } //Check process statusAssert.assertnull (getprocessinstence (PID)); System.out.println ("Process Check Complete"); } }
"Activiti" Process execution with node judgment