preface
Due to work reasons, I have been studying Activiti7 recently. In view of the lack of information on Activiti7 and the complexity of the introduction on the official website, the project probably has a model by looking at the Activiti forum and referring to the api of the previous version of Activiti. At present, although there are little achievements, there are still many shortcomings. I'll share them with you first.
Workflow theory
Workflow is a concept proposed for routine activities with fixed procedures in work. By decomposing work activities into well-defined tasks, roles, rules and processes for implementation and monitoring, the purpose of improving production organization level and work efficiency is achieved. The main working principle of workflow is to reverse the workflow according to a defined workflow; In the process of circulation, data filling and processing are realized. The use steps are mainly to define the flow chart, publish the flow chart, bind with the defined business, and trigger the process for operation.
Differences between Activiti7 and Activiti5 and 6
Activiti7 has changed a lot from Activiti5 and actiti6. From a macro perspective, activiti7 integrates docker, microservices, kubernetes, activiti cloud, activiti cloud, cloud native and spring boot 2.0. In terms of use, it lacks IdentityService and FormService interfaces with the previous two versions. (the solutions of the few FormService interfaces will be given in the following articles, but the solutions are still not found without the IdentityService interface. If you know, you can give them in the comments.)
Configure Activiti7
Complete pom file
<?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>com.xxx</groupId> <artifactId>xxxxx</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>jar</packaging> <name>xxxx</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-engine</artifactId> <!-- <version>6.0.0</version> --> <version>7.1.8</version> </dependency> <!-- Activiti Online design --> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-modeler</artifactId> <version>5.22.0</version> <exclusions> <exclusion> <artifactId>spring-beans</artifactId> <groupId>org.springframework</groupId> </exclusion> <exclusion> <artifactId>spring-context</artifactId> <groupId>org.springframework</groupId> </exclusion> <exclusion> <artifactId>spring-core</artifactId> <groupId>org.springframework</groupId> </exclusion> <exclusion> <artifactId>spring-tx</artifactId> <groupId>org.springframework</groupId> </exclusion> <exclusion> <artifactId>spring-web</artifactId> <groupId>org.springframework</groupId> </exclusion> <exclusion> <artifactId>spring-security-config</artifactId> <groupId>org.springframework.security</groupId> </exclusion> <exclusion> <artifactId>spring-security-core</artifactId> <groupId>org.springframework.security</groupId> </exclusion> <exclusion> <artifactId>spring-security-crypto</artifactId> <groupId>org.springframework.security</groupId> </exclusion> <exclusion> <artifactId>spring-security-web</artifactId> <groupId>org.springframework.security</groupId> </exclusion> <exclusion> <artifactId>spring-webmvc</artifactId> <groupId>org.springframework</groupId> </exclusion> <exclusion> <artifactId>activation</artifactId> <groupId>javax.activation</groupId> </exclusion> <exclusion> <artifactId>commons-io</artifactId> <groupId>commons-io</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.xmlgraphics</groupId> <artifactId>xmlgraphics-commons</artifactId> <version>2.2</version> </dependency> </dependencies> <build> <!--<resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> --> <!-- take resource Package the files in --> <plugins> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.5</version> <executions> <execution> <id>copy-xmls</id> <phase>process-sources</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target/classes</outputDirectory> <resources> <resource> <directory>${basedir}/src/main/resource</directory> <includes> <include>**</include> </includes> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> </build> <repositories> <repository> <id>alfresco</id> <name>Activiti Releases</name> <url>https://artifacts.alfresco.com/nexus/content/repositories/activiti-releases/</url> <releases> <enabled>true</enabled> </releases> </repository> </repositories> </project>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
Explain the pom file above here.
Activiti engine is the core package of Acticiti.
Activiti modeler is a package of web page process designer, which uses version 5.22.0 here (as for why Activiti7 is not used, I think actiti7 does not have its own web page process designer at present. It is an integrated third-party designer, and there is no beauty of 5.22.0 in page design).
repositories introduces Acticiti's repository here, because Maven does not have 7.1.8. It only has 7-201802-EA version. During the use period, the 7-201802-EA version has a bug that everyone can get the process information as long as there is a process. Therefore, it is recommended to use version 7.1.8 here.
Activiti profile
package com.manong.smzypt.activiti.config; import javax.sql.DataSource; import org.activiti.engine.HistoryService; import org.activiti.engine.ProcessEngine; import org.activiti.engine.ProcessEngineConfiguration; import org.activiti.engine.RepositoryService; import org.activiti.engine.RuntimeService; import org.activiti.engine.TaskService; import org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * Using Java classes to complete the configuration file */ @Configuration public class ActivitiConfig { @Autowired private DataSource dataSource; /** * After initializing the configuration, 28 tables will be created * @return */ @Bean public StandaloneProcessEngineConfiguration processEngineConfiguration() { StandaloneProcessEngineConfiguration configuration = new StandaloneProcessEngineConfiguration(); configuration.setDataSource(dataSource); configuration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE); configuration.setAsyncExecutorActivate(false); return configuration; } @Bean public ProcessEngine processEngine() { return processEngineConfiguration().buildProcessEngine(); } @Bean public RepositoryService repositoryService() { return processEngine().getRepositoryService(); } @Bean public RuntimeService runtimeService() { return processEngine().getRuntimeService(); } @Bean public TaskService taskService() { return processEngine().getTaskService(); } @Bean public HistoryService historyService() throws Exception{ return processEngine().getHistoryService(); } }
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
Integrate 5.22.0 web process designer
There are a lot of integrated information on the Internet. Let's briefly mention it here.
Download the package of 5.22.0 from the Internet and drag the following contents in the package to the corresponding location of the project
Activiti7 combined with dynamic forms
In avitiviti 5 and 6, FormService, one of the core interfaces, can be used in combination with forms:
StartFormData startFormData = formService.getStartFormData(processDefinitionId); List<FormProperty> formProperties = startFormData.getFormProperties();
- 1
- 2
However, in actiti7, because there is no FormService interface, the following methods can be used instead:
UserTask userTask =(UserTask)repositoryService.getBpmnModel(task.getProcessDefinitionId()).getFlowElement(task.getTaskDefinitionKey()); List<FormProperty> formProperties = userTask.getFormProperties();
- 1
- 2
Conclusion
Activiti7 has many functions that are not mentioned. Interested friends can communicate together. We will continue to update the blog about workflow in the future,