activities工作流入門筆記-002-建表

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張表。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章