Activiti's process deployment

 

The previous article introduced the basic configuration of Activiti in IDEA development tools. In this chapter, we will learn basic BPMN knowledge and

Activiti's process deployment.

 

Introduction to BPMN

The Activiti project is a new Apache-licensed open source BPM platform built from the ground up to provide support for the new BPMN 2.0 standard, including support for the Object Management Group (OMG), in the face of opportunities for new technologies such as interoperability and cloud architecture, providing technical implementation.

So what is BPM and BPMN?

BPM: business process management, is a systematic method centered on the standardized construction of end-to-end excellent business processes and the purpose of continuously improving the business performance of the organization. Common business management education such as EMBA and MBA all include BPM. inside.

BPMN: Business process modeling and annotation, including how these elements are combined into a business process diagram (Business Process Diagram). A business process diagram is composed of a series of element symbols. As the basis of BPMN, these symbols simplify and graphically model business processes, visualize complex modeling processes, and allow readers to have a clearer understanding of BPMN. Since BPMN symbols are so important, it is necessary to have a comprehensive understanding of the names, meanings, and usage methods of BPMN symbols before drawing a schematic diagram of BPMN.

Four basic elements of BPMN

l Flow Objects: including events, activities, and gateways, which are the core elements of BPMN;

The event Event is represented by a circle and it is something that happens while the process is running. The occurrence of an event will affect the flow of the process. The event includes three types of Start\Intermediate\End. As shown below:

 

Activities Activities are represented by rounded rectangles. An activity consists of multiple activities. The types of activities are divided into Task and Sub-Process. As shown below:

 

The gateway is represented by a diamond and is used to control the branching and aggregation of the process. The specific symbols are represented as follows:

 

l Connecting Objects: including sequence flow, message flow, and association;

l Swimlanes: There are two types of pools and lanes;

l Artificial information (Artifacts): including data objects, groups, annotations.

 

 

 

Activiti's process deployment

The following describes how to deploy a simple attendance re-signing process in IDEA

1. First create a new bpmn directory in the resource directory

2. Right-click on the bpmn directory -> new -> bpmn file, enter the bpmn file name and the following interface will appear:

 

The left side of the interface is the property panel, you can view and modify the property values ​​of each bpmn element, the middle is the bpmn flow chart, and the far right is the various elements in the flow chart.

3. Draw a flowchart
                   1) Drag and drop a StartEvent (start event) and an EndEvent (end event) into the flowchart, and set the names as "start of supplementary sign" and "end of supplementary sign" respectively.
                   2) Drag and drop two UserTasks, set their names as Technical Manager Approval and Personnel Commissioner Confirmation
                   3) Connect the graphs, as shown above, prompt: move the mouse to the center of the graph, the icon shape will change, and then drag it to the bottom A graph completes the connection.

4. Generate a flow chart png image

Deploying an Activiti process requires a bpmn file and a flowchart image (png format). You can copy the bpmn file and change the suffix name to xml. Right-click on the xml file ->Diagrams->Show BPMN2.0 Designer The following interface will appear :

 

Click the export button at the top left, select the bpmn directory under resources, and save it as a png image.

5. Deployment process     

In the previous chapter, Activiti's core engine, ProcessEngine, was introduced. All services need to be obtained through the process engine.

The deployment process needs to use the RepositoryService. The warehouse service is a storage-related service. It is generally used to deploy process files, obtain process files, and query process definition information. It is an important service in the engine.
     How to get:

RepositoryService repositoryService

= engine.getRepositoryService ();

Deployment process:

@Test

public void deployAddSigninProcess() {

           // get the configuration object

    ProcessEngineConfiguration config =

               ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();

//create core engine

      ProcessEngine processEngine = config.buildProcessEngine();

// get warehouse service

      repositoryService = processEngine.getRepositoryService ();

//Deployment process, support chain programming

      repositoryService

.createDeployment() //Create a deployment object

                .key("addsigninProcess") //Set the deployment process key value

                .addClasspathResource("bpmn/proc_addsignin.bpmn") //Add bpmn file

                .addClasspathResource("bpmn/proc_addsignin.png") //Add png file

                .name("Supplementary Signing Process") //Set the process name

                .deploy(); //deploy

    }

       

After executing the above code, records will be inserted into the following three tables:

act_re_deployment stores the display name and deployment time of the process definition, and a record is added for each deployment

 

act_re_procdef stores the attribute information of the process definition, and the deployment process definition will add a record to this table.

 

act_ge_bytearray stores deployment information related to process definitions. That is, where the process definition document is stored.

 

 

Such a re-signing process completes the deployment, and then we can conduct layer-by-layer approvals according to the deployment process until the entire process is completed.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325612527&siteId=291194637