Activiti流程定义部署

        实际开发中,流程定义是非常重要的一部分,现在我给大家带来流程定义的部署

一、首先,我们需要创建一个Activiti项目

二、加入我们的activiti配置文件具体代码如下

<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();
		//连接数据库的配置
		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";不能自动创建表,需要表存在
  			public static final String DB_SCHEMA_UPDATE_CREATE_DROP = "create-drop";先删除表再创建表
  			public static final String DB_SCHEMA_UPDATE_TRUE = "true";如果表不存在,自动创建表
		 */
		processEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
	 -->
	<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
		<!-- 连接数据的配置 -->
		<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>

		<!-- 没有表创建表 -->
		<property name="databaseSchemaUpdate" value="true"></property>
	</bean>

</beans>


三、我们需要在我们项目的pom.xml文件中,加入我们项目的依赖代码如下:

	<!-- https://mvnrepository.com/artifact/org.activiti/activiti-engine -->
	<dependency>
		<groupId>org.activiti</groupId>
		<artifactId>activiti-engine</artifactId>
		<version>6.0.0</version>
	</dependency>

四、在log4j.properties里配置我们的activiti,代码如下:

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

五、在我们的web.xml文件中配置activiti

	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>classpath:activiti.cfg.xml</param-value>
	</context-param>


这样,我们的activiti就配置好了,我们就可以创建自己的



最后,给大家送上一个activiti数据库的查询语句:


########################### 1:部署对象和流程定义相关的表 ###########################
SELECT * FROM act_re_deployment #部署对象表

SELECT * FROM act_re_procdef #流程定义表

SELECT * FROM act_ge_bytearray #资源文件表

SELECT * FROM act_ge_property #主键生成策略表

########################### 2:流程实例,执行对象,任务 ###########################
SELECT * FROM act_ru_execution #正在执行的执行对象表

SELECT * FROM act_hi_procinst #流程实例的历史表

SELECT * FROM act_ru_task #正在执行的任务表(只有节点是UserTask的时候,该表中存在数据。)

SELECT * FROM act_hi_taskinst #任务历史表(只有节点是UserTask的时候,该表中存在数据。)

SELECT * FROM act_hi_actinst #所有活动节点的历史表

########################### 3:流程变量 ###########################
SELECT * FROM act_ru_variable # 正在执行的流程变量表

SELECT * FROM act_hi_varinst # 历史的流程变量表

########################### 4:个人用户、组任务 ###########################
SELECT * FROM act_ru_identitylink # 任务办理人表

SELECT * FROM act_hi_identitylink # 历史任务办理人表

########################### 5: ###########################
SELECT * FROM act_id_group # 角色表

SELECT * FROM act_id_user # 用户表

SELECT * FROM act_id_membership # 用户角色表




猜你喜欢

转载自blog.csdn.net/qq_36556137/article/details/78015929