diff --git a/.gitignore b/.gitignore
index b9d582687a..919e777b76 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,7 @@
.ant_targets
.DS_Store
.bpmn
+*.iml
+.idea
+rebel.xml
+.settings
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index d63fd2c173..05a738858c 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -6,7 +6,6 @@
-
diff --git a/README.md b/README.md
index e683d29e74..9d35679a34 100644
--- a/README.md
+++ b/README.md
@@ -2,19 +2,30 @@
本项目旨在让初学者快速入门Activiti。
-**作者**:[咖啡兔|http://www.kafeitu.me]
+**作者**:[咖啡兔](http://www.kafeitu.me)
**项目主页**:[http://www.kafeitu.me/activiti/2012/05/26/kft-activiti-demo.html](http://www.kafeitu.me/activiti/2012/05/26/kft-activiti-demo.html)
-**在线演示(亚马逊EC2)**:[http://aws.kafeitu.me:8080/kft-activiti-demo](http://aws.kafeitu.me:8080/kft-activiti-demo)
+**在线演示**:[http://demo.kafeitu.me:8080/kft-activiti-demo](http://demo.kafeitu.me:8080/kft-activiti-demo)
-# 框架版本
+**Wiki文档**: [https://github.com/henryyan/kft-activiti-demo/wiki](https://github.com/henryyan/kft-activiti-demo/wiki)
+
+**QQ群在线支持:**: 236540304
+
+**《Activiti实战》**:Activiti项目Team Leader **Tijs Rademakers**认可并推荐,详情访问 [http://www.kafeitu.me/activiti-in-action.html](http://www.kafeitu.me/activiti-in-action.html)
-* Activiti: **5.11**
+----
+![](https://raw.githubusercontent.com/henryyan/kft-activiti-demo/master/src/main/webapp/images/activiti-in-action.jpg)
+
+----
+去 China-Pub| 京东| 当当网| 亚马逊 购买
+----
+
+# 框架版本
-* Spring: **3.1.1.RELEASE**
+* Activiti: **5.19.0**
-* Hibernate: **4.1.4.Final**
+* Spring: **4.1.5.RELEASE**
# 分支选择
@@ -23,6 +34,14 @@ Demo提供Maven版本和no-maven版本,分别适用于会用mavne和不会用m
* **maven**分支:对应与git的`master`分支,便于安装和数据库初始化
* **no-maven**分支:直接是一个eclipse工程,包含eclipse的项目配置文件和WEB-INF/lib下面的所有的jar文件
+## Maven方式运行
+
+> mvn clean jetty:run
+
+在 **pom.xml** 中配置了 **h2** 数据库与 **mysql** 数据库,默认启用 **h2** 数据库配置方式,如果使用 **mysql** 请启用mysql的配置(使用下面的命令)。
+
+> mvn clean jetty:run -Pmysql
+
# 演示说明文档
* [配置说明](https://github.com/henryyan/kft-activiti-demo/wiki/%E9%85%8D%E7%BD%AE%E8%AF%B4%E6%98%8E)
@@ -32,8 +51,56 @@ Demo提供Maven版本和no-maven版本,分别适用于会用mavne和不会用m
## Changelog
+### 1.14.0(2015-11-26)
+1. 添加查看引擎参数功能
+2. 添加查看引擎数据库功能
+3. 添加管理用户与组功能
+4. 添加作业管理功能
+5. 5.17+方式嵌入Rest服务
+
+### 1.13.0(2015-11-23)
+1. 集成基于5.17+的流程设计器(Activiti Modeler,很漂亮),demo依赖的版本支持5.17以上
+2. 数据库配置属性转移到pom.xml里面,可以直接修改`pom.xml`文件的参数,也可以在运行时通过`-Djdbc.password=111111`参数覆盖
+
+### 1.11~1.12(unknown)
+1. 内部消耗掉了,不要问我...
+
+### 1.10.1(2014-04-23)
+1. 修复在最新版本Chrome(V34)不能运行Activiti Modeler问题
+
+### 1.10.0(2014-04-18)
+1. 集成了diagram-viewer,目前提供了三种流程跟踪方式
+2. 添加了针对JPA的演示
+3. 添加了全局监听的演示
+4. 使用5.15.1-kft版本(修复了5.15版本中查询待办任务<包含指定到人、候选人、候选组>方法的Bug)
+
+### 1.9.0(2014-01-01)
+1. 升级Activiti到5.14
+2. 同时支持纯Rest接口和Activiti Modeler的Rest路径映射
+
+### 1.8.0(2013-06-22)
+1. 升级Activiti至5.13
+2. 移除了全局监听器(以后的版本会再加入)
+
+### 1.7.2(2013-04-17)
+1. 升级Activiti至5.12.1-kft版本
+2. 添加全局监听器演示
+
+### 1.7.1(2013-04-10)
+1. 解决流程引擎自动生成的图片跟踪坐标错乱问题
+2. 使用重新打包的5.12.1,解决JDK6部署时报错问题
+3. 解决跟踪流程图时(调用引擎的图片生成工具)中文乱码
+
+### 1.7.0(2013-03-10)
+1. 添加分页查询演示
+2. 添加流程定义对象(ProcessDefinition)缓存演示, see: [Tweaking the process definition cache in Activiti 5.12](http://www.jorambarrez.be/blog/2012/12/20/tweaking-process-definition-cache/)
+3. 添加activityFontName属性配置,可以解决流程图中包含中文导致生成的流程图乱码问题
+4. 整合Activiti Modeler,可以在线设计流程
+
+> 特别说明:5.12.1不是官方提供,是我自己打包的一个版本(支持Native Query分页查询功能,5.13将会直接提供此功能)
+
### 1.6.0(2013-01-06)
-1. 添加多实例(发文会签)演示
+1. 添加多实例(发文)演示
2. 添加自动部署流程定义演示
### 1.5.0 (2012-12-16)
@@ -60,3 +127,32 @@ Demo提供Maven版本和no-maven版本,分别适用于会用mavne和不会用m
1.表单名称重构,portlet添加关于作者和表单概念模块
2.首页用jquery.portlet插件显示信息,并添加一个待办任务列表的portlet
+
+2. c50ec09 添加流程实例状态控制功能
+3. 9a97cda formkey查询任务时使用native query
+4. 3e8ab24 清理垃圾
+5. 9035e56 动态表单和外置表单的运行中列表显示的当前节点的英文名称,并在查询流程数据时区分动态、外置表单
+6. 7f955c4 重写JuelFormEngine,解决windows平台读取表单内容乱码问题
+7. d72778b 升级portlet插件为1.1.1
+8. 5e4007c 升级初始化sql的activiti版本为5.11
+9. 684c8a0 解决jsp文件中出现两个head问题
+10. 3bcbd56 菜单的传统改为普通,外部改为外置
+11. 645347c 移除不需要的依赖版本号
+
+### 1.4.1 (2012-12-01)
+
+1.升级jquery.portlet.js解决把一列的portlet拖走后不能再拖回问题
+
+2.升级:jquery -> 1.83,jquery ui -> 1.9.2, jquery.layout -> 1.3,html头部声明用html标准代替xhtml
+
+### 1.4 (2012-11-27)
+
+1.表单名称重构,portlet添加关于作者和表单概念模块
+
+2.首页用jquery.portlet插件显示信息,并添加一个待办任务列表的portlet
+
+### 中间的版本没记录就忽略了。。。
+
+### 1.0.0(2011-10-23)鼻祖
+
+1. 第一个原始版本,当时应该只有流程部署和流程启动。。。
diff --git a/bin/merge-to-no-maven.sh b/bin/merge-to-no-maven.sh
index 85ea7ebe3b..77474c380e 100755
--- a/bin/merge-to-no-maven.sh
+++ b/bin/merge-to-no-maven.sh
@@ -2,7 +2,7 @@
NO_MAVEN_DIR="../kft-activiti-demo-no-maven"
echo "delete all files of branch no-maven"
-echo "delete libs"
+#echo "delete libs"
rm $NO_MAVEN_DIR/WebContent/WEB-INF/lib/*
echo "delete java"
@@ -17,11 +17,19 @@ rm -rf $NO_MAVEN_DIR/WebContent/common
rm -rf $NO_MAVEN_DIR/WebContent/css
rm -rf $NO_MAVEN_DIR/WebContent/images
rm -rf $NO_MAVEN_DIR/WebContent/js
+rm -rf $NO_MAVEN_DIR/WebContent/api
+rm -rf $NO_MAVEN_DIR/WebContent/editor
+rm -rf $NO_MAVEN_DIR/WebContent/explorer
+rm -rf $NO_MAVEN_DIR/WebContent/libs
rm -rf $NO_MAVEN_DIR/WebContent/WEB-INF/views
echo "copying libs to no-maven"
-mvn dependency:copy-dependencies
-cp ./target/dependency/* $NO_MAVEN_DIR/WebContent/WEB-INF/lib/
+mvn package -Dmaven.test.skip=true
+cp ./target/kft-activiti-demo/WEB-INF/lib/* $NO_MAVEN_DIR/WebContent/WEB-INF/lib/
+cd $NO_MAVEN_DIR
+git checkout -- WebContent/WEB-INF/lib/junit-4.10.jar
+git checkout -- WebContent/WEB-INF/lib/servlet-api-2.5.jar
+cd -
echo "copying java"
cp -r src/main/java/* $NO_MAVEN_DIR/src
@@ -30,11 +38,21 @@ cp -r src/test/java/* $NO_MAVEN_DIR/test
echo "copying java resources"
cp -r src/main/resources/* $NO_MAVEN_DIR/resources
cp target/classes/application.properties $NO_MAVEN_DIR/resources
+cd $NO_MAVEN_DIR
+git checkout -- resources/activiti.cfg.xml
+git checkout -- resources/application.test.properties
+git checkout -- resources/applicationContext-test.xml
+git checkout -- resources/data/sample-data.xml
+cd -
echo "copying web resources"
cp -r src/main/webapp/common $NO_MAVEN_DIR/WebContent/common
cp -r src/main/webapp/css $NO_MAVEN_DIR/WebContent/css
cp -r src/main/webapp/images $NO_MAVEN_DIR/WebContent/images
cp -r src/main/webapp/js $NO_MAVEN_DIR/WebContent/js
+cp -r src/main/webapp/api $NO_MAVEN_DIR/WebContent/api
+cp -r src/main/webapp/editor $NO_MAVEN_DIR/WebContent/editor
+cp -r src/main/webapp/explorer $NO_MAVEN_DIR/WebContent/explorer
+cp -r src/main/webapp/libs $NO_MAVEN_DIR/WebContent/libs
cp -r src/main/webapp/WEB-INF/views $NO_MAVEN_DIR/WebContent/WEB-INF/views
cp src/main/webapp/WEB-INF/*.xml $NO_MAVEN_DIR/WebContent/WEB-INF
diff --git a/build.xml b/build.xml
deleted file mode 100644
index ba192088e2..0000000000
--- a/build.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Activiti演示程序,请输入命令后操作!
-
-
-
-
- 打包流程定义:请假(自定义表单)
-
-
-
-
-
-
-
- 打包流程定义:请假(动态表单)
-
-
-
-
-
-
-
- 打包流程定义:请假(外置表单)
-
-
-
-
-
-
-
- 打包流程定义:发文会签
-
-
-
-
-
-
-
-
-
diff --git a/pom.xml b/pom.xml
index 122ac3c4a8..55ba9847fa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,591 +1,589 @@
- 4.0.0
- me.kafeitu.demo
- kft-activiti-demo
- 1.6.0
- war
- Activiti demo
- activiti demo for version 5.11
-
-
-
- henryyan
- Henry Yan
- yanhonglei@gmail.com
- http://www.kafeitu.me
- 8
-
-
-
-
-
- 1.6
- 3.1.2.RELEASE
- 4.1.4.Final
- 1.1.0.RELEASE
- 1.4
- 2.5.2
- 2.0.4
- 2.8.1
- 12.0
- 3.1
- 2.4
- 2.1
- 1.6.6
- 1.2.17
- 7.6.4.v20120524
- 1.3.167
- 4.10
- 1.9.0
- 1.4.12
- 5.11
-
-
- com.h2database
- h2
- 1.3.166
-
-
-
- UTF-8
-
-
-
-
- Activiti
- https://maven.alfresco.com/nexus/content/groups/public
-
-
- Codehaus
- http://repository.codehaus.org
-
-
-
-
-
-
-
- org.activiti
- activiti-engine
- ${activiti.version}
-
-
- org.activiti
- activiti-spring
- ${activiti.version}
-
-
-
-
-
- org.codehaus.jackson
- jackson-mapper-asl
- 1.9.7
-
-
-
-
- commons-io
- commons-io
- ${commons-io.version}
-
-
- commons-fileupload
- commons-fileupload
- 1.2.2
-
-
-
-
-
- org.springframework
- spring-core
- ${spring.version}
-
-
- commons-logging
- commons-logging
-
-
-
-
- org.springframework
- spring-beans
- ${spring.version}
-
-
- org.springframework
- spring-context
- ${spring.version}
-
-
- org.springframework
- spring-context-support
- ${spring.version}
-
-
- org.springframework
- spring-aop
- ${spring.version}
-
-
- org.aspectj
- aspectjrt
- 1.6.9
-
-
- org.aspectj
- aspectjweaver
- 1.6.9
-
-
- cglib
- cglib
- 2.2.2
-
-
- asm
- asm
- 3.3.1
-
-
-
-
-
-
- org.hibernate
- hibernate-core
- ${hibernate.version}
-
-
- org.hibernate
- hibernate-entitymanager
- ${hibernate.version}
-
-
- org.hibernate
- hibernate-ehcache
- ${hibernate.version}
-
-
- org.hibernate.javax.persistence
- hibernate-jpa-2.0-api
- 1.0.1.Final
-
-
-
-
- org.springframework.data
- spring-data-jpa
- ${spring-data-jpa.version}
-
-
- junit
- junit-dep
-
-
-
-
- org.springframework
- spring-orm
- ${spring.version}
-
-
- org.springframework
- spring-jdbc
- ${spring.version}
-
-
-
-
- commons-dbcp
- commons-dbcp
- ${commons-dbcp.version}
-
-
-
-
- ${jdbc.driver.groupId}
- ${jdbc.driver.artifactId}
- ${jdbc.driver.version}
- runtime
-
-
-
-
-
- org.springframework
- spring-webmvc
- ${spring.version}
-
-
-
- javax.servlet
- jstl
- 1.2
-
-
-
- javax.servlet
- servlet-api
- 2.5
- provided
-
-
-
-
-
- net.sf.ehcache
- ehcache-core
- ${ehcache.version}
-
-
-
-
- org.slf4j
- slf4j-api
- ${slf4j.version}
-
-
- org.slf4j
- slf4j-log4j12
- ${slf4j.version}
-
-
- org.slf4j
- jcl-over-slf4j
- ${slf4j.version}
-
-
- log4j
- log4j
- ${log4j.version}
-
-
-
-
-
- org.apache.commons
- commons-lang3
- ${commons-lang3.version}
-
-
- commons-beanutils
- commons-beanutils
- 1.8.3
-
-
- commons-logging
- commons-logging
-
-
-
-
-
- com.google.guava
- guava
- ${guava.version}
-
-
- org.jodd
- jodd
- 3.3.2
-
-
- joda-time
- joda-time
- ${joda-time.version}
-
-
-
-
-
- junit
- junit
- ${junit.version}
- test
-
-
-
- org.mockito
- mockito-core
- ${mockito.version}
- test
-
-
-
- org.powermock
- powermock-module-junit4
- ${powermock.version}
- test
-
-
- org.powermock
- powermock-api-mockito
- ${powermock.version}
- test
-
-
- org.mockito
- mockito-all
-
-
-
-
-
- org.springframework
- spring-test
- ${spring.version}
-
-
-
- com.h2database
- h2
- ${h2.version}
-
-
-
- org.dbunit
- dbunit
- 2.4.8
-
-
-
-
- org.eclipse.jetty.aggregate
- jetty-webapp
- ${jetty.version}
- test
-
-
- org.eclipse.jetty
- jetty-jsp
- ${jetty.version}
- test
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 2.5
-
-
- ${jdk.version}
- true
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 2.12
-
- -Xmx256M
-
-
-
-
-
- org.codehaus.mojo
- cobertura-maven-plugin
- 2.5.1
-
-
-
- **/entity/**/*.class
- **/*Controller.class
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-eclipse-plugin
- 2.9
-
- 2.0
-
- org.springframework.ide.eclipse.core.springnature
-
-
-
-
-
-
- org.mortbay.jetty
- jetty-maven-plugin
- ${jetty.version}
-
-
-
- spring.profiles.active
- development
-
-
- true
-
-
- /${project.artifactId}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-resources-plugin
- 2.5
-
-
-
- zip
- bar
- png
- activiti
- bpmn
-
- ${project.build.sourceEncoding}
-
-
-
-
-
-
-
-
- kft-activiti-demo
-
- true
-
-
-
-
- src/main/resources
- true
-
-
-
-
-
-
-
- initdatas
-
-
-
- org.apache.maven.plugins
- maven-antrun-plugin
- 1.7
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- refresh-db
-
-
-
- org.apache.maven.plugins
- maven-antrun-plugin
- 1.7
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
+ me.kafeitu.demo
+ kft-activiti-demo
+ 1.15.0-SNAPSHOT
+ war
+ Activiti demo
+ activiti demo for version 5.17+
+
+
+
+ henryyan
+ Henry Yan
+ yanhonglei@gmail.com
+ http://www.kafeitu.me
+ 8
+
+
+
+
+
+ 1.7
+ 4.1.5.RELEASE
+ 4.2.5.Final
+ 1.9.1.RELEASE
+ 1.4
+ 2.0.4
+ 2.8.1
+ 17.0
+ 3.3.2
+ 2.4
+ 2.1
+ 1.7.5
+ 1.2.17
+ 8.1.15.v20140411
+ 1.4.180
+ 4.10
+ 1.9.0
+ 1.4.12
+ 5.22.0
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.5.4
+
+
+
+
+ org.activiti
+ activiti-engine
+ ${activiti.version}
+
+
+ org.activiti
+ activiti-spring
+ ${activiti.version}
+
+
+ org.activiti
+ activiti-json-converter
+ ${activiti.version}
+
+
+
+ org.activiti
+ activiti-explorer
+ ${activiti.version}
+
+
+ vaadin
+ com.vaadin
+
+
+ dcharts-widget
+ org.vaadin.addons
+
+
+ activiti-simple-workflow
+ org.activiti
+
+
+
+
+ org.activiti
+ activiti-modeler
+ ${activiti.version}
+
+
+ org.activiti
+ activiti-rest
+ ${activiti.version}
+
+
+ org.activiti
+ activiti-diagram-rest
+ ${activiti.version}
+
+
+ org.activiti
+ activiti-cxf
+ ${activiti.version}
+
+
+ org.apache.tomcat
+ juli
+ 6.0.47
+
+
+
+
+ org.apache.cxf
+ cxf-api
+ 2.7.6
+
+
+ org.apache.cxf
+ cxf-rt-frontend-jaxws
+ 2.7.6
+
+
+ org.apache.cxf
+ cxf-rt-transports-http-jetty
+ 2.7.6
+ test
+
+
+ org.apache.cxf
+ cxf-rt-transports-http
+ 2.7.6
+
+
+ com.sun.xml.bind
+ jaxb-impl
+ 2.2.11
+
+
+
+
+ org.infinispan
+ infinispan-core
+ 5.1.7.Final
+
+
+
+
+ commons-io
+ commons-io
+ ${commons-io.version}
+
+
+ commons-fileupload
+ commons-fileupload
+ 1.2.2
+
+
+
+
+
+ org.springframework
+ spring-core
+ ${spring.version}
+
+
+ commons-logging
+ commons-logging
+
+
+
+
+ org.springframework
+ spring-beans
+ ${spring.version}
+
+
+ org.springframework
+ spring-context
+ ${spring.version}
+
+
+ org.springframework
+ spring-context-support
+ ${spring.version}
+
+
+ org.springframework
+ spring-aop
+ ${spring.version}
+
+
+ org.aspectj
+ aspectjrt
+ 1.6.9
+
+
+ org.aspectj
+ aspectjweaver
+ 1.6.9
+
+
+ cglib
+ cglib
+ 2.2.2
+
+
+ asm
+ asm
+ 3.3.1
+
+
+
+
+
+
+ org.hibernate
+ hibernate-core
+ ${hibernate.version}
+
+
+ org.hibernate
+ hibernate-entitymanager
+ ${hibernate.version}
+
+
+ org.hibernate.javax.persistence
+ hibernate-jpa-2.0-api
+ 1.0.1.Final
+
+
+
+
+ org.springframework.data
+ spring-data-jpa
+ ${spring-data-jpa.version}
+
+
+ junit
+ junit-dep
+
+
+
+
+ org.springframework
+ spring-orm
+ ${spring.version}
+
+
+ org.springframework
+ spring-jdbc
+ ${spring.version}
+
+
+
+
+ org.apache.commons
+ commons-dbcp2
+ 2.0.1
+
+
+
+
+ ${jdbc.driver.groupId}
+ ${jdbc.driver.artifactId}
+ ${jdbc.driver.version}
+ runtime
+
+
+
+
+
+ org.springframework
+ spring-web
+ ${spring.version}
+
+
+ org.springframework
+ spring-webmvc
+ ${spring.version}
+
+
+
+ javax.servlet
+ jstl
+ 1.2
+
+
+
+ javax.servlet
+ javax.servlet-api
+ 3.1.0
+ provided
+
+
+
+
+
+ org.slf4j
+ slf4j-api
+ ${slf4j.version}
+
+
+ org.slf4j
+ slf4j-log4j12
+ ${slf4j.version}
+
+
+ org.slf4j
+ jcl-over-slf4j
+ ${slf4j.version}
+
+
+ log4j
+ log4j
+ ${log4j.version}
+
+
+
+
+
+ org.apache.commons
+ commons-lang3
+ ${commons-lang3.version}
+
+
+ commons-beanutils
+ commons-beanutils
+ 1.8.3
+
+
+ commons-logging
+ commons-logging
+
+
+
+
+
+ com.google.guava
+ guava
+ ${guava.version}
+
+
+ org.jodd
+ jodd
+ 3.3.2
+
+
+ joda-time
+ joda-time
+ ${joda-time.version}
+
+
+
+
+ com.fasterxml.uuid
+ java-uuid-generator
+ 3.1.3
+
+
+
+
+
+ junit
+ junit
+ ${junit.version}
+ test
+
+
+
+ org.mockito
+ mockito-core
+ ${mockito.version}
+ test
+
+
+
+ org.powermock
+ powermock-module-junit4
+ ${powermock.version}
+ test
+
+
+ org.powermock
+ powermock-api-mockito
+ ${powermock.version}
+ test
+
+
+ org.mockito
+ mockito-all
+
+
+
+
+
+ org.springframework
+ spring-test
+ ${spring.version}
+
+
+
+ com.h2database
+ h2
+ ${h2.version}
+
+
+
+ org.dbunit
+ dbunit
+ 2.4.8
+
+
+
+
+ org.eclipse.jetty.aggregate
+ jetty-webapp
+ ${jetty.version}
+ test
+
+
+ org.eclipse.jetty
+ jetty-jsp
+ ${jetty.version}
+ test
+
+
+
+
+
+
+
+ src/main/resources
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.1
+
+
+ ${jdk.version}
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-eclipse-plugin
+ 2.9
+
+ 2.0
+
+ org.springframework.ide.eclipse.core.springnature
+
+
+
+
+
+
+ org.mortbay.jetty
+ jetty-maven-plugin
+ ${jetty.version}
+
+
+ /${project.artifactId}
+
+ kad
+ 9999
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 2.6
+
+
+
+ zip
+ bar
+ png
+ bpmn
+
+ ${project.build.sourceEncoding}
+
+
+
+
+
+ org.apache.tomcat.maven
+ tomcat7-maven-plugin
+ 2.2
+
+ /${project.artifactId}
+
+ -Xms1024m -Xmx2048m -XX:PermSize=512m -XX:MaxPermSize=1024m -Dfile.encoding=UTF-8
+
+
+
+
+
+ kft-activiti-demo
+
+
+
+
+
+ h2
+
+ h2
+
+
+ com.h2database
+ h2
+ 1.4.190
+
+
+ org.h2.Driver
+ jdbc:h2:file:~/kft-activiti-demo;AUTO_SERVER=TRUE
+ sa
+
+ org.hibernate.dialect.H2Dialect
+
+
+ true
+
+
+
+
+ src/main/resources
+ true
+
+
+
+
+
+
+
+ mysql
+
+ mysql
+
+
+ mysql
+ mysql-connector-java
+ 5.1.11
+
+
+ com.mysql.jdbc.Driver
+
+ root
+ root
+ org.hibernate.dialect.MySQL5InnoDBDialect
+
+
+
+
+ src/main/resources
+ true
+
+
+
+
+
diff --git a/src/main/java/me/kafeitu/demo/activiti/activiti/DbInitConfigurator.java b/src/main/java/me/kafeitu/demo/activiti/activiti/DbInitConfigurator.java
new file mode 100644
index 0000000000..4c4ec3f647
--- /dev/null
+++ b/src/main/java/me/kafeitu/demo/activiti/activiti/DbInitConfigurator.java
@@ -0,0 +1,29 @@
+package me.kafeitu.demo.activiti.activiti;
+
+import org.activiti.engine.cfg.ProcessEngineConfigurator;
+import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
+import org.activiti.engine.impl.db.DbSqlSessionFactory;
+
+/**
+ * @author 三寻
+ * @version 1.0
+ * @date 16/8/19
+ */
+public class DbInitConfigurator implements ProcessEngineConfigurator {
+
+ @Override
+ public void beforeInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
+ DbSqlSessionFactory.databaseSpecificLimitAfterStatements.put("h2", "LIMIT #{firstResult},#{maxResults}");
+ DbSqlSessionFactory.databaseSpecificLimitAfterStatements.put("mysql", "LIMIT #{firstResult},#{maxResults}");
+ }
+
+ @Override
+ public void configure(ProcessEngineConfigurationImpl processEngineConfiguration) {
+
+ }
+
+ @Override
+ public int getPriority() {
+ return 0;
+ }
+}
diff --git a/src/main/java/me/kafeitu/demo/activiti/activiti/form/UsersFormType.java b/src/main/java/me/kafeitu/demo/activiti/activiti/form/UsersFormType.java
index 61795b8aa5..c9a1ab8367 100644
--- a/src/main/java/me/kafeitu/demo/activiti/activiti/form/UsersFormType.java
+++ b/src/main/java/me/kafeitu/demo/activiti/activiti/form/UsersFormType.java
@@ -1,32 +1,32 @@
package me.kafeitu.demo.activiti.activiti.form;
-import java.util.Arrays;
-
-import org.activiti.engine.impl.form.AbstractFormType;
+import org.activiti.engine.form.AbstractFormType;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
+import java.util.Arrays;
+
/**
* 用户表单字段类型
- *
+ *
* @author henryyan
*/
public class UsersFormType extends AbstractFormType {
- @Override
- public String getName() {
- return "users";
- }
+ @Override
+ public String getName() {
+ return "users";
+ }
- @Override
- public Object convertFormValueToModelValue(String propertyValue) {
- String[] split = StringUtils.split(propertyValue, ",");
- return Arrays.asList(split);
- }
+ @Override
+ public Object convertFormValueToModelValue(String propertyValue) {
+ String[] split = StringUtils.split(propertyValue, ",");
+ return Arrays.asList(split);
+ }
- @Override
- public String convertModelValueToFormValue(Object modelValue) {
- return ObjectUtils.toString(modelValue);
- }
+ @Override
+ public String convertModelValueToFormValue(Object modelValue) {
+ return ObjectUtils.toString(modelValue);
+ }
}
diff --git a/src/main/java/me/kafeitu/demo/activiti/activiti/listener/GlobalTaskListener.java b/src/main/java/me/kafeitu/demo/activiti/activiti/listener/GlobalTaskListener.java
new file mode 100644
index 0000000000..eee58d870b
--- /dev/null
+++ b/src/main/java/me/kafeitu/demo/activiti/activiti/listener/GlobalTaskListener.java
@@ -0,0 +1,21 @@
+package me.kafeitu.demo.activiti.activiti.listener;
+
+import org.activiti.engine.delegate.DelegateTask;
+import org.activiti.engine.delegate.TaskListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * User: henryyan
+ */
+public class GlobalTaskListener implements TaskListener {
+
+ protected Logger logger = LoggerFactory.getLogger(getClass());
+
+ @Override
+ public void notify(DelegateTask delegateTask) {
+ logger.debug("触发了全局监听器, pid={}, tid={}, event={}", new Object[]{
+ delegateTask.getProcessInstanceId(), delegateTask.getId(), delegateTask.getEventName()
+ });
+ }
+}
diff --git a/src/main/java/me/kafeitu/demo/activiti/cmd/JumpActivityCmd.java b/src/main/java/me/kafeitu/demo/activiti/cmd/JumpActivityCmd.java
new file mode 100644
index 0000000000..297c637919
--- /dev/null
+++ b/src/main/java/me/kafeitu/demo/activiti/cmd/JumpActivityCmd.java
@@ -0,0 +1,41 @@
+package me.kafeitu.demo.activiti.cmd;
+
+/**
+ * @author: Henry Yan
+ */
+
+import org.activiti.engine.impl.interceptor.Command;
+import org.activiti.engine.impl.interceptor.CommandContext;
+import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
+import org.activiti.engine.impl.pvm.process.ActivityImpl;
+import org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl;
+
+public class JumpActivityCmd implements Command
- * @param processKey 流程定义KEY
- * @throws Exception
- */
- public void deployFromClasspath(String... processKey) throws Exception {
- ResourceLoader resourceLoader = new DefaultResourceLoader();
- String[] processKeys = { "leave", "leave-dynamic-from", "leave-formkey", "dispatch" };
- for (String loopProcessKey : processKeys) {
-
- /*
- * 需要过滤指定流程
- */
- if (ArrayUtils.isNotEmpty(processKey)) {
- if (ArrayUtils.contains(processKey, loopProcessKey)) {
- logger.debug("hit module of {}", processKey);
- deploySingleProcess(resourceLoader, loopProcessKey);
- } else {
- logger.debug("module: {} not equals process key: {}, ignore and continue find next.", loopProcessKey,
- processKey);
- }
- } else {
- /*
- * 所有流程
- */
- deploySingleProcess(resourceLoader, loopProcessKey);
- }
- }
- }
-
- /**
- * 部署单个流程定义
- * @param resourceLoader {@link ResourceLoader}
- * @param processKey 模块名称
- * @param subModule 流程定义名称
- * @throws IOException 找不到zip文件时
- */
- private void deploySingleProcess(ResourceLoader resourceLoader, String processKey) throws IOException {
- String classpathResourceUrl = "classpath:/deployments/" + processKey + ".bar";
- logger.debug("read workflow from: {}", classpathResourceUrl);
- Resource resource = resourceLoader.getResource(classpathResourceUrl);
- InputStream inputStream = resource.getInputStream();
- if (inputStream == null) {
- logger.warn("ignore deploy workflow module: {}", classpathResourceUrl);
- } else {
- logger.debug("finded workflow module: {}, deploy it!", classpathResourceUrl);
- ZipInputStream zis = new ZipInputStream(inputStream);
- repositoryService.createDeployment().addZipInputStream(zis).deploy();
- }
- }
-
- /**
- * 重新部署单个流程定义
- * @param processKey 流程定义KEY
- * @throws Exception
- * @see #deployFromClasspath
- */
- public void redeploy(String... processKey) throws Exception {
- this.deployFromClasspath(processKey);
- }
-
- /**
- * 重新部署所有流程定义,调用:{@link #deployFromClasspath()}完成功能
- * @throws Exception
- * @see #deployFromClasspath
- */
- public void deployAllFromClasspath() throws Exception {
- this.deployFromClasspath();
- }
+ protected Logger logger = LoggerFactory.getLogger(getClass());
+
+ @Autowired
+ protected RuntimeService runtimeService;
+
+ @Autowired
+ protected RepositoryService repositoryService;
+
+ @Autowired
+ protected HistoryService historyService;
+
+ /**
+ * 根据流程实例ID查询流程定义对象{@link ProcessDefinition}
+ *
+ * @param processInstanceId 流程实例ID
+ * @return 流程定义对象{@link ProcessDefinition}
+ */
+ public ProcessDefinition findProcessDefinitionByPid(String processInstanceId) {
+ HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
+ String processDefinitionId = historicProcessInstance.getProcessDefinitionId();
+ ProcessDefinition processDefinition = findProcessDefinition(processDefinitionId);
+ return processDefinition;
+ }
+
+ /**
+ * 根据流程定义ID查询流程定义对象{@link ProcessDefinition}
+ *
+ * @param processDefinitionId 流程定义对象ID
+ * @return 流程定义对象{@link ProcessDefinition}
+ */
+ public ProcessDefinition findProcessDefinition(String processDefinitionId) {
+ ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
+ return processDefinition;
+ }
+
+ /**
+ * 部署classpath下面的流程定义
+ *
+ * 从属性配置文件中获取属性workflow.modules扫描**deployments**
+ *
+ *
+ * 然后从每个**deployments/${module}**查找在属性配置文件中的属性**workflow.module.keys.${
+ * submodule}**
+ *
+ * 配置实例:
+ *
+ *
+ * #workflow for deploy
+ * workflow.modules=budget,erp,oa
+ * workflow.module.keys.budget=budget
+ * workflow.module.keys.erp=acceptInsurance,billing,effectInsurance,endorsement,payment
+ * workflow.module.keys.oa=caruse,leave,officalstamp,officesupply,out,overtime
+ *
+ *
+ *
+ *
+ * @param processKey 流程定义KEY
+ * @throws Exception
+ */
+ public void deployFromClasspath(String exportDir, String... processKey) throws Exception {
+ ResourceLoader resourceLoader = new DefaultResourceLoader();
+ String[] processKeys = {"leave", "leave-dynamic-from", "leave-formkey", "dispatch"};
+ for (String loopProcessKey : processKeys) {
+
+ /*
+ * 需要过滤指定流程
+ */
+ if (ArrayUtils.isNotEmpty(processKey)) {
+ if (ArrayUtils.contains(processKey, loopProcessKey)) {
+ logger.debug("hit module of {}", (Object[]) processKey);
+ deploySingleProcess(resourceLoader, loopProcessKey, exportDir);
+ } else {
+ logger.debug("module: {} not equals process key: {}, ignore and continue find next.", loopProcessKey, processKey);
+ }
+ } else {
+ /*
+ * 所有流程
+ */
+ deploySingleProcess(resourceLoader, loopProcessKey, exportDir);
+ }
+ }
+ }
+
+ /**
+ * 部署单个流程定义
+ *
+ * @param resourceLoader {@link ResourceLoader}
+ * @param processKey 模块名称
+ * @throws IOException 找不到zip文件时
+ */
+ private void deploySingleProcess(ResourceLoader resourceLoader, String processKey, String exportDir) throws IOException {
+ String classpathResourceUrl = "classpath:/deployments/" + processKey + ".bar";
+ logger.debug("read workflow from: {}", classpathResourceUrl);
+ Resource resource = resourceLoader.getResource(classpathResourceUrl);
+ InputStream inputStream = resource.getInputStream();
+ if (inputStream == null) {
+ logger.warn("ignore deploy workflow module: {}", classpathResourceUrl);
+ } else {
+ logger.debug("finded workflow module: {}, deploy it!", classpathResourceUrl);
+ ZipInputStream zis = new ZipInputStream(inputStream);
+ Deployment deployment = repositoryService.createDeployment().addZipInputStream(zis).deploy();
+
+ // export diagram
+ List list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();
+ for (ProcessDefinition processDefinition : list) {
+ WorkflowUtils.exportDiagramToFile(repositoryService, processDefinition, exportDir);
+ }
+ }
+ }
+
+ /**
+ * 重新部署单个流程定义
+ *
+ * @param processKey 流程定义KEY
+ * @throws Exception
+ * @see #deployFromClasspath
+ */
+ public void redeploy(String exportDir, String... processKey) throws Exception {
+ this.deployFromClasspath(exportDir, processKey);
+ }
+
+ /**
+ * 重新部署所有流程定义,调用:{@link #deployFromClasspath()}完成功能
+ *
+ * @throws Exception
+ * @see #deployFromClasspath
+ */
+ public void deployAllFromClasspath(String exportDir) throws Exception {
+ this.deployFromClasspath(exportDir);
+ }
}
diff --git a/src/main/java/me/kafeitu/demo/activiti/service/activiti/WorkflowTraceService.java b/src/main/java/me/kafeitu/demo/activiti/service/activiti/WorkflowTraceService.java
index 65736b7b93..8eadf03dd2 100644
--- a/src/main/java/me/kafeitu/demo/activiti/service/activiti/WorkflowTraceService.java
+++ b/src/main/java/me/kafeitu/demo/activiti/service/activiti/WorkflowTraceService.java
@@ -1,13 +1,6 @@
package me.kafeitu.demo.activiti.service.activiti;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
import me.kafeitu.demo.activiti.util.WorkflowUtils;
-
import org.activiti.engine.IdentityService;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
@@ -24,12 +17,14 @@
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.apache.commons.beanutils.PropertyUtils;
-import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.util.*;
+
/**
* 工作流跟踪相关Service
*
@@ -37,181 +32,184 @@
*/
@Component
public class WorkflowTraceService {
- protected Logger logger = LoggerFactory.getLogger(getClass());
-
- @Autowired
- protected RuntimeService runtimeService;
-
- @Autowired
- protected TaskService taskService;
-
- @Autowired
- protected RepositoryService repositoryService;
-
- @Autowired
- protected IdentityService identityService;
-
- /**
- * 流程跟踪图
- * @param processInstanceId 流程实例ID
- * @return 封装了各种节点信息
- */
- public List