创建Mysql

创建 mysql 数据库 activiti(名字任意):
CREATE DATABASE activiti DEFAULT CHARACTER SET utf8;

pom.xml

  1. <properties>
  2. <slf4j.version>1.6.6</slf4j.version>
  3. <log4j.version>1.2.12</log4j.version>
  4. </properties>
  5.  
  6. <dependencies>
  7.  
  8. <dependency>
  9. <groupId>org.activiti</groupId>
  10. <artifactId>activiti-engine</artifactId>
  11. <version>7.0.0.Beta1</version>
  12. </dependency>
  13.  
  14. <dependency>
  15. <groupId>org.activiti</groupId>
  16. <artifactId>activiti-spring</artifactId>
  17. <version>7.0.0.Beta1</version>
  18. </dependency>
  19.  
  20. <dependency>
  21. <groupId>org.activiti</groupId>
  22. <artifactId>activiti-bpmn-model</artifactId>
  23. <version>7.0.0.Beta1</version>
  24. </dependency>
  25.  
  26. <dependency>
  27. <groupId>org.activiti</groupId>
  28. <artifactId>activiti-bpmn-converter</artifactId>
  29. <version>7.0.0.Beta1</version>
  30. </dependency>
  31.  
  32. <dependency>
  33. <groupId>org.activiti</groupId>
  34. <artifactId>activiti-json-converter</artifactId>
  35. <version>7.0.0.Beta1</version>
  36. </dependency>
  37.  
  38. <dependency>
  39. <groupId>org.activiti</groupId>
  40. <artifactId>activiti-bpmn-layout</artifactId>
  41. <version>7.0.0.Beta1</version>
  42. </dependency>
  43.  
  44. <dependency>
  45. <groupId>org.activiti.cloud</groupId>
  46. <artifactId>activiti-cloud-services-api</artifactId>
  47. <version>7.0.0.Beta1</version>
  48. </dependency>
  49.  
  50. <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
  51. <dependency>
  52. <groupId>mysql</groupId>
  53. <artifactId>mysql-connector-java</artifactId>
  54. <version>8.0.15</version>
  55. </dependency>
  56.  
  57. <dependency>
  58. <groupId>junit</groupId>
  59. <artifactId>junit</artifactId>
  60. <version>4.12</version>
  61. </dependency>
  62.  
  63. <!-- log start -->
  64. <dependency>
  65. <groupId>log4j</groupId>
  66. <artifactId>log4j</artifactId>
  67. <version>${log4j.version}</version>
  68. </dependency>
  69. <dependency>
  70. <groupId>org.slf4j</groupId>
  71. <artifactId>slf4j-api</artifactId>
  72. <version>${slf4j.version}</version>
  73. </dependency>
  74. <dependency>
  75. <groupId>org.slf4j</groupId>
  76. <artifactId>slf4j-log4j12</artifactId>
  77. <version>${slf4j.version}</version>
  78. </dependency>
  79. <!-- log end -->
  80.  
  81. <dependency>
  82. <groupId>org.mybatis</groupId>
  83. <artifactId>mybatis</artifactId>
  84. <version>3.4.5</version>
  85. </dependency>
  86.  
  87. <dependency>
  88. <groupId>commons-dbcp</groupId>
  89. <artifactId>commons-dbcp</artifactId>
  90. <version>1.4</version>
  91. </dependency>
  92.  
  93. </dependencies>
  94.  
  95. <repositories>
  96. <repository>
  97. <id>alfresco</id>
  98. <name>Activiti Releases</name>
  99. <url>https://artifacts.alfresco.com/nexus/content/repositories/activiti-releases/</url>
  100. <releases>
  101. <enabled>true</enabled>
  102. </releases>
  103. </repository>
  104. </repositories>

log4j.properties

  1. # Set root category priority to INFO and its only appender to CONSOLE.
  2. #log4j.rootCategory=INFO, CONSOLE debug info warn error fatal
  3. log4j.rootCategory=debug, CONSOLE, LOGFILE
  4.  
  5. # Set the enterprise logger category to FATAL and its only appender to CONSOLE.
  6. log4j.logger.org.apache.axis.enterprise=FATAL, CONSOLE
  7.  
  8. # CONSOLE is set to be a ConsoleAppender using a PatternLayout.
  9. log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
  10. log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
  11. log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} %-6r [%15.15t] %-5p %30.30c %x - %m\n
  12.  
  13. # LOGFILE is set to be a File appender using a PatternLayout.
  14. log4j.appender.LOGFILE=org.apache.log4j.FileAppender
  15. log4j.appender.LOGFILE.File=d:\axis.log
  16. log4j.appender.LOGFILE.Append=true
  17. log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
  18. log4j.appender.LOGFILE.layout.ConversionPattern=%d{ISO8601} %-6r [%15.15t] %-5p %30.30c %x - %m\n

activiti.cfg.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xmlns:tx="http://www.springframework.org/schema/tx"
  6. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  7. http://www.springframework.org/schema/contex http://www.springframework.org/schema/context/spring-context.xsd
  8. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
  9.  
  10. <!--数据源配置dbcp-->
  11. <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
  12. <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  13. <property name="url" value="jdbc:mysql://localhost:3306/activiti?serverTimezone=UTC" />
  14. <property name="username" value="root" />
  15. <property name="password" value="123456" />
  16. </bean>
  17. <!--activiti单独运行的ProcessEngine配置对象(processEngineConfiguration),使用单独启动方式
  18. 默认情况下:bean的id=processEngineConfiguration
  19. -->
  20.  
  21. <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
  22. <!--代表数据源-->
  23. <property name="dataSource" ref="dataSource"></property>
  24. <!-- <property name="jdbcDriver" value="com.mysql.jdbc.Driver" />
  25. <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/activiti" />
  26. <property name="jdbcUsername" value="root" />
  27. <property name="jdbcPassword" value="root" />-->
  28. <!--代表是否生成表结构-->
  29. <property name="databaseSchemaUpdate" value="true"/>
  30. </bean>
  31. </beans>

关于 processEngineConfiguration 中的 databaseSchemaUpdate 参数, 通过此参数设计 activiti
数据表的处理策略,参数如下:
false(默认):检查数据库表的版本和依赖库的版本, 如果版本不匹配就抛出异常。
true: 构建流程引擎时,执行检查,如果需要就执行更新。 如果表不存在,就创建。
create-drop: 构建流程引擎时创建数据库表, 关闭流程引擎时删除这些表。
drop-create:先删除表再创建表。
create: 构建流程引擎时创建数据库表, 关闭流程引擎时不删除这些表。

注意:在 activiti.cfg.xml 配置文件中的 dataSource processEngineConfiguration 也可以使用一次
性配置出来。

  1. <bean
  2. id="processEngineConfiguration"
  3. class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
  4. <property name="jdbcDriver" value="com.mysql.jdbc.Driver"/>
  5. <property name="jdbcUrl"
  6. value="jdbc:mysql://localhost:3306/itcast0711activiti"/>
  7. <property name="jdbcUsername" value="root"/>
  8. <property name="jdbcPassword" value="root"/>
  9. <property name="databaseSchemaUpdate" value="true"/>
  10. </bean>

测试类

  1. /**
  2. * 测试类
  3. * 作用:测试activiti所需要的25张表的生成
  4. */
  5. public class ActivitiTest {
  6.  
  7. // @Test
  8. // public void testGenTable(){
  9. // //条件:1.activiti配置文件名称:activiti.cfg.xml 2.bean的id="processEngineConfiguration"
  10. // ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
  11. // System.out.println(processEngine);
  12. //
  13. // // HistoryService historyService = processEngine.getHistoryService();
  14. //
  15. // }
  16.  
  17. @Test
  18. public void testGenTable(){
  19. //1.创建ProcessEngineConfiguration对象 第一个参数:配置文件名称 第二个参数是processEngineConfiguration的bean的id
  20. ProcessEngineConfiguration configuration = ProcessEngineConfiguration
  21. .createProcessEngineConfigurationFromResource("activiti.cfg.xml");
  22. //2.创建ProcesEngine对象
  23. ProcessEngine processEngine = configuration.buildProcessEngine();
  24.  
  25. //3.输出processEngine对象
  26. System.out.println(processEngine);
  27.  
  28. }
  29. }

说明:
1、运行以上程序段即可完成 activiti 数据库创建,通过改变 activiti.cfg.xml 中
databaseSchemaUpdate 参数的值执行不同的数据表处理策略。
2 、 上 边 的 方法 createProcessEngineConfigurationFromResource 在执行时在
activiti.cfg.xml 中找固定的名称 processEngineConfiguration
也可以使用重载方法调用,这时可以不用限定 processEngineConfiguration 名称

 Activiti 的表都以 ACT_开头。 第二部分是表示表的用途的两个字母标识。 用途也和服务的 API 对

 ACT_RE_*: 'RE'表示 repository。 这个前缀的表包含了流程定义和流程静态资源 (图片,
规则,等等)。
 ACT_RU_*: 'RU'表示 runtime。 这些运行时的表,包含流程实例,任务,变量,异步任务,
等运行中的数据。 Activiti 只在流程实例执行过程中保存这些数据, 在流程结束时就会删
除这些记录。 这样运行时表可以一直很小速度很快。
 ACT_HI_*: 'HI'表示 history。 这些表包含历史数据,比如历史流程实例, 变量,任务等
等。
 ACT_GE_*: GE 表示 general。 通用数据, 用于不同场景下。

Activiti创建表(三)的更多相关文章

  1. activiti自定义流程之整合(二):使用angular js整合ueditor创建表单

    注:整体环境搭建:activiti自定义流程之整合(一):整体环境配置 基础环境搭建完毕,接下来就该正式着手代码编写了,在说代码之前,我觉得有必要先说明一下activit自定义流程的操作. 抛开自定义 ...

  2. activiti自定义流程之自定义表单(二):创建表单

    注:环境配置:activiti自定义流程之自定义表单(一):环境配置 在上一节自定义表单环境搭建好以后,我就正式开始尝试自己创建表单,在后台的处理就比较常规,主要是针对ueditor插件的功能在前端进 ...

  3. PHP连接数据库、创建数据库、创建表的三种方式

    这篇博客主要介绍了三种方式来连接MySQL数据库以及创建数据库.创建表.(代码是我在原来的基础上改的) MySQLi - 面向对象 MySQLi - 面向过程 PDO MySQLi 面向对象 < ...

  4. 第三百零六节,Django框架,models.py模块,数据库操作——创建表、数据类型、索引、admin后台,补充Django目录说明以及全局配置文件配置

    Django框架,models.py模块,数据库操作——创建表.数据类型.索引.admin后台,补充Django目录说明以及全局配置文件配置 数据库配置 django默认支持sqlite,mysql, ...

  5. Activiti 配置Oracle不能自动创建表解决方法

    使用配置文件创建工作流表 <bean id="processEngineConfiguration" class="org.activiti.engine.impl ...

  6. activiti自己定义流程之整合(二):使用angular js整合ueditor创建表单

    基础环境搭建完成,接下来就该正式着手代码编写了,在说代码之前.我认为有必要先说明一下activit自己定义流程的操作. 抛开自己定义的表单不谈.通过之前的了解,我们知道一个新的流程開始.是在启动流程实 ...

  7. 2019年6月14日 Web框架之Django_07 进阶操作(MTV与MVC、多对多表三种创建方式、前后端传输数据编码格式contentType、ajax、自定义分页器)

    摘要 MTV与MVC 多对多表三种创建方式 ajax ,前后端传输数据编码格式contentType 批量插入数据和自定义分页器 一.MVC与MTV MVC(Model View Controller ...

  8. activiti自己定义流程之自己定义表单(二):创建表单

    注:环境配置:activiti自己定义流程之自己定义表单(一):环境配置 在上一节自己定义表单环境搭建好以后,我就正式開始尝试自己创建表单,在后台的处理就比較常规,主要是针对ueditor插件的功能在 ...

  9. Django之modles 多对多创建第三张表

    一.第一种:纯自动创建第三张表 纯自动 class Book(models.Model): title = models.CharField(max_length=32) price = models ...

随机推荐

  1. [ScreenOS] How to change the certificate that is used for SSL (HTTPS) WebUI Management

    SUMMARY: This article provides information on how to change the certificate that is used for SSL (HT ...

  2. Chapter03 第二节 const限定符的使用

    3.2 const限定符 const的作用:替代#define作为有类型检查的常量来使用.他的值被初始化后就固定了,成为一个只读变量,不能更改.(推荐使用特殊的命名规范来区分常量和非常量). cons ...

  3. disabled_button 按钮按不下去

    X老师今天上课讲了前端知识,然后给了大家一个不能按的按钮,小宁惊奇地发现这个按钮按不下去,到底怎么才能按下去 检查元素 删除 按钮就可以摁了 出现答案

  4. MySQL-快速入门(10)触发器

    1.什么是触发器 触发器是与表有关的命名数据库对象.触发器由事件来触发某个操作. 触发器是特殊的存储过程,触发器不需要call语句来调用,也不需要手工启动,只需要确定一个预定义的事件发生的时候,就会被 ...

  5. 2016青岛区域赛.Coding Contest(费用流 + 概率计算转换为加法计算)

    Coding Contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)To ...

  6. 【JZOJ 3910】Idiot 的间谍网络

    题面: Description 作为一名高级特工,Idiot 苦心经营多年,终于在敌国建立起一张共有n 名特工的庞大间谍网络. 当然,出于保密性的要求,间谍网络中的每名特工最多只会有一名直接领导.现在 ...

  7. SSM框架中数据库无法连接的问题

    首先是SSM框架中所有的配置都是没有问题的,而且项目在其他人的环境上也能正常访问数据库:那么最有可能的就是数据库版本的问题导致数据库连接不上,服务器给我的报错是: 15:37:25.902 [C3P0 ...

  8. Print out Android kernel log

    adb shell "su -c 'cat /proc/kmsg'" | tee kernel.log adb shell cat /proc/last_kmsg > las ...

  9. 【C#】获取"我的电脑"的名字,如This PC、这台计算机

    原文:[C#]获取"我的电脑"的名字,如This PC.这台计算机 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接: ...

  10. 7.css3表格、列表、边框的样式设置--list/border

    1.css表格: ①Border-collapse是否把表格边框合并为单一的边框.Separate默认值,collapse合并. ②Border-spacing分割单元格边框的距离. ③Caption ...