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
1.maven Guide Package and some basic configuration of spring and the creation of the process model when there is no change, still follow the good, front-end of the first page does not have to change too much, just need to put the newly created JS introduced in the.
The 2.acitivit process defines 24 tables that are necessary.
There are two Act_re_model and act_ge_bytearray associated with creating the model.
After you have successfully created the model, you can see that there will be a data in the model table, and two corresponding data will be generated in the ByteArray table. The two data IDs are stored in the model table, resulting in an association.
Therefore, the Process Model list query needs to be done in both tables.
3. The model belongs to the resource file, so the repositoryservice is used to invoke the relevant method, Activiti also provides the related method Createmodelquery and Activitimodel entity class.
4. In combination with the above, the background business code as follows, in order to facilitate the reception to obtain data, I also defined the model entity class, only the data I want to show:
/** * Model List * * @author: Tuzongxun * @Title: Modellist * @param @return * @return Object * @date Mar, 12:29:52 PM * @throws */@RequestMapping (value = "/modellist.do", method = Requestmethod.post, produces = "application/json;charset= Utf-8 ") @ResponseBodypublic Object modellist (httpservletrequest req) {map<string, object> Map = new hashmap< String, Object> (), Boolean islogin = This.islogin (req), if (islogin) {list<activitimodel> modellist = new Arraylist<activitimodel> (); try {list<model> modelList1 = Repositoryservice.createmodelquery (). List (); if (modelList1! = null && modellist1.size () > 0) {for (Model model:modellist1) {Activitimodel Activitimodel = New Activitimodel (); Activitimodel.setid (Model.getid ()); Activitimodel.setcreatetime (Model.getcreatetime ()); Activitimodel.setdescription (Model.getmetainfo ()); Activitimodel.setkey (Model.getkey ()); Activitimodel.setlastupdatetime (Model.getlastupdatetime ()); Activitimodel.setname (Model.getName ()); actiVitimodel.setversion (Model.getversion ()); Modellist.add (Activitimodel);}} Map.put ("IsLogin", "yes"), Map.put ("UserName", (String) req.getsession (). getattribute ("UserName"); Map.put ("Result "," success "); Map.put (" Data ", modellist);} catch (Exception e) {e.getstacktrace ();}} else {map.put ("IsLogin", "No");} return map;}
5. Front desk app.js Add code:
$stateProvider . State (' Modellist ', { URL: '/modellist ', views : { ' view ': { templateurl: ' Activi _views/modellist.html ', controller: ' Modelctr '}} );
6. The foreground creates a new control layer JS (note in the homepage index.html this JS, my home is activiti.html), Modelctr.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/activitiTest1/service/editor?id = "+modelid); } }])
7.modelList page, modellist.html:
<div id= "Logdiv1" ng-init= "init ();" > <p style= "font-size:24px;margin-top:10px" > Model list </p> <center> <table border= "1px" style = "Width:87%;font-size:18px;text-align:center;margin-left:2px;margin-top:auto;position:relative;float:left;" cellspacing= "0px" cellpadding= "0px" > <tr style= "background-color: #ccc" > <td>ID</td> <td>NAME</td> <td>KEY</td> <td> Description </td> <td> version </t D> <td> creation time </td> <td> modification time </td> <td> action </td> </tr> ; <TR ng-repeat= "model in Modellist | By: ' id ' > <td>{{model.id}}</td> <td>{{model.name}}</td> <td> ; {{model.key}}</td> <td>{{model.metaInfo}}</td> <td>{{model.version}}</td> <td>{{model.createtime | date: "YYYY-MM-DD HH:mm:ss"}}</td> <td>{{model.lastupdatetime | date: "YYYY-MM-DD HH:mm:ss"}}</td> <td><a href= "script:;" Ng-clic k= "Deploye" > Deployment </a> <a href= "script:;" ng-click= "Delete (model)" > Delete </a> <a href= "script:;" ng-click= "Update (model.id)" > Modify </a> </td> </tr> </table> ; </center> </div>
8. The results of the page display are as follows:
Activiti the spring integration activiti-modeler5.16 instance of the custom process (iii): Process Model List Display