Activiti the spring integration activiti-modeler5.16 instance of the custom process (iv): deployment process Definition

Source: Internet
Author: User

Note: (1) Environment construction: Activiti Custom process Spring Integration activiti-modeler5.16 Example (i): Environment construction
(2) Create process Model: Activiti custom process Spring Integration activiti-modeler5.16 Instance (ii): Create process Model
(3) Process Model list show: Activiti custom process Spring Integration activiti-modeler5.16 Instance (iii): Process Model list Show


1.maven Guide Package and some of the basic spring configuration and no changes in the previous, it is still the same as well.


2. There are 3 tables related to the process definition, namely Act_ge_bytearray, Act_re_procdef and Act_re_deployment. Of course, if it is more accurate, in my custom process, the process definition needs to use the data related to the process model, or it can be said that the process definition is related to four tables, including the model table.


3. Background business code, according to the front-end incoming Deploymentid deployment process definition, here or use Repositoryservice to operate, the general process is based on Deploymentid query out the creation of the model when the relevant files, Then perform a certain conversion after the deployment:

[Java]View PlainCopy  
  1. /**
  2. * Deployment process definition based on model 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, 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 foreground code, here actually just called a method in the previous Model list page, so the front-end code is still the code in the previous article, but the method is called here:

[JavaScript]View PlainCopy 
  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. //deployment process definition, here is the main way
  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. Before deployment, we can see that when a model is originally created, only one and two data will appear in the database in model table and ByteArray two tables respectively. When successfully deployed, the ByteArray table will add two more data, and the two tables of Act_re_procdef and Act_re_deployment will each appear with a corresponding data. ByteArray table at this time data such as:

The data in the Act_re_procdef table is as follows:

The data in Act_re_deployment is as follows:

It should be noted that these data in the subsequent operation of the need to use, if there is a lack of, will inevitably affect the subsequent operation.

Activiti activiti-modeler5.16 instance of the spring consolidation of the custom process (iv): deployment process definition

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.