activiti自己定义流程之Spring整合activiti-modeler5.16实例(四):部署流程定义
注:(1)环境搭建:activiti自己定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建
(2)创建流程模型:activiti自己定义流程之Spring整合activiti-modeler5.16实例(二):创建流程模型
(3)流程模型列表展示:activiti自己定义流程之Spring整合activiti-modeler5.16实例(三):流程模型列表展示
1.maven导包及spring的一些基本配置与之前的没有什么变化,依然沿用就好。
2.与流程定义相关的有3张表,各自是act_ge_bytearray、act_re_procdef和act_re_deployment。
当然了,假设更准确的说,在我的自己定义流程中,流程定义须要用到流程模型相关的数据,也能够说流程定义相关的就有四张表,也包含model表。
3.后台业务代码,依据前端传入的deploymentId部署流程定义。这里还是使用repositoryService进行操作。大致上的过程就是依据deploymentId查询出创建模型时生成的相关文件,然后进行一定的转换后进行部署:
/**
* 依据模型id部署流程定义
*
* @author:tuzongxun
* @Title: deploye
* @param @param activitiModel
* @param @param redirectAttributes
* @param @return
* @return Object
* @date Mar 17, 2016 12:30:05 PM
* @throws
*/
@RequestMapping(value = "/deploye.do", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
@ResponseBody
public Object deploye(@RequestBody ActivitiModel activitiModel,
HttpServletRequest req) {
Map<String, Object> map = new HashMap<String, Object>();
boolean isLogin = this.isLogin(req);
if (isLogin) {
String modelId = activitiModel.getId();
try {
Model modelData = repositoryService.getModel(modelId);
ObjectNode modelNode = (ObjectNode) new ObjectMapper()
.readTree(repositoryService
.getModelEditorSource(modelData.getId()));
byte[] bpmnBytes = null;
BpmnModel model = new BpmnJsonConverter()
.convertToBpmnModel(modelNode);
bpmnBytes = new BpmnXMLConverter().convertToXML(model);
String processName = modelData.getName() + ".bpmn20.xml";
Deployment deployment = repositoryService.createDeployment()
.name(modelData.getName())
.addString(processName, new String(bpmnBytes)).deploy();
if (deployment != null && deployment.getId() != null) {
map.put("isLogin", "yes");
map.put("userName",
(String) req.getSession().getAttribute("userName"));
map.put("result", "success");
}
} catch (Exception e) {
e.printStackTrace(); }
} else {
map.put("isLogin", "no");
}
return map;
}
4.angular js前台代码。这里实际上仅仅是在之前的模型列表页面调用了一个方法,因此前端代码依然是上篇中的代码,仅仅是当中的方法这里调用罢了:
angular.module('activitiApp')
.controller('modelCtr', ['$rootScope','$scope','$http','$location', function($rootScope,$scope,$http,$location){
$scope.init=function(){
$http.post("./modelList.do").success(function(result) {
if(result.isLogin==="yes"){
$rootScope.userName=result.userName;
console.log(result.data);
$scope.modelList=result.data;
}else{
$location.path("/login");
}
});
}
//部署流程定义,这里主要就是用这种方法
$scope.deploye=function(model){
console.log(model);
$http.post("./deploye.do",model).success(function(deployResult){
$location.path("/processList");
});
}
$scope.update=function(modelId){
window.open("http://localhost:8080/activitiTest2/service/editor?
id="+modelId);
}
}])
5.部署之前。我们能够看到原本创建一个模型的时候,数据库中仅仅会在model表和bytearray两张表分别出现一条和两条数据。
而当成功部署以后。bytearray表中会再次添加两条数据,同一时候act_re_procdef和act_re_deployment这两张表也都会各自出现一条相应的数据。bytearray表此时数据例如以下图:
act_re_procdef表中数据例如以下:
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">
act_re_deployment中数据例如以下:
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">
须要说明的是,这些数据在兴许的操作中都须要用到,假如有缺少的。必然会影响兴许的操作。
activiti自己定义流程之Spring整合activiti-modeler5.16实例(四):部署流程定义的更多相关文章
- activiti自己定义流程之Spring整合activiti-modeler实例(六):启动流程
1.启动流程并分配任务是单个流程的正式開始,因此要使用到runtimeService接口.以及相关的启动流程的方法.我习惯于用流程定义的key启动,由于有多个版本号的流程定义时,用key启动默认会使用 ...
- activiti自己定义流程之Spring整合activiti-modeler实例(一):环境搭建
项目中须要整合activiti-modeler自己定义流程,找了非常多资料后,最终成功的跳转到activiti-modeler流程设计界面.下面是记录: 一.整合基础:eclipse4.4.1.tom ...
- activiti自己定义流程之Spring整合activiti-modeler实例(七):任务列表展示
1.通过上一节的操作,能够知道流程启动以后会同一时候生成一个流程实例和用户任务.这个用户任务保存在act_ru_task和act_hi_task表中,从表明能够看出ru是runtime,hi是hist ...
- activiti自定义流程之Spring整合activiti-modeler5.16实例(五):流程定义列表
注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建 (2)创建流程模型:activiti自定义流程之Spring ...
- activiti自定义流程之Spring整合activiti-modeler5.16实例(四):部署流程定义
注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建 (2)创建流程模型:activiti自定义流程之Spring ...
- activiti自定义流程之Spring整合activiti-modeler5.16实例(九):历史任务查询
注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建 (2)创建流程模型:activiti自定义流程之Spring ...
- activiti自定义流程之Spring整合activiti-modeler5.16实例(八):完成个人任务
注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建 (2)创建流程模型:activiti自定义流程之Spring ...
- activiti自定义流程之Spring整合activiti-modeler5.16实例(七):任务列表展示
注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建 (2)创建流程模型:activiti自定义流程之Spring ...
- activiti自定义流程之Spring整合activiti-modeler5.16实例(六):启动流程
注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建 (2)创建流程模型:activiti自定义流程之Spring ...
随机推荐
- SpringMVC 控制器统一异常处理
摘要介绍spring mvc控制器中统一处理异常的两种方式:HandlerExceptionResolver以及@ExceptionHandler:以及使用@ControllerAdvice将@Exc ...
- 根据截至日期格式获取倒计时&&时间戳转日期格式
//时间戳转日期格式,传入时间戳必须为数字类型function currentDate(shijianchuo) { var date = new Date(shijianchuo); var y = ...
- [转载]在网页中插入media,RealPlayer等控件
[转载]在网页中插入media,RealPlayer等控件 (2012-11-02 20:27:43) 转载▼ 标签: 转载 原文地址:在网页中插入media,RealPlayer等控件作者:Mo ...
- vue多视图
第一步 在app.vue中 <router-view class="b" name="header"> </router-view> ...
- 笔试算法题(45):简介 - AC自动机(Aho-Corasick Automation)
议题:AC自动机(Aho-Corasick Automation) 分析: 此算法在1975年产生于贝尔实验室,是著名的多模式匹配算法之一:一个常见的例子就是给定N个单词,给定包含M个字符的文章,要求 ...
- [Python3网络爬虫开发实战] 1.5.1-PyMySQL的安装
在Python 3中,如果想要将数据存储到MySQL中,就需要借助PyMySQL来操作,本节中我们介绍一下它的安装方式. 1. 相关链接 GitHub:https://github.com/PyMyS ...
- assert.deepEqual()
assert.deepEqual(actual, expected[, message]) 深度比较 actual 和 expected 参数,使用比较运算符(==)比较原始值. 只考虑可枚举的&qu ...
- N分之一 竖式除法模拟
N分之一 Description Alice越来越痴迷于数学问题了.一天,爸爸出了个数学题想难倒她,让她求1 / n. 可怜的Alice只有一岁零九个月,回答不上来 ~~~~(>_<)~~ ...
- Session与Token的区别
1. 为什么要有session的出现?答:是由于网络中http协议造成的,因为http本身是无状态协议,这样,无法确定你的本次请求和上次请求是不是你发送的.如果要进行类似论坛登陆相关的操作,就实现不了 ...
- 60. Spring Boot写后感【从零开始学Spring Boot】
从2016年4月15日到2016年7月20日经历长达3个月的时间,[从零开始学习Spring Boot]系列就要告一段落了.国内的各种资源都比较乱或者是copy 来copy去的,错了也不加以修正下,导 ...