注:(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查询出创建模型时生成的相关文件,然后进行一定的转换后进行部署:

  1. /**
  2. * 根据模型id部署流程定义
  3. *
  4. * @author:tuzongxun
  5. * @Title: deploye
  6. * @param @param activitiModel
  7. * @param @param redirectAttributes
  8. * @param @return
  9. * @return Object
  10. * @date Mar 17, 2016 12:30:05 PM
  11. * @throws
  12. */
  13. @RequestMapping(value = "/deploye.do", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
  14. @ResponseBody
  15. public Object deploye(@RequestBody ActivitiModel activitiModel,
  16. HttpServletRequest req) {
  17. Map<String, Object> map = new HashMap<String, Object>();
  18. boolean isLogin = this.isLogin(req);
  19. if (isLogin) {
  20. String modelId = activitiModel.getId();
  21. try {
  22. Model modelData = repositoryService.getModel(modelId);
  23. ObjectNode modelNode = (ObjectNode) new ObjectMapper()
  24. .readTree(repositoryService
  25. .getModelEditorSource(modelData.getId()));
  26. byte[] bpmnBytes = null;
  27. BpmnModel model = new BpmnJsonConverter()
  28. .convertToBpmnModel(modelNode);
  29. bpmnBytes = new BpmnXMLConverter().convertToXML(model);
  30. String processName = modelData.getName() + ".bpmn20.xml";
  31. Deployment deployment = repositoryService.createDeployment()
  32. .name(modelData.getName())
  33. .addString(processName, new String(bpmnBytes)).deploy();
  34. if (deployment != null && deployment.getId() != null) {
  35. map.put("isLogin", "yes");
  36. map.put("userName",
  37. (String) req.getSession().getAttribute("userName"));
  38. map.put("result", "success");
  39. }
  40. } catch (Exception e) {
  41. e.printStackTrace();
  42. }
  43. } else {
  44. map.put("isLogin", "no");
  45. }
  46. return map;
  47. }

4.angular js前台代码,这里实际上只是在之前的模型列表页面调用了一个方法,因此前端代码依旧是上篇中的代码,只是其中的方法这里调用罢了:

  1. angular.module('activitiApp')
  2. .controller('modelCtr', ['$rootScope','$scope','$http','$location', function($rootScope,$scope,$http,$location){
  3. $scope.init=function(){
  4. $http.post("./modelList.do").success(function(result) {
  5. if(result.isLogin==="yes"){
  6. $rootScope.userName=result.userName;
  7. console.log(result.data);
  8. $scope.modelList=result.data;
  9. }else{
  10. $location.path("/login");
  11. }
  12. });
  13. }
  14. //部署流程定义,这里主要就是用这个方法
  15. $scope.deploye=function(model){
  16. console.log(model);
  17. $http.post("./deploye.do",model).success(function(deployResult){
  18. $location.path("/processList");
  19. });
  20. }
  21. $scope.update=function(modelId){
  22. window.open("http://localhost:8080/activitiTest2/service/editor?id="+modelId);
  23. }
  24. }])

5.部署之前,我们可以看到原本创建一个模型的时候,数据库中只会在model表和bytearray两张表分别出现一条和两条数据。而当成功部署以后,bytearray表中会再次增加两条数据,同时act_re_procdef和act_re_deployment这两张表也都会各自出现一条对应的数据。bytearray表此时数据如下图:

act_re_procdef表中数据如下:

act_re_deployment中数据如下:

需要说明的是,这些数据在后续的操作中都需要用到,假如有缺少的,必定会影响后续的操作。

activiti自定义流程之Spring整合activiti-modeler5.16实例(四):部署流程定义的更多相关文章

  1. activiti自定义流程之Spring整合activiti-modeler5.16实例(九):历史任务查询

    注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建        (2)创建流程模型:activiti自定义流程之Spring ...

  2. activiti自定义流程之Spring整合activiti-modeler5.16实例(八):完成个人任务

    注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建        (2)创建流程模型:activiti自定义流程之Spring ...

  3. activiti自定义流程之Spring整合activiti-modeler5.16实例(七):任务列表展示

    注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建        (2)创建流程模型:activiti自定义流程之Spring ...

  4. activiti自定义流程之Spring整合activiti-modeler5.16实例(六):启动流程

    注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建        (2)创建流程模型:activiti自定义流程之Spring ...

  5. activiti自定义流程之Spring整合activiti-modeler5.16实例(五):流程定义列表

    注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建        (2)创建流程模型:activiti自定义流程之Spring ...

  6. activiti自定义流程之Spring整合activiti-modeler5.16实例(三):流程模型列表展示

    注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建        (2)创建流程模型:activiti自定义流程之Spring ...

  7. activiti自定义流程之Spring整合activiti-modeler5.16实例(二):创建流程模型

    注:(1)环境搭建:activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建 1.maven导包,这里就没有什么多的好说了,直接代码: <depe ...

  8. activiti自定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建

    项目中需要整合activiti-modeler自定义流程,找了很多资料后,终于成功的跳转到activiti-modeler流程设计界面,以下是记录: 一.整合基础:eclipse4.4.1.tomca ...

  9. activiti自己定义流程之Spring整合activiti-modeler5.16实例(四):部署流程定义

    注:(1)环境搭建:activiti自己定义流程之Spring整合activiti-modeler5.16实例(一):环境搭建         (2)创建流程模型:activiti自己定义流程之Spr ...

随机推荐

  1. lecture7-序列模型及递归神经网络RNN(转载)

    Hinton 第七课 .这里先说下RNN有recurrent neural network 和 recursive neural network两种,是不一样的,前者指的是一种人工神经网络,后者指的是 ...

  2. c#部分---用结构体的题目- //请输入班级人数,输入每个人的学号,姓名,和语文分数、数学分数和英语分数(要求使用结构体)

    //请输入班级人数,输入每个人的学号,姓名,和语文分数.数学分数和英语分数(要求使用结构体), //求班级里两个语文分数是最高分的学生的所有信息:数学分数是最高分的两个学生的所有信息:英语平均分 建立 ...

  3. 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 ...

  4. URAL 1934 Black Spot(最短路)

    Black Spot Time limit: 1.0 secondMemory limit: 64 MB Bootstrap: Jones's terrible leviathan will find ...

  5. 渴切-开源中文css框架

    渴切:是国内优秀的开源css框架. 渴切是一个开源中文 (X)HTML/CSS 框架 ,它的目的是减少你的css开发时间.它提供一个可靠的css基础去创建你的项目,能够用于网站的快速设计,通过重设和重 ...

  6. 系统镜像以及微PE工具箱

    微PE地址:http://www.wepe.com.cn/download.html MSDN镜像下载地址:http://msdn.itellyou.cn/ 小白也能轻松装系统(win10 64位) ...

  7. ps颜色相加

    一. 红+绿=黄 红+蓝=品红 绿+蓝=青 白色:红+绿+蓝=白色.(黄.品红.青,两种以上颜色相加是白色) 互补色:红->青.绿->品红.蓝->黄 二. 品红+黄=红 青+黄=绿 ...

  8. log tree(merge)

    http://www-users.cs.umn.edu/~he/diff/p256-severance.pdf http://www.eecs.harvard.edu/~margo/cs165/pap ...

  9. Cannot unwrap to requested type [javax.sql.DataSource]

    遇上这个bug我的情况是这样,hibernate4以后,spring3.1不再有hibernateDaoSupport,在dao层不能继承HibernateDaoSupport, 只能显式声明Sess ...

  10. 使用JavaScript实现一个倒数计时程序

    使用JavaScript在网页中实现一个计算当年还剩多少时间的倒数计时程序,网页上能够实时动态显示“XX年还剩XX天XX时XX分XX秒”: 程序代码如下: <meta charset=" ...