activiti入门六(集成新版activitimodeler与rest服务)_第1页
activiti入门六(集成新版activitimodeler与rest服务)_第2页
activiti入门六(集成新版activitimodeler与rest服务)_第3页
activiti入门六(集成新版activitimodeler与rest服务)_第4页
activiti入门六(集成新版activitimodeler与rest服务)_第5页
已阅读5页,还剩11页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、activiti 入口K (集成新版 Activiti Modeler 与 Rest 月艮务)目刖activiti提供的Activiti Modeler有两套,从 Activiti5. 17 后,发布 了新的 Activiti Modeler 组件。本.文 主要 介绍如何在项目中集成最新的Activiti Modeler,新 版的效果相比于上一版,个人感觉更加的简洁,优美。并且在 Activiti5. 20后,完善了很多上版本的bug。Activiti Modeler内部的实现上还是以oryx为图形组件为 内核,用angular, js作为界面基本兀素的基础组件以 及调度 oryx 的 API

2、oActiviti explorer 的集成方式首先,从github下载Activiti源码.在第一章已经列出 具体地ilk: https:/github. com/Activiti/ActivitiActiviti Exploer 的内部结构-Java assemblyjavaorgactiviti resouercsorg1activitiwebappMETINFVAADINthemes1widgetsetsWENFdiagramiewerimagesedit-oarppconfigurationcsseditorfontsil8nimageslibspartialspopupsIsten

3、cilsetsl2345678910111213141516171819202122232 4252627我们需要关注的目录是webapp/editor-app ,以及 j ava/org/ac t i v i t i新版的Activiti Explorer放弃了 XML方式的配置,米用Bean configuration 的方式代替。在org/activiti/exp 1 ore/conf包中就是各种的配置代码,在 org/activiti/explore/servlet/WebConfigurer 类米用 Servlet方式配置 Servlet 映射关系,映射路径为 /service/*A

4、ctiviti Exploer 的内部结构-Web新版本Activiti Modeler的Web资源不再像旧版那么散乱,新版本只需要关注:src/main/webapp/editor-app : 目录中包含设计器里面所有的资源: angular, js、oryx, js 以及配套的插件及css标准里面各种组src/main/webapp/modeler. html : 设计器的王页面,用来引 入各种web资源src/main/resources/stencilset. json: bpmn件的 json 定乂, editor 以 import 使用。与项目的实际整合Activiti Rest

5、接口与Spring MVC 配置Maven依赖Activiti Modeler对后台服务的调用通过Spring MVC方式实 现,所有的Rest资源统一使用注解RestController标 注,所 以在整合到自己项目的时候需要依赖Spring MVC , Modeler模块使用的后台服务都存放在activiti- modeler模块中,在自己的项目中添加依赖:org.activitiactiviti-modeler5. 19. 0 org.activitiactiviti-diagram-rest6. 19.012345678910模块作用:activiti-modeler模块提供模型先关的

6、操作:创建、保存、转换 json 与xml格式等activiti-diagram-rest模块用来处理流程图有关的功能:流程图布局(layout )、节点高亮等准备基础服务类复制文件(hhttps:/github. com/whatlookingfor/workfocus/tree/master/src/main/java/org/activiti/explorer) 里面的 java 文件到自 己项目中。(参考咖啡兔的工作流代码)ActivitiSpring 配置12345678910111213141516171819202122232425262728293031323334353637

7、383940414243Spring MVC 配置仓I建文件 spring-mvc-rest. xml :123456789101112131415web. xml 配置Servlet月艮务在web. xml中配置下面的 ServletModelRestServletorg. springframework, web. servlet. DispatcherServletcontextConfigLocation/WEB-INF/spring-mvc-modeler. xml1ModelRestServlet /service/*12345678910111213添加JSONP的过滤器JSON

8、PFilterorg. activiti. explorer. JsonpCallbackFilterJSONPFilter /*12345678模型设置器web资源的整合直接从 Activiti Explorer中复制文件 modeler, html文件 到src/main/webapp目录即可,该文件会引入定义基本的 布局(div )、引入css以及js文件。修改 editor-app/app-cfg. js文件的contextRoot属性为自 己的应用名称,例如/项目名 /service我个人是在webapp下创建了个activiti的文件夹,然 后一股脑把上面的文件全部扔进去。不一定需

9、要直接 放到webapp下,注意路径即可。模型控制器create方法中在创建完Model后跳转页面为 modeler. html?modelld=当从模型列表编辑某一k个模型时也 需要把路径修改为modeler. html?modelld=如果像我上面放到activiti文件夹下,此处注意需要 修改对应的路径。整合 Activiti Restmaven 依赖org. activiti activiti-rests. 19. 012345activiti 组件包扫描在activiti的Spring配置文件中增加org. activiti.rest.service 包的扫描,具体如下(在上面 已经

10、加了进来,此步骤可以忽 略。):添加Rest安全认证组件package org. activiti. conf;import org. activiti. rest, security. BasicAuthenticationProvider;import org. springframework, context, annotation. Bean; importorg. springframework, context, annotation. Configuration; import org. springframework, security, authentication. Aut

11、henticatio nProvider;importorg. springframework, security, config, annotation, web. builders. HttpSecurity;importorg. springframework, security, config, annotation, web. config uration. EnableWebSecurity;importorg. springframework, security, config, annotation, web. config uration. WebSecurityConfig

12、urerAdapter;importorg. springframework, security, config, annotation, web. servlet. configuration. EnableWebMvcSecurity;import org. springframework, security, config, http. SessionCreation Policy;Configuration EnableWebSecurityEnableWebMvcSecuritypublic class SecurityConfiguration extendsWebSecurity

13、ConfigurerAdapter Beanpublic AuthenticationProvider authenticationprovider()return new BasicAuthenticationProvider();Overrideprotected void configure(HttpSecurity http) throwsException http. authenticationProvider(authenticationprovider() sessionManagement(). sessionCreationPolicy (SessionCreationPo

14、licy. STATELESS). and() csrf (), disable () authorizeRequests() anyRequest(). authenticated() and() httpBasic ();12345678910111213141516171819202122232425262728293031323334Sping mvc配置文件仓ll建文件 spring-mvc-rest. xml :123456789101112131415配置 Servlet 映射RestServlet org. springframework, web. servlet. Disp

15、atcherServletcontextConfigLocation /WEB-INF/spring-mvc-rest. xml1RestServlet/rest/*12345678910111213访问Rest接口现在启动应用可以访问 http:/localhost:8080/your-app/rest/management/propertie s 以 Rest方式查看引擎的属性列表.整合过程中的某些优化去掉Activiti Afresco的logo标题栏,并且把样式上的空 白栏 去掉 修改modeler, html中的以下内容,注意不要把 该文本删除,建议加style= display:n

16、one ”,删除后 其会造成底层下的一些内容有40个像数的东西显示不 出来。 GENERAL. MAIN-TITLEtranslate)1234567在 editor-app/css/style-common, css 中,把以下样式的 padding-top 首B分改为 Opx;.wrapper, full padding: 40px Opx Opx Opx; overflow: hidden;max-width: 100%; min-width: 100%;)123456在modeler, html中加上CloseWindow的函数,默认编辑器关 闭后是加载项目主页的,以下代码是直接关闭该tab页 面。function CloseWindow(action) if (window. CloseOwnerWindow) returnwindow. CloseOwnerWindow(action);else window, close();123456在 edit

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论