├── .gitignore ├── README.MD ├── activiti-tutorial1 ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── definesys │ │ │ └── totorial │ │ │ └── activiti │ │ │ ├── ActivititiApplication.java │ │ │ ├── config │ │ │ └── ActivitiConfiguration.java │ │ │ ├── controller │ │ │ └── ActivitiController.java │ │ │ ├── dto │ │ │ └── TaskRepresentation.java │ │ │ └── service │ │ │ └── ActivitiService.java │ │ └── resources │ │ └── processes │ │ └── SimpleProcess.bpmn20.xml └── target │ ├── activiti-tutorial1-1.0-SNAPSHOT.jar │ ├── classes │ ├── com │ │ └── definesys │ │ │ └── totorial │ │ │ └── activiti │ │ │ ├── ActivititiApplication.class │ │ │ ├── config │ │ │ └── ActivitiConfiguration.class │ │ │ ├── controller │ │ │ └── ActivitiController.class │ │ │ ├── dto │ │ │ └── TaskRepresentation.class │ │ │ └── service │ │ │ └── ActivitiService.class │ └── processes │ │ └── SimpleProcess.bpmn20.xml │ ├── maven-archiver │ └── pom.properties │ └── maven-status │ └── maven-compiler-plugin │ └── compile │ └── default-compile │ ├── createdFiles.lst │ └── inputFiles.lst ├── activiti-tutorial4 ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── definesys │ │ │ └── totorial4 │ │ │ └── activiti │ │ │ ├── ActivititiApplication.java │ │ │ ├── config │ │ │ └── ActivitiConfiguration.java │ │ │ ├── controller │ │ │ ├── DeploymentController.java │ │ │ └── DeploymentService.java │ │ │ └── util │ │ │ └── ActivitiUtil.java │ │ └── resources │ │ └── processes │ │ └── README.MD └── target │ └── classes │ ├── com │ └── definesys │ │ └── totorial4 │ │ └── activiti │ │ ├── ActivititiApplication.class │ │ ├── config │ │ └── ActivitiConfiguration.class │ │ ├── controller │ │ ├── DeploymentController.class │ │ └── DeploymentService.class │ │ └── util │ │ └── ActivitiUtil.class │ └── processes │ └── README.MD ├── pom.xml └── src └── main └── resources └── application.properties /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | /target/ 3 | /out/ 4 | /classes/ 5 | .mvn 6 | 7 | .idea 8 | *.iws 9 | *.iml 10 | *.ipr 11 | .DS_Store -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | # 说明 2 | 3 | 本项目是`SpringBoot Activiti6系列教程`系列教程的demo,详细教程参考 4 | - [SpringBoot Activiti6系列教程(一)-activiti-app部署](https://zhengjianfeng.cn/?p=162) 5 | - [SpringBoot Activiti6系列教程(二)-基于mysql数据库初始化](https://zhengjianfeng.cn/?p=167) 6 | - [SpringBoot Activiti6系列教程(三)-开发一个简单的SpringBoot activiti6应用程序](https://zhengjianfeng.cn/?p=170) 7 | - [SpringBoot Activiti6系列教程(四)-流程部署](https://zhengjianfeng.cn/?p=176) 8 | - [SpringBoot Activiti6系列教程(五)-activiti api](https://zhengjianfeng.cn/?p=179) 9 | - [SpringBoot Activiti6系列教程(六)-Execution说明](https://zhengjianfeng.cn/?p=184) 10 | - [SpringBoot Activiti6系列教程(七)-变量](https://zhengjianfeng.cn/?p=186) 11 | - [SpringBoot Activiti6系列教程(八)-流程拒绝实现](https://zhengjianfeng.cn/?p=190) 12 | - [SpringBoot Activiti6系列教程(九)-流程回退实现](https://zhengjianfeng.cn/?p=193) 13 | - [SpringBoot Activiti6系列教程(十)-流程加签征询实现(完结篇)](https://zhengjianfeng.cn/?p=197) 14 | -------------------------------------------------------------------------------- /activiti-tutorial1/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | activiti-tutorial 7 | com.definesys.tutorial.activiti 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | activiti-tutorial1 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-web 18 | 19 | 20 | org.activiti 21 | activiti-spring-boot-starter-basic 22 | 6.0.0 23 | 24 | 25 | mysql 26 | mysql-connector-java 27 | 28 | 29 | com.definesys.mpaas 30 | query-mongodb 31 | 1.0.6 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /activiti-tutorial1/src/main/java/com/definesys/totorial/activiti/ActivititiApplication.java: -------------------------------------------------------------------------------- 1 | package com.definesys.totorial.activiti; 2 | 3 | import org.activiti.spring.boot.SecurityAutoConfiguration; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.context.annotation.ComponentScan; 8 | import org.springframework.context.annotation.Configuration; 9 | 10 | /** 11 | * @Copyright: Shanghai Definesys Company.All rights reserved. 12 | * @Description: 13 | * @author: jianfeng.zheng 14 | * @since: 2019/9/5 11:02 AM 15 | * @history: 1.2019/9/5 created by jianfeng.zheng 16 | */ 17 | @SpringBootApplication(exclude = SecurityAutoConfiguration.class) 18 | @ComponentScan(basePackages = {"com.definesys.*"}) 19 | public class ActivititiApplication { 20 | 21 | public static void main(String[] args) { 22 | SpringApplication.run(ActivititiApplication.class); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /activiti-tutorial1/src/main/java/com/definesys/totorial/activiti/config/ActivitiConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.definesys.totorial.activiti.config; 2 | 3 | import org.springframework.boot.jdbc.DataSourceBuilder; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.context.annotation.Primary; 7 | 8 | import javax.sql.DataSource; 9 | 10 | /** 11 | * @Copyright: Shanghai Definesys Company.All rights reserved. 12 | * @Description: 13 | * @author: jianfeng.zheng 14 | * @since: 2019/9/5 2:09 PM 15 | * @history: 1.2019/9/5 created by jianfeng.zheng 16 | */ 17 | @Configuration 18 | public class ActivitiConfiguration { 19 | 20 | @Bean 21 | @Primary 22 | public DataSource database() { 23 | return DataSourceBuilder.create() 24 | .url("jdbc:mysql://localhost:3306/activiti?useUnicode=true&characterEncoding=utf8") 25 | .username("activiti") 26 | .password("definesys") 27 | .driverClassName("com.mysql.jdbc.Driver") 28 | .build(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /activiti-tutorial1/src/main/java/com/definesys/totorial/activiti/controller/ActivitiController.java: -------------------------------------------------------------------------------- 1 | package com.definesys.totorial.activiti.controller; 2 | 3 | import com.definesys.totorial.activiti.dto.TaskRepresentation; 4 | import com.definesys.totorial.activiti.service.ActivitiService; 5 | import org.activiti.engine.task.Task; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | import org.springframework.web.bind.annotation.RequestParam; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | /** 16 | * @Copyright: Shanghai Definesys Company.All rights reserved. 17 | * @Description: 18 | * @author: jianfeng.zheng 19 | * @since: 2019/9/5 11:07 AM 20 | * @history: 1.2019/9/5 created by jianfeng.zheng 21 | */ 22 | @RestController 23 | @RequestMapping(value = "activiti") 24 | public class ActivitiController { 25 | 26 | @Autowired 27 | private ActivitiService service; 28 | 29 | @RequestMapping(value = "start", method = RequestMethod.GET) 30 | public String start() { 31 | return service.start(); 32 | } 33 | 34 | @RequestMapping(value = "task", method = RequestMethod.GET) 35 | public List getTask(@RequestParam(value = "uid") String uid) { 36 | List tasks = service.getTask(uid); 37 | List dtos = new ArrayList<>(); 38 | for (Task task : tasks) { 39 | dtos.add(new TaskRepresentation(task.getId(), task.getName())); 40 | } 41 | return dtos; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /activiti-tutorial1/src/main/java/com/definesys/totorial/activiti/dto/TaskRepresentation.java: -------------------------------------------------------------------------------- 1 | package com.definesys.totorial.activiti.dto; 2 | 3 | /** 4 | * @Copyright: Shanghai Definesys Company.All rights reserved. 5 | * @Description: 6 | * @author: jianfeng.zheng 7 | * @since: 2019/9/5 11:36 AM 8 | * @history: 1.2019/9/5 created by jianfeng.zheng 9 | */ 10 | public class TaskRepresentation { 11 | 12 | private String id; 13 | private String name; 14 | 15 | public TaskRepresentation(String id, String name) { 16 | this.id = id; 17 | this.name = name; 18 | } 19 | 20 | public String getId() { 21 | return id; 22 | } 23 | 24 | public void setId(String id) { 25 | this.id = id; 26 | } 27 | 28 | public String getName() { 29 | return name; 30 | } 31 | 32 | public void setName(String name) { 33 | this.name = name; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /activiti-tutorial1/src/main/java/com/definesys/totorial/activiti/service/ActivitiService.java: -------------------------------------------------------------------------------- 1 | package com.definesys.totorial.activiti.service; 2 | 3 | import org.activiti.engine.RuntimeService; 4 | import org.activiti.engine.TaskService; 5 | import org.activiti.engine.runtime.ProcessInstance; 6 | import org.activiti.engine.task.Task; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @Copyright: Shanghai Definesys Company.All rights reserved. 14 | * @Description: 15 | * @author: jianfeng.zheng 16 | * @since: 2019/9/5 11:07 AM 17 | * @history: 1.2019/9/5 created by jianfeng.zheng 18 | */ 19 | @Service 20 | public class ActivitiService { 21 | 22 | @Autowired 23 | private RuntimeService runtimeService; 24 | @Autowired 25 | private TaskService taskService; 26 | 27 | /** 28 | * start activiti process 29 | * 30 | * @return instance id 31 | */ 32 | public String start() { 33 | ProcessInstance instance = runtimeService.startProcessInstanceByKey("SimpleProcess"); 34 | return instance.getId(); 35 | } 36 | 37 | /** 38 | * get user task list 39 | * 40 | * @param uid 41 | * @return user task list 42 | */ 43 | public List getTask(String uid) { 44 | List tasks = taskService.createTaskQuery().taskAssignee(uid).list(); 45 | return tasks; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /activiti-tutorial1/src/main/resources/processes/SimpleProcess.bpmn20.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /activiti-tutorial1/target/activiti-tutorial1-1.0-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wls1036/springboot-activiti6-tutorial/b38d75680390555787ac13ce9293f490970fa540/activiti-tutorial1/target/activiti-tutorial1-1.0-SNAPSHOT.jar -------------------------------------------------------------------------------- /activiti-tutorial1/target/classes/com/definesys/totorial/activiti/ActivititiApplication.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wls1036/springboot-activiti6-tutorial/b38d75680390555787ac13ce9293f490970fa540/activiti-tutorial1/target/classes/com/definesys/totorial/activiti/ActivititiApplication.class -------------------------------------------------------------------------------- /activiti-tutorial1/target/classes/com/definesys/totorial/activiti/config/ActivitiConfiguration.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wls1036/springboot-activiti6-tutorial/b38d75680390555787ac13ce9293f490970fa540/activiti-tutorial1/target/classes/com/definesys/totorial/activiti/config/ActivitiConfiguration.class -------------------------------------------------------------------------------- /activiti-tutorial1/target/classes/com/definesys/totorial/activiti/controller/ActivitiController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wls1036/springboot-activiti6-tutorial/b38d75680390555787ac13ce9293f490970fa540/activiti-tutorial1/target/classes/com/definesys/totorial/activiti/controller/ActivitiController.class -------------------------------------------------------------------------------- /activiti-tutorial1/target/classes/com/definesys/totorial/activiti/dto/TaskRepresentation.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wls1036/springboot-activiti6-tutorial/b38d75680390555787ac13ce9293f490970fa540/activiti-tutorial1/target/classes/com/definesys/totorial/activiti/dto/TaskRepresentation.class -------------------------------------------------------------------------------- /activiti-tutorial1/target/classes/com/definesys/totorial/activiti/service/ActivitiService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wls1036/springboot-activiti6-tutorial/b38d75680390555787ac13ce9293f490970fa540/activiti-tutorial1/target/classes/com/definesys/totorial/activiti/service/ActivitiService.class -------------------------------------------------------------------------------- /activiti-tutorial1/target/classes/processes/SimpleProcess.bpmn20.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /activiti-tutorial1/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Created by Apache Maven 3.5.0 2 | version=1.0-SNAPSHOT 3 | groupId=com.definesys.tutorial.activiti 4 | artifactId=activiti-tutorial1 5 | -------------------------------------------------------------------------------- /activiti-tutorial1/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst: -------------------------------------------------------------------------------- 1 | com/definesys/totorial/activiti/controller/ActivitiController.class 2 | com/definesys/totorial/activiti/dto/TaskRepresentation.class 3 | com/definesys/totorial/activiti/ActivititiApplication.class 4 | com/definesys/totorial/activiti/config/ActivitiConfiguration.class 5 | com/definesys/totorial/activiti/service/ActivitiService.class 6 | -------------------------------------------------------------------------------- /activiti-tutorial1/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | /Users/asan/workspace/asan/activiti-tutorial/activiti-tutorial1/src/main/java/com/definesys/totorial/activiti/controller/ActivitiController.java 2 | /Users/asan/workspace/asan/activiti-tutorial/activiti-tutorial1/src/main/java/com/definesys/totorial/activiti/dto/TaskRepresentation.java 3 | /Users/asan/workspace/asan/activiti-tutorial/activiti-tutorial1/src/main/java/com/definesys/totorial/activiti/ActivititiApplication.java 4 | /Users/asan/workspace/asan/activiti-tutorial/activiti-tutorial1/src/main/java/com/definesys/totorial/activiti/config/ActivitiConfiguration.java 5 | /Users/asan/workspace/asan/activiti-tutorial/activiti-tutorial1/src/main/java/com/definesys/totorial/activiti/service/ActivitiService.java 6 | -------------------------------------------------------------------------------- /activiti-tutorial4/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | activiti-tutorial 7 | com.definesys.tutorial.activiti 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | activiti-tutorial4 13 | 14 | 15 | 16 | org.springframework.boot 17 | spring-boot-starter-web 18 | 19 | 20 | org.activiti 21 | activiti-spring-boot-starter-basic 22 | 6.0.0 23 | 24 | 25 | mysql 26 | mysql-connector-java 27 | 28 | 29 | com.definesys.mpaas 30 | query-mongodb 31 | 1.0.6 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /activiti-tutorial4/src/main/java/com/definesys/totorial4/activiti/ActivititiApplication.java: -------------------------------------------------------------------------------- 1 | package com.definesys.totorial4.activiti; 2 | 3 | import org.activiti.spring.boot.SecurityAutoConfiguration; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.ComponentScan; 7 | 8 | /** 9 | * @Copyright: Shanghai Definesys Company.All rights reserved. 10 | * @Description: 11 | * @author: jianfeng.zheng 12 | * @since: 2019/9/19 6:16 PM 13 | * @history: 1.2019/9/19 created by jianfeng.zheng 14 | */ 15 | @SpringBootApplication(exclude = SecurityAutoConfiguration.class) 16 | @ComponentScan(basePackages = {"com.definesys.*"}) 17 | public class ActivititiApplication { 18 | 19 | public static void main(String[] args) { 20 | SpringApplication.run(ActivititiApplication.class); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /activiti-tutorial4/src/main/java/com/definesys/totorial4/activiti/config/ActivitiConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.definesys.totorial4.activiti.config; 2 | 3 | import org.springframework.boot.jdbc.DataSourceBuilder; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.context.annotation.Primary; 7 | 8 | import javax.sql.DataSource; 9 | 10 | /** 11 | * @Copyright: Shanghai Definesys Company.All rights reserved. 12 | * @Description: 13 | * @author: jianfeng.zheng 14 | * @since: 2019/9/20 1:23 AM 15 | * @history: 1.2019/9/20 created by jianfeng.zheng 16 | */ 17 | @Configuration 18 | public class ActivitiConfiguration { 19 | @Bean 20 | @Primary 21 | public DataSource database() { 22 | return DataSourceBuilder.create() 23 | .url("jdbc:mysql://localhost:3306/activiti?useUnicode=true&characterEncoding=utf8") 24 | .username("activiti") 25 | .password("definesys") 26 | .driverClassName("com.mysql.jdbc.Driver") 27 | .build(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /activiti-tutorial4/src/main/java/com/definesys/totorial4/activiti/controller/DeploymentController.java: -------------------------------------------------------------------------------- 1 | package com.definesys.totorial4.activiti.controller; 2 | 3 | import org.activiti.engine.repository.Deployment; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.web.bind.annotation.PostMapping; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RequestParam; 8 | import org.springframework.web.bind.annotation.RestController; 9 | import org.springframework.web.multipart.MultipartFile; 10 | 11 | import java.io.IOException; 12 | 13 | /** 14 | * @Copyright: Shanghai Definesys Company.All rights reserved. 15 | * @Description: 16 | * @author: jianfeng.zheng 17 | * @since: 2019/9/19 6:34 PM 18 | * @history: 1.2019/9/19 created by jianfeng.zheng 19 | */ 20 | @RestController 21 | public class DeploymentController { 22 | 23 | @Autowired 24 | private DeploymentService service; 25 | 26 | @PostMapping(value = "/deploy") 27 | public String deploy(@RequestParam("file") MultipartFile file) { 28 | try { 29 | return service.deploy(file.getOriginalFilename(), file.getInputStream()); 30 | } catch (IOException e) { 31 | e.printStackTrace(); 32 | throw new RuntimeException("upload failed"); 33 | } 34 | } 35 | 36 | @PostMapping(value = "/deployBpmn") 37 | public String deployBpmn(@RequestParam("file") MultipartFile file) { 38 | try { 39 | String name = file.getOriginalFilename(); 40 | if (!name.endsWith(".bpmn20.xm") && !name.endsWith(".bpmn")) { 41 | name = name + ".bpmn"; 42 | } 43 | return service.noChangeNoDeploy(name, file.getInputStream()); 44 | } catch (IOException e) { 45 | e.printStackTrace(); 46 | throw new RuntimeException("upload failed"); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /activiti-tutorial4/src/main/java/com/definesys/totorial4/activiti/controller/DeploymentService.java: -------------------------------------------------------------------------------- 1 | package com.definesys.totorial4.activiti.controller; 2 | 3 | import com.definesys.totorial4.activiti.util.ActivitiUtil; 4 | import org.activiti.engine.ActivitiObjectNotFoundException; 5 | import org.activiti.engine.RepositoryService; 6 | import org.activiti.engine.repository.Deployment; 7 | import org.activiti.engine.repository.DeploymentBuilder; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.io.InputStream; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | /** 16 | * @Copyright: Shanghai Definesys Company.All rights reserved. 17 | * @Description: 18 | * @author: jianfeng.zheng 19 | * @since: 2019/9/20 1:09 AM 20 | * @history: 1.2019/9/20 created by jianfeng.zheng 21 | */ 22 | @Service 23 | public class DeploymentService { 24 | 25 | @Autowired 26 | private RepositoryService repositoryService; 27 | 28 | /** 29 | * deploy resource 30 | * 31 | * @param name resource name 32 | * @param fin resource inputstream 33 | * @return 34 | */ 35 | public String deploy(String name, InputStream fin) { 36 | String deploymentId = repositoryService.createDeployment() 37 | .addInputStream(name, fin) 38 | .name(name) 39 | .key(name) 40 | .deploy() 41 | .getId(); 42 | return deploymentId; 43 | } 44 | 45 | /** 46 | * deploy resource 47 | * 48 | * @param name resource name 49 | * @param fin resource inputstream 50 | * @return 51 | */ 52 | public String noChangeNoDeploy(String name, InputStream fin) { 53 | //获取最新的一次部署 54 | Deployment latestDeployment = repositoryService.createDeploymentQuery() 55 | .deploymentName(name) 56 | .deploymentKey(name) 57 | .latest() 58 | .singleResult(); 59 | String sbpmn = ActivitiUtil.text(fin); 60 | if (latestDeployment != null) { 61 | //检测是否内容发生变化,只重新部署有修改的流程 62 | InputStream input = repositoryService.getResourceAsStream(latestDeployment.getId(), name); 63 | String dbpmn = ActivitiUtil.text(input); 64 | if (sbpmn.length() == dbpmn.length() && sbpmn.equals(dbpmn)) { 65 | return latestDeployment.getId(); 66 | } 67 | } 68 | String deploymentId = repositoryService.createDeployment() 69 | .addString(name, sbpmn) 70 | .name(name) 71 | .key(name) 72 | .deploy() 73 | .getId(); 74 | return deploymentId; 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /activiti-tutorial4/src/main/java/com/definesys/totorial4/activiti/util/ActivitiUtil.java: -------------------------------------------------------------------------------- 1 | package com.definesys.totorial4.activiti.util; 2 | 3 | import java.io.ByteArrayOutputStream; 4 | import java.io.InputStream; 5 | 6 | /** 7 | * @Copyright: Shanghai Definesys Company.All rights reserved. 8 | * @Description: 9 | * @author: jianfeng.zheng 10 | * @since: 2019/9/20 2:41 AM 11 | * @history: 1.2019/9/20 created by jianfeng.zheng 12 | */ 13 | public class ActivitiUtil { 14 | 15 | public static String text(InputStream fin) { 16 | byte[] buf = new byte[512]; 17 | ByteArrayOutputStream bout = new ByteArrayOutputStream(); 18 | try { 19 | do { 20 | int size = fin.read(buf); 21 | if (size <= 0) { 22 | break; 23 | } 24 | bout.write(buf, 0, size); 25 | } while (true); 26 | String text = new String(bout.toByteArray(), "UTF-8"); 27 | bout.close(); 28 | return text; 29 | } catch (Exception ex) { 30 | throw new RuntimeException("convert error"); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /activiti-tutorial4/src/main/resources/processes/README.MD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wls1036/springboot-activiti6-tutorial/b38d75680390555787ac13ce9293f490970fa540/activiti-tutorial4/src/main/resources/processes/README.MD -------------------------------------------------------------------------------- /activiti-tutorial4/target/classes/com/definesys/totorial4/activiti/ActivititiApplication.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wls1036/springboot-activiti6-tutorial/b38d75680390555787ac13ce9293f490970fa540/activiti-tutorial4/target/classes/com/definesys/totorial4/activiti/ActivititiApplication.class -------------------------------------------------------------------------------- /activiti-tutorial4/target/classes/com/definesys/totorial4/activiti/config/ActivitiConfiguration.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wls1036/springboot-activiti6-tutorial/b38d75680390555787ac13ce9293f490970fa540/activiti-tutorial4/target/classes/com/definesys/totorial4/activiti/config/ActivitiConfiguration.class -------------------------------------------------------------------------------- /activiti-tutorial4/target/classes/com/definesys/totorial4/activiti/controller/DeploymentController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wls1036/springboot-activiti6-tutorial/b38d75680390555787ac13ce9293f490970fa540/activiti-tutorial4/target/classes/com/definesys/totorial4/activiti/controller/DeploymentController.class -------------------------------------------------------------------------------- /activiti-tutorial4/target/classes/com/definesys/totorial4/activiti/controller/DeploymentService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wls1036/springboot-activiti6-tutorial/b38d75680390555787ac13ce9293f490970fa540/activiti-tutorial4/target/classes/com/definesys/totorial4/activiti/controller/DeploymentService.class -------------------------------------------------------------------------------- /activiti-tutorial4/target/classes/com/definesys/totorial4/activiti/util/ActivitiUtil.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wls1036/springboot-activiti6-tutorial/b38d75680390555787ac13ce9293f490970fa540/activiti-tutorial4/target/classes/com/definesys/totorial4/activiti/util/ActivitiUtil.class -------------------------------------------------------------------------------- /activiti-tutorial4/target/classes/processes/README.MD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wls1036/springboot-activiti6-tutorial/b38d75680390555787ac13ce9293f490970fa540/activiti-tutorial4/target/classes/processes/README.MD -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.definesys.tutorial.activiti 8 | activiti-tutorial 9 | pom 10 | 1.0-SNAPSHOT 11 | 12 | activiti-tutorial1 13 | activiti-tutorial4 14 | 15 | 16 | 17 | org.springframework.boot 18 | spring-boot-starter-parent 19 | 2.1.2.RELEASE 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8999 --------------------------------------------------------------------------------