Activiti workflow principle

With the aid of a computer, enables automatic control of the process, called a workflow.

Encoding flag provided by the state to the workflow, the disadvantage of this approach is that the business process is changed, the program can not be used.

Activiti can be done after the changes in business processes, without changing the program code. Maintaining the status quo.

working principle:

  1. First the good flow picture

  2. The data flowchart of each node is read into a table and

  3. The process in the first data table, and delete processing

  4. Repeat step 3 (recorded in the table until finished)

To achieve this automation needs

  1. Business flowchart standards, standardized and unified

  2. The flowchart of the operations is essentially an xml file, so that the necessary data can be stored

  3. Read the business process flow chart of the process is to parse xml files

  4. Read the flowchart in a service node, equivalent analytic xml structure, further insert data into a database table record form

  5. The nodes are all read and stored in the database table

  6. behind only need to read a record in a database table, a record is read corresponding to read a node

  7. Business process forward, back on the table to be read into the data, and process data, this line data will be deleted at the end of

Technical solution probably involves:

   xml + dom4j parsing data stored flowchart + mysql + jdbc CRUD operations database

Activiti7 provides as a support table 25, is stored in process control.

 

Development steps

  1. Integration guide jar package Activiti

  2. modeling business processes, business flowchart implemented using BPMN

  3. Deploying business processes to Acitiviti

  4. A process instance is started

  5. Query to-do

  6. Treatment agency task

  7. cycle 6.7.

  8. End Process

 

Development environment

  jdk 1.8

  mysql 5 or more

  web container tomcat8.5

  Development tools eclipse or idea

  spring5 more

 

Activiti Download

    <dependency>

      <groupId>org.activiti</groupId>

      <artifactId>activiti-dependencies</artifactId>

      <version>7.0.0.Betal</version>

      <scope>import</scope>

      <type>pom</type>

    </dependency>

 

Install Eclipse BPMN's generals web designer download demo version of the process decompression,

The feature of the package to the jar eclipes installation directory of the features,

The copy in the directory screen plugs into plugs directory eclipse, the eclipse would support such a BPM designer.

After the import was successful in the new eclipse can be seen in the presence of Activiti Diagram and Activiti Project under the Activiti.

 

This will create a java SE src new project in a Activiti Diagram for testing.

After you create bpmn file if you want to save the picture, Acticiti node in the eclipse of preference in save Action in

勾选Create process definition image when save the diagram。

 

File installation easier setting in the inside of plugs inside the search IDEA in actiBPM then click install.

 

Activiti database support roughly H2, mysql, oracle, postgres, DB2, mssql

 

mysql ready library create database activiti default character set utf8;

 

Start creating the project after the completion of the preparatory work

1 Create a maven project lead pack

    <dependency>

      <groupId>org.activiti</groupId>

      <artifactId>activiti-engine</artifactId>

      <version>7.0.0.Betal</version>

    </dependency>

    <dependency>

      <groupId>org.activiti</groupId>

      <artifactId>activiti-spring</artifactId>

      <version>7.0.0.Betal</version>

    </dependency>

    <dependency>

      <groupId>org.activiti</groupId>

      <artifactId>activiti-bpmn-model</artifactId>

      <version>7.0.0.Betal</version>

    </dependency>

    <dependency>

      <groupId>org.activiti</groupId>

      <artifactId>activiti-bpmn-converter</artifactId>

      <version>7.0.0.Betal</version>

    </dependency>

    <dependency>

      <groupId>org.activiti</groupId>

      <artifactId>activiti-json-model</artifactId>

      <version>7.0.0.Betal</version>

    </dependency>

    <dependency>

      <groupId>org.activiti</groupId>

      <artifactId>activiti-bpmn-layout</artifactId>

      <version>7.0.0.Betal</version>

    </dependency>

    <dependency>

      <groupId>org.activiti.cloud</groupId>

      <artifactId>activiti-cloud-servers-api</artifactId>

      <version>7.0.0.Betal</version>

    </dependency>

    <dependency>

      <groupId>mysql</groupId>

      <artifactId>mysql-connector-java</artifactId>

      <version>5.1.40</version>

    </dependency>

    <dependency>

      <groupId>junit</groupId>

      <artifactId>junit</artifactId>

      <version>4.12</version>

    </dependency>

    <dependency>

      <groupId>log4j</groupId>

      <artifactId>log4j</artifactId>

      <version>${log4j.version}</version>

    </dependency>

    <dependency>

      <groupId>org.slf4j</groupId>

      <artifactId>slf4j-api</artifactId>

      <version>${slf4j.version}</version>

    </dependency>

    <dependency>

      <groupId>org.slf4j</groupId>

      <artifactId>slf4j-log4j12</artifactId>

      <version>${slf4j.version}</version>

    </dependency>

    <dependency>

      <groupId>org.mybatis</groupId>

      <artifactId>mybatis</artifactId>

      <version>3.4.5</version>

    </dependency>

    <dependency>

      <groupId>commons-dbcp</groupId>

      <artifactId>commons-dbcp</artifactId>

      <version>1.4</version>

    </dependency>

 

2 In the resource configuration log configured log4j.properties

  In the Activiti resource configuration acticiti.cfg.xml configured dbcp data source configuration processEngine configurations enable separate ways

<bean id="dataSource" class="org.apaches.commons.dbcp.BasicDataSource">

  <properties neme="driverClassName" value="com.mysql.jdbc.Driver"/>

  <properties neme="url" value="jdbc:mysql://localhost:3306/activiti"/>

  <properties neme="username" value="root"/>

  <properties neme="password" value="root"/>

<./bean>

<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StardaloneProcessEngineConfiguration">

  <properties neme="dataSource" ref="dataSource"/>

  <properties neme="databaseSchemaUpdate" value="true"/>

<./bean>

 

3 test class test automatically create 25 tables, after performing generates 25 tables

public class ActivitiTest{

  @Test

  public void testGeneratorTable(){

    1 // Create an object ProcessEngineConfiguration

    ProcessEngineConfiguration configuration = ProcessEngineConfiguration 

      .createProcessEngineConfigurationFromResource("acticiti.cfg.xml");

    // 2. Create Object ProcessEngine

    ProcessEngine processEngine = configuration.bulidProcessEngine ();

  }

}

 

 

 

 

 

 

 

 

 

Continued 16. . .

Guess you like

Origin www.cnblogs.com/dengw125792/p/12286081.html