activiti--6-------------------------------------Connection (query order for general database tables)

Source: Internet
Author: User

First, the flowchart

Second, this time to put the flowchart and Java class under a package

Third, the Code

 PackageCom.xingshang.f_sequenceFlow;ImportJava.io.InputStream;ImportJava.util.HashMap;Importjava.util.List;ImportJava.util.Map;ImportOrg.activiti.engine.ProcessEngine;ImportOrg.activiti.engine.ProcessEngines;Importorg.activiti.engine.repository.Deployment;Importorg.activiti.engine.runtime.ProcessInstance;ImportOrg.activiti.engine.task.Task;Importorg.junit.Test; Public classSequenceflowtest {//Work engineProcessengine Processengine =Processengines.getdefaultprocessengine (); /*** Deployment process definition (from InputStream)*/@Test Public voidDeploymentprocessdefinition_inputstream () {InputStream INPUTSTREAMBPMN= This. GetClass (). getResourceAsStream ("SEQUENCEFLOW.BPMN");//under the same package, no additional paths are added/InputStream inputstreampng = This. GetClass (). getResourceAsStream ("Sequenceflow.png"); Deployment Deployment= Processengine.getrepositoryservice ()//Service related to process definition and deployment. Createdeployment ()//Create a Deployment object. Name ("Wired")//Add the name of the deployment. Addinputstream ("SEQUENCEFLOW.BPMN", INPUTSTREAMBPMN)//use the name of the resource file (required: Match the name of the resource file) and the input stream to complete the deployment. Addinputstream ("Sequenceflow.png", Inputstreampng)//use the name of the resource file and the input stream to complete the deployment. deploy ();//Complete DeploymentSYSTEM.OUT.PRINTLN ("Deployment ID:" + deployment.getid ());//SYSTEM.OUT.PRINTLN ("Deployment name:" + deployment.getname ());//    }        /*** START Process instance*/@Test Public voidstartprocessinstance () {//process-defined keyString Processdefinitionkey = "Sequenceflow"; ProcessInstance Pi= Processengine.getruntimeservice ()//service associated with the executing process instance and the execution object. Startprocessinstancebykey (Processdefinitionkey);//use the process-defined key to start the process instance, key corresponds to the attribute value of the ID in the HELLOWORLD.BPMN file, starts with the key value, and is started by default according to the latest version of the process definitionSystem.out.println ("Process Instance ID:" + pi.getid ());//Process Instance IDSYSTEM.OUT.PRINTLN ("Process definition ID:" + pi.getprocessdefinitionid ());//Process Definition ID    }        /*** Query the individual tasks of the current person*/@Test Public voidFindmypersonaltask () {String Assignee= "Xi Big"; List<Task> list = Processengine.gettaskservice ()//Sercice related to the task management being performed. Createtaskquery ()//To create a task query object. Taskassignee (Assignee)//Specify personal task query, specify the person. List (); if(List! =NULL&& list.size () > 0){             for(Task task:list) {System.out.println ("Task ID:" +Task.getid ()); System.out.println ("Task Name:" +task.getname ()); System.out.println ("Task Creation time:" +task.getcreatetime ()); System.out.println ("Task-holder:" +Task.getassignee ()); System.out.println ("Process Instance ID:" +Task.getprocessinstanceid ()); System.out.println ("Execute Object ID:" +Task.getexecutionid ()); System.out.println ("Process definition ID:" +Task.getprocessdefinitionid ()); }        }    }        /*** Finish my task.*/@Test Public voidCompletemypersonaltask () {String taskId= "1603"; //while completing the task, using the process variables, using the process variables to specify the completion of the task, the next line, corresponding to the SEQUENCEFLOW.BPMN file ${message== ' unimportant '}map<string, object> variables =NewHashmap<string, object>();//variables.put ("message", "unimportant");Variables.put ("message", "important");//information important and unimportant will choose two different branches to run, that is, the corresponding process is not the sameProcessengine.gettaskservice ()//Sercice related to the task management being performed. Complete (taskId, variables); System.out.println ("Task Complete: Task ID:" +taskId); }}

Iv. query Order of database tables

#部署对象和流程定义相关的表 #Select *  fromact_re_deployment #部署对象表 #Select *  fromact_re_procdef #流程定义表 #Select *  fromAct_ge_bytearray #资源文件表 #Select *  fromAct_ge_property #主键生成策略表
################################################## #部署实例, execute object, Task #Select * fromact_ru_execution #正在执行的执行对象表 #Select * fromAct_hi_procinst #流程实例的历史表 #Select * fromact_ru_task #正在执行的任务表 (data exists in the table only when the node is usertask) #Select * fromact_hi_taskinst #任务历史表 (data exists in the table only when the node is usertask) #Select * fromact_hi_actinst #所有活动节点的历史表 ################################################### #流程变量 #Select * fromact_ru_variable #正在执行的流程变量表 #Select * fromAct_hi_varinst #历史的流程变量表

V. Summary

1. One or more Sequenceflow can be specified in an activity (one in start, not in end)
* There is a sequenceflow in the beginning of the activity
* No sequenceflow at the end of the event
* There are 1 or more sequenceflow in other activities

2. If there is only one, you can set the name of the codition without using the process variable


If there are multiple, you need to set the name of the codition using the process variable, which indicates the name of the process variable,
' Unimportant ' represents the value of the process variable, and the content in the middle of the ${} uses a Boolean expression that is used to determine which line should be executed

3. If you place the flowchart in the same path as the Java class, you need to configure

activiti--6-------------------------------------Connection (query order for general database tables)

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.