1、Activiti 創建表


public class ActivitiTest
{
@Test
public void createTable()
{
ProcessEngineConfiguration configuration = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
configuration.setJdbcDriver("com.mysql.jdbc.Driver")
.setJdbcUrl("jdbc:mysql://localhost:3306/activiti?useUnicode=true&characterEncoding=utf8")
.setJdbcUsername("root")
.setJdbcPassword("654321a");

/**
* ProcessEngineConfiguration.DB_SCHEMA_UPDATE_CREATE_DROP 先刪除表在創建
* ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE 不能自動創建表,需要表存在
* ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE 如果沒有表自動創建,存在就直接使用
*/
configuration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);

ProcessEngine processEngine = configuration.buildProcessEngine();
System.out.println("processEngine:" + processEngine);
}

@Test
public void createTableByXml()
{
ProcessEngine processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml").buildProcessEngine();
System.out.println("processEngine:" + processEngine);
}

@Test
public void createTableByDefault()
{
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
System.out.println("processEngine:" + processEngine);
}
}


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<!-- <bean id="dbProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:db.properties</value>
<value>file:activiti-rest.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="ignoreResourceNotFound" value="true" />
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<property name="driverClass" value="${jdbc.driver}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>

<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>

<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManager" />
<property name="databaseSchemaUpdate" value="true" />
<property name="mailServerHost" value="localhost" />
<property name="mailServerPort" value="5025" />
<property name="jobExecutorActivate" value="false" />
<property name="customFormTypes">
<list>
<bean class="org.activiti.rest.form.UserFormType"/>
<bean class="org.activiti.rest.form.ProcessDefinitionFormType"/>
<bean class="org.activiti.rest.form.MonthFormType"/>
</list>
</property>
</bean>

<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
<property name="processEngineConfiguration" ref="processEngineConfiguration" />
</bean>
<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
<bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
<bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
<bean id="formService" factory-bean="processEngine" factory-method="getFormService" />
<bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
<bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />
<bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" /> -->

<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<property name="jdbcDriver" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/activiti?useUnicode=true&amp;characterEncodeing=utf8" />
<property name="jdbcUsername" value="root" />
<property name="jdbcPassword" value="654321a" />
<property name="databaseSchemaUpdate" value="true" />
</bean>
</beans>


建表情況
資源庫流程規則表
act_re_deployment 部署信息表
act_re_model 流程設計模型部署表
act_re_procdef 流程定義數據表
運行時數據庫表
act_ru_execution 運行時流程執行實例表
act_ru_identitylink 運行時流程人員表,主要存儲任務節點與參與者的相關信息
act_ru_task 運行時任務節點表
act_ru_variable 運行時流程變量數據表
歷史數據庫表
act_hi_actinst 歷史節點表
act_hi_attachment 歷史附件表
act_hi_comment 歷史意見表
act_hi_identitylink 歷史流程人員表
act_hi_detail 歷史詳情表,提供歷史變量的查詢
act_hi_procinst 歷史流程實例表
act_hi_taskinst 歷史任務實例表
act_hi_varinst 歷史變量表
組織機構表
act_id_group 用戶組信息表
act_id_info 用戶擴展信息表
act_id_membership 用戶與用戶組對應信息表
act_id_user 用戶信息表
這四張表很常見,基本的組織機構管理,關於用戶認證方面建議還是自己開發一套
通用數據表
act_ge_bytearray 二進制數據表
act_ge_property 屬性數據表存儲整個流程引擎級別的數據,初始化表結構時,會默認插入三條記錄
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章