In actual development, process definition is a very important part, and now I will bring you the deployment of process definition
1. First, we need to create an Activiti project
Second, join our activiti configuration file The specific code is as follows
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> <!-- ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration(); //Configuration to connect to the database processEngineConfiguration.setJdbcDriver("com.mysql.jdbc.Driver"); processEngineConfiguration.setJdbcUrl("jdbc:mysql://localhost:3306/itcast0711activiti?useUnicode=true&characterEncoding=utf8"); processEngineConfiguration.setJdbcUsername("root"); processEngineConfiguration.setJdbcPassword("root"); /** public static final String DB_SCHEMA_UPDATE_FALSE = "false"; The table cannot be created automatically, the table needs to exist public static final String DB_SCHEMA_UPDATE_CREATE_DROP = "create-drop"; first delete the table and then create the table public static final String DB_SCHEMA_UPDATE_TRUE = "true"; If the table does not exist, automatically create the table */ processEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE); --> <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration"> <!-- Configuration of connection data--> <property name="jdbcDriver" value="com.mysql.jdbc.Driver"></property> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/W_activiti_01?useUnicode=true&characterEncoding=utf8"></property> <property name="jdbcUsername" value="root"></property> <property name="jdbcPassword" value=""></property> <!-- No table create table--> <property name="databaseSchemaUpdate" value="true"></property> </bean> </beans>
3. We need to add the dependency code of our project in the pom.xml file of our project as follows:
<!-- https://mvnrepository.com/artifact/org.activiti/activiti-engine --> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-engine</artifactId> <version>6.0.0</version> </dependency>
Fourth, configure our activiti in log4j.properties , the code is as follows:
log4j.rootLogger = INFO, CA # ConsoleAppender log4j.appender.CA=org.apache.log4j.ConsoleAppender log4j.appender.CA.layout=org.apache.log4j.PatternLayout log4j.appender.CA.layout.ConversionPattern= %d{hh:mm:ss,SSS} [%t] %-5p %c %x - %m%n
5. Configure activiti in our web.xml file
<context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:activiti.cfg.xml</param-value> </context-param>
In this way, our activiti is configured, and we can create our own
Finally, I will send you a query statement of the activiti database:
########################## 1: Tables related to deployment objects and process definitions ############## ############## SELECT * FROM act_re_deployment #Deployment object table SELECT * FROM act_re_procdef #Process definition table SELECT * FROM act_ge_bytearray #Resource file table SELECT * FROM act_ge_property #Primary key generation strategy table ########################### 2: Process instance, execution object, task ############## ############# SELECT * FROM act_ru_execution #Execution object table being executed SELECT * FROM act_hi_procinst #History table of process instances SELECT * FROM act_ru_task #Executing task table (only when the node is UserTask, there is data in this table.) SELECT * FROM act_hi_taskinst #Task history table (only when the node is UserTask, there is data in this table.) SELECT * FROM act_hi_actinst #History table of all active nodes ############################ 3: Process Variables #################### ######## SELECT * FROM act_ru_variable # Executing process variable table SELECT * FROM act_hi_varinst # historical process variable table ############################# 4: Individual users, group tasks################ ########### SELECT * FROM act_ru_identitylink # Task handler table SELECT * FROM act_hi_identitylink # Historical task handler table ########################### 5: ########################### SELECT * FROM act_id_group # role table SELECT * FROM act_id_user # user table SELECT * FROM act_id_membership # user role table