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表中数据如下:
act_re_deployment中数据如下:
需要说明的是,这些数据在后续的操作中都需要用到,假如有缺少的,必定会影响后续的操作。
activiti自定义流程之Spring整合activiti-modeler5.16实例(四):部署流程定义的更多相关文章
- 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 ...
- activiti自定义流程之Spring整合activiti-modeler5.16实例(二):创建流程模型
注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建 1.maven导包,这里就没有什么多的好说了,直接代码: <depe ...
- activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建
项目中需要整合activiti-modeler自定义流程,找了很多资料后,终于成功的跳转到activiti-modeler流程设计界面,以下是记录: 一.整合基础:eclipse4.4.1.tomca ...
- activiti自己定义流程之Spring整合activiti-modeler5.16实例(四):部署流程定义
注:(1)环境搭建:activiti自己定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建 (2)创建流程模型:activiti自己定义流程之Spr ...
随机推荐
- lecture7-序列模型及递归神经网络RNN(转载)
Hinton 第七课 .这里先说下RNN有recurrent neural network 和 recursive neural network两种,是不一样的,前者指的是一种人工神经网络,后者指的是 ...
- c#部分---用结构体的题目- //请输入班级人数,输入每个人的学号,姓名,和语文分数、数学分数和英语分数(要求使用结构体)
//请输入班级人数,输入每个人的学号,姓名,和语文分数.数学分数和英语分数(要求使用结构体), //求班级里两个语文分数是最高分的学生的所有信息:数学分数是最高分的两个学生的所有信息:英语平均分 建立 ...
- leetcode 111 Minimum Depth of Binary Tree ----- java
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shor ...
- URAL 1934 Black Spot(最短路)
Black Spot Time limit: 1.0 secondMemory limit: 64 MB Bootstrap: Jones's terrible leviathan will find ...
- 渴切-开源中文css框架
渴切:是国内优秀的开源css框架. 渴切是一个开源中文 (X)HTML/CSS 框架 ,它的目的是减少你的css开发时间.它提供一个可靠的css基础去创建你的项目,能够用于网站的快速设计,通过重设和重 ...
- 系统镜像以及微PE工具箱
微PE地址:http://www.wepe.com.cn/download.html MSDN镜像下载地址:http://msdn.itellyou.cn/ 小白也能轻松装系统(win10 64位) ...
- ps颜色相加
一. 红+绿=黄 红+蓝=品红 绿+蓝=青 白色:红+绿+蓝=白色.(黄.品红.青,两种以上颜色相加是白色) 互补色:红->青.绿->品红.蓝->黄 二. 品红+黄=红 青+黄=绿 ...
- log tree(merge)
http://www-users.cs.umn.edu/~he/diff/p256-severance.pdf http://www.eecs.harvard.edu/~margo/cs165/pap ...
- Cannot unwrap to requested type [javax.sql.DataSource]
遇上这个bug我的情况是这样,hibernate4以后,spring3.1不再有hibernateDaoSupport,在dao层不能继承HibernateDaoSupport, 只能显式声明Sess ...
- 使用JavaScript实现一个倒数计时程序
使用JavaScript在网页中实现一个计算当年还剩多少时间的倒数计时程序,网页上能够实时动态显示“XX年还剩XX天XX时XX分XX秒”: 程序代码如下: <meta charset=" ...