1.activities工作流入门
(1).建表(使用配置文件)
①.下载官方activities文件,从war文件夹下解压test的war包文件,取得jar包。
②.导入mysql驱动(Oracle数据库导入Oracle驱动)
③.创建一个Java项目,导入jar包。
④.导入junit测试jar包。
⑤.创建数据库activiti
⑥.从demo中复制activiti-context.xml文件,编写xml文件。
<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">
<!-- 配置流程引擎配置对象 -->
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<property name="jdbcDriver" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl" value="jdbc:mysql:///activiti" />
<property name="jdbcUsername" value="root" />
<property name="jdbcPassword" value="root" />
<property name="databaseSchemaUpdate" value="true" />
</bean>
</beans>
⑦.创建一个Java工程,创建一个Java类,编写建表代码。
/**
* 使用框架提供的自动建表(提供配置文件)---可以从框架提供的例子程序中获取
*/
@Test
public void createActivitiTable() {
String resource = "activiti-context.xml";// 配置文件名称
String beanName = "processEngineConfiguration";// 配置id值
ProcessEngineConfiguration conf = ProcessEngineConfiguration
.createProcessEngineConfigurationFromResource(resource, beanName);
ProcessEngine processEngine = conf.buildProcessEngine();
}
⑧.执行单元测试,生成工作流的23张表。