Getting started with Activiti7 workflow and basic usage

catalogue

1, Workflow introduction

1.1 concept

1.2 workflow system

1.3 applicable industries

1.4 specific application

1.5 implementation mode

2, Activiti7 overview

2.1 introduction

2.1.1 BPM

2.1.2 BPM software

2.1.3 BPMN

2.2 use steps

1, Workflow introduction

1.1 concept

Workflow (Workflow) , is to automate the management of business processes through computers. Its main solution is " The process of automatically transferring documents, information or tasks among multiple participants according to some predefined rules, so as to achieve a desired business goal or promote the realization of this goal " .

1.2 workflow system

A software system has the function of workflow. We call it workflow system. What is the function of workflow in a system? It is to automatically manage the business process of the system, so workflow is based on business process. Therefore, the core of a software system is still the business process of the system, and workflow only assists in business process management. Even if there is no workflow, the business system can be developed and run, but with workflow, the business process can be better managed and the scalability of the system can be improved.

1.3 applicable industries

Consumer goods industry, manufacturing, telecommunications services, banking, securities and insurance and other financial services, logistics services, property services, property management, large and medium-sized import and export trading companies, government institutions, research institutes and educational services, especially large multinational enterprises and group companies.

1.4 specific application

1 Key business processes: order, quotation processing, contract review, customer telephone processing, supply chain management, etc
2 . administrative management : Travel application, overtime application, leave application, vehicle application, various office supplies application, purchase application, daily and weekly report and other administrative forms that were originally manually processed.
3 Personnel management: employee training arrangement, performance evaluation, position change processing, employee file information management, etc.
4 Financial related categories: payment request, accounts receivable processing, daily reimbursement processing, business trip reimbursement, budget and plan application, etc.
5 Customer service: customer information management, customer complaints, request handling, after-sales service management, etc.
6 . special services: ISO Series corresponding processes, quality management corresponding processes, product data information management, customs declaration processing of trading companies, cargo tracking processing of logistics companies and other tasks completed through gradual manual flow of forms can be implemented automatically and standardized by workflow software.

1.5 implementation mode

Before there was no special workflow engine, in order to realize process control, we usually used the value of the status field to track the changes of the process. In this way, users without roles can determine whether to display records through the value of the status field.
For records that can be viewed with permission, the current user decides whether to approve or not according to his role. If qualified, set a value in the status field to represent qualified; Of course, if it is unqualified, you also need to set a value to represent the unqualified situation.
This is the most primitive way. Although process control is achieved through the status field, when our process changes, the code written in this way should also be adjusted.
So is there a professional way to realize workflow management? Moreover, after the business process changes, our program can not be changed. If this effect can be achieved, the adaptability of our business system has been greatly improved.

2, Activiti7 overview

2.1 introduction

Alfresco Software in 2010 year 5 month 17 Day announcement Activiti The business process management (BPM) open source project was officially launched, and its chief architect was an expert in Business Process Management BPM Tom Baeyens to serve as, Tom Baeyens It's the original jbpm Architects, and jbpm Is a very famous workflow engine. Of course, activiti is also a workflow engine.
Activiti Is a workflow engine, activiti It can extract the complex business processes in the business system and use a special modeling language BPMN2.0 The business process is defined and executed according to the pre-defined process, which realizes that the process of the system is controlled by activiti Management to reduce the workload of system upgrading and transformation of business system due to process change, so as to improve the robustness of the system and reduce the cost of system development and maintenance.
Official website: https://www.activiti.org/

 

2.1.1 BPM

BPM Business Process Management, that is, Business Process Management, is a standardized end-to-end business process to continuously improve the business efficiency of the organization. Common business management education such as EMBA , MBA Etc BPM Included.

2.1.2 BPM software

BPM Software is the IT of business methods and solutions that promote the integration and adjustment between people, between people and systems, and between systems according to the changes of business environment in the enterprise Tools.
adopt BPM The software models, automates, manages, monitors and optimizes the whole life cycle of the internal and external business processes of the enterprise, so as to reduce the cost and greatly improve the profit of the enterprise.
BPM Software is widely used in enterprises, where there are business processes BPM Software management, such as enterprise personnel office management, procurement process management, document approval process management, financial management, etc.

2.1.3 BPMN

BPMN (Business Process Model AndNotation) - Business process models and symbols are created by A set of standard business process modeling symbols developed by BPMI (business process management initiative) uses BPMN The symbols provided can create business processes.
 
2004 year 5 Released in June BPMN1.0 standard .BPMI to 2005 year 9 Monthly merger OMG (The Object Management Group) ) Organization. OMG 2011 year 1 Monthly release BPMN2.0 Final version of.
The specific development history is as follows :

 

BPMN Is currently being BPM Widely accepted by manufacturers BPM Standard. Activiti Is to use BPMN 2.0 Process modeling and process execution management include many modeling symbols, such as:
Event
Represented by a circle, it is what happens during the running of the process.

Activities are represented by rounded rectangles. A process consists of one or more activities

 

bpmn graphics actually represent business processes through xml The bpmn file is opened using a text editor:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn"
             xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
             xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
             typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath"
             targetNamespace="http://www.activiti.org/test">
    <process id="myProcess" name="My process" isExecutable="true">123
        2.2 Use steps
        <startEvent id="startevent1" name="Start"></startEvent>
        <userTask id="usertask1" name="Create a leave form"></userTask>
        <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
        <userTask id="usertask2" name="Reviewed by Department Manager"></userTask>
        <sequenceFlow id="flow2" sourceRef="usertask1" targetRef="usertask2"></sequenceFlow>
        <userTask id="usertask3" name="Personnel review"></userTask>
        <sequenceFlow id="flow3" sourceRef="usertask2" targetRef="usertask3"></sequenceFlow>
        <endEvent id="endevent1" name="End"></endEvent>
        <sequenceFlow id="flow4" sourceRef="usertask3" targetRef="endevent1"></sequenceFlow>
    </process>
    <bpmndi:BPMNDiagram id="BPMNDiagram_myProcess">
        <bpmndi:BPMNPlane bpmnElement="myProcess" id="BPMNPlane_myProcess">
            <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
                <omgdc:Bounds height="35.0" width="35.0" x="130.0" y="160.0"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
                <omgdc:Bounds height="55.0" width="105.0" x="210.0" y="150.0"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
                <omgdc:Bounds height="55.0" width="105.0" x="360.0" y="150.0"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3">
                <omgdc:Bounds height="55.0" width="105.0" x="510.0" y="150.0"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
                <omgdc:Bounds height="35.0" width="35.0" x="660.0" y="160.0"></omgdc:Bounds>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
                <omgdi:waypoint x="165.0" y="177.0"></omgdi:waypoint>
                <omgdi:waypoint x="210.0" y="177.0"></omgdi:waypoint>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
                <omgdi:waypoint x="315.0" y="177.0"></omgdi:waypoint>
                <omgdi:waypoint x="360.0" y="177.0"></omgdi:waypoint>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
                <omgdi:waypoint x="465.0" y="177.0"></omgdi:waypoint>
                <omgdi:waypoint x="510.0" y="177.0"></omgdi:waypoint>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
                <omgdi:waypoint x="615.0" y="177.0"></omgdi:waypoint>
                <omgdi:waypoint x="660.0" y="177.0"></omgdi:waypoint>
            </bpmndi:BPMNEdge>
        </bpmndi:BPMNPlane>
    </bpmndi:BPMNDiagram>
</definitions>

2.2 use steps

deploy activiti
Activiti Is a workflow engine (actually a bunch of jar package API ), business system access ( operation )activiti It is convenient to operate process related data, so that the workflow environment can be integrated with the business system environment.
Process definition
use activiti Process modeling tools (activity-designer) Define business processes (.bpmn file ) .
. bpmn file is a business process definition file, which is created by xml Define business processes.
Process definition deployment
activiti Deploy the business process definition (. bpmn file).
use activiti Provided api Store the process definition content in the Activiti You can query the defined content during execution
Activiti The execution stores the process definition content in the database
Start a process instance
Process instances are also called: ProcessInstance
Starting a process instance means starting a business process run.
After the employee leave process definition deployment is completed, if Zhang San wants to leave, he can start a process instance. If Li Si wants to leave, he can also start a process instance,
The execution of the two processes does not affect each other.
User query to-do tasks (Task)
Because the business process of the system has been handed over to activiti Management, through activiti You can query where the current process has been executed and what tasks the current user needs to handle Help us manage it without the need for developers to write it themselves sql Statement query.
User handling tasks
After you query a to-do task, you can handle a task. If this task is completed, other users need to handle it. For example, after the purchase order is created, it is approved by the Department Manager. This process is also handled by activiti It's done for us.
End of process
When the task processing is completed and there is no next task node, the process instance is completed.

Keywords: Java Activiti

Added by sullyman on Tue, 21 Dec 2021 11:09:04 +0200