Set process definition diagram BPMN
Assignee: Applicant, Auditor
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/79/60/wKioL1aPcfXBT9s2AAApORknZGg222.png "title=" Hello.png "alt=" Wkiol1apcfxbt9s2aaaporknzgg222.png "/>
Table of related actions
--Act_re_procdef Process definition table
--act_re_deployment Deployment table
--Act_ge_property common property sheet ID generation policy
--Act_ru_execution execution object, process instance, process object
--act_ru_task Task table
Getting Started example:
1. Create process engine and workflow data table
-Databases and tables can be created automatically,
Enables automatic creation of databases and tables when you configure a database connection
-Get Processengine Object
First get the Processengineconfiguration object, and then the object to build the Processengine
2. Deployment process
Table of Influence:
ACT_RE_PROCDEF: Process Definition table:
The key attribute of the table is the BPMN ID decision
The Name property of the table is the BPMN Name property that determines
Act_re_deployment: Deployment table: ID is determined by Act_ge_property's next_dbid
Act_ge_property: Common attribute table
3. Start the process
4. View my personal tasks
5. Complete my personal tasks
Example code:
package com;import java.util.list;import org.activiti.engine.processengine;import org.activiti.engine.processengines;import org.activiti.engine.repository.deployment;import org.activiti.engine.runtime.processinstance;import org.activiti.engine.task.task;import org.junit.test;public class activititest { /** * build tables and create process engine objects (core objects) */ @Test public void createprocessengine () { // Get process engine ProcessEngine processEngine = Processengines.getdefaultprocessengine (); system.out.println ( Processengine); } /** * deployment process Definition Affected table: act_re_procdef : process definition Table : The table's key property is bpmn 's id decision The table's Name property * is bpmn The name property determines act_re_deployment: The deployment table :id is determined by Act_ge_property's next_dbid &NBSP;*&NBSP;ACT_GE_PROPERTY&NBSP: Common property sheet */ @Test public void deploy () { // Get process engine ProcessEngine processEngine = Processengines.getdefaultprocessengine (); // get an instance of the warehouse service Deployment deployment = Processengine.getrepositoryservice ()// .createdeployment ()// .addclasspathresource("BPMN/HELLO.BPMN")// .addclasspathresource ("Bpmn/hello.png")// .name ("Reimbursement order Process"). Deploy (); system.out.println (Deployment.getid () + " " + deployment.getname ()); } /** * START process */ @Test Public void startprocess () { // Get process engine objects ProcessEngine processEngine = Processengines.getdefaultprocessengine (); // start-up process // Use ProcessThe defined key launches the process instance and, by default, launches the process instance according to the latest version processinstance pi = processengine.getruntimeservice (). Startprocessinstancebykey ("helloprocess"); system.out.println ("pid:" + pi.getid () + ", Activitiid:" + pi.getactivityid ()); } /** * View Tasks * @throws exception */ @Test public void querymytask () throws exception { // designated task-holders String assignee = "John Doe"; // Get process engine objects ProcessEngine processEngine = Processengines.getdefaultprocessengine(); // List of query tasks list<task> tasks = processengine.gettaskservice (). Createtaskquery ()// Create Task Query Object .taskassignee ( Assignee)// designated individual task person .list (); // traversal combined view content for (task task : tasks) { system.out.println ("TaskId:" + task.getid () + ", TaskName: " + task.getname ()); system.out.println ("*************************"); } } /** * Handling Tasks * @throws Exception */ @Test public void completetask () throws Exception { String taskId = "404"; // Get process engine objects Processengine processengine = processengines.getdefaultprocessengine (); Complete Task processengine.gettaskservice () .complete (taskId); system.out.println ("Complete the task! "); }}
This article is from the "Lao Niu Java" blog, please be sure to keep this source http://liuyj.blog.51cto.com/2340749/1732941
Activiti Getting Started example