Activiti集成Activiti Modeler

article/2025/11/9 16:45:23

 

Activiti6.0.0及以上版本与activiti-modeler的maven引用有冲突,解决方法参考
Activiti6.0.0及以上版本集成Activiti Modeler

1.下载源文件

activiti-5.22.0官方Demo

activiti5.22.0源码

2.copy源文件

  • (一)复制前端文件

解压activiti-5.22.0官方Demo

解压activiti-explorer.war

复制editor-app,diagram-viewer文件夹,以及modele.html到本地项目

  • (2)复制服务端文件

解压activiti5.22.0源码

复制ModelEditorJsonRestResource.java,ModelSaveRestResource.java,StencilsetRestResource.java到控制层文件夹下

3.添加maven引用

<dependency><groupId>org.activiti</groupId><artifactId>activiti-modeler</artifactId><version>5.22.0</version>
</dependency>

4.启动项目,访问modeler页面

http://localhost:8080/modeler.html

这里写图片描述

修改启动类,屏蔽登录功能

@SpringBootApplication
@EnableAutoConfiguration(exclude = {org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.class,org.activiti.spring.boot.SecurityAutoConfiguration.class,
})
public class DemoApplication {public static void main(String[] args) {SpringApplication.run(DemoApplication.class, args);}
}

再次访问modeler页面

这里写图片描述

处理 /activiti-explorer/service/model//json 请求的报错

该请求的控制类为ModelEditorJsonRestResource.java

@RequestMapping(value="/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")

/public/editor-app/app-cfg.js文件中修改请求的地址

ACTIVITI.CONFIG = {//'contextRoot' : '/activiti-explorer/service','contextRoot' : '',
};

再次访问modeler页面

报错GET http://localhost:8080/model//json 404 ()
这是因为我们没有已经建好的model模型,无法查看

5.新建model

测试类

@Controller
@RequestMapping("model")
public class ModelTest {@RequestMapping("create")public void createModel(HttpServletRequest request, HttpServletResponse response){try{String modelName = "modelName";String modelKey = "modelKey";String description = "description";ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();RepositoryService repositoryService = processEngine.getRepositoryService();ObjectMapper objectMapper = new ObjectMapper();ObjectNode editorNode = objectMapper.createObjectNode();editorNode.put("id", "canvas");editorNode.put("resourceId", "canvas");ObjectNode stencilSetNode = objectMapper.createObjectNode();stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");editorNode.put("stencilset", stencilSetNode);Model modelData = repositoryService.newModel();ObjectNode modelObjectNode = objectMapper.createObjectNode();modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, modelName);modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, 1);modelObjectNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, description);modelData.setMetaInfo(modelObjectNode.toString());modelData.setName(modelName);modelData.setKey(modelKey);//保存模型repositoryService.saveModel(modelData);repositoryService.addModelEditorSource(modelData.getId(), editorNode.toString().getBytes("utf-8"));response.sendRedirect(request.getContextPath() + "/modeler.html?modelId=" + modelData.getId());}catch (Exception e){}}}

访问localhost:8080/model/create

这里写图片描述

处理http://localhost:8080/editor/stencilset?version=1523329753442请求的报错

在StencilsetRestResource.java中,我们项目中少了stencilset.json

@RestController
public class StencilsetRestResource {@RequestMapping(value="/editor/stencilset", method = RequestMethod.GET, produces = "application/json;charset=utf-8")public @ResponseBody String getStencilset() {//stencilset.json为Model中的工具栏的名称字符,这里在resources下面查找InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");try {return IOUtils.toString(stencilsetStream, "utf-8");} catch (Exception e) {throw new ActivitiException("Error while loading stencil set", e);}}
}

下载stencilset.json,并放置在resources目录下
再次访问localhost:8080/model/create

6.保存Model

这里写图片描述

处理http://localhost:8080/model/102503/save的报错

修改ModelSaveRestResource.java

@RestController
public class ModelSaveRestResource implements ModelDataJsonConstants {protected static final Logger LOGGER = LoggerFactory.getLogger(ModelSaveRestResource.class);@Autowiredprivate RepositoryService repositoryService;@Autowiredprivate ObjectMapper objectMapper;@RequestMapping(value="/model/{modelId}/save", method = RequestMethod.PUT)@ResponseStatus(value = HttpStatus.OK)public void saveModel(@PathVariable String modelId, String name, String description, String json_xml, String svg_xml) {try {Model model = repositoryService.getModel(modelId);ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());modelJson.put(MODEL_NAME, name);modelJson.put(MODEL_DESCRIPTION, description);model.setMetaInfo(modelJson.toString());model.setName(name);repositoryService.saveModel(model);repositoryService.addModelEditorSource(model.getId(), json_xml.getBytes("utf-8"));InputStream svgStream = new ByteArrayInputStream(svg_xml.getBytes("utf-8"));TranscoderInput input = new TranscoderInput(svgStream);PNGTranscoder transcoder = new PNGTranscoder();// Setup outputByteArrayOutputStream outStream = new ByteArrayOutputStream();TranscoderOutput output = new TranscoderOutput(outStream);// Do the transformationtranscoder.transcode(input, output);final byte[] result = outStream.toByteArray();repositoryService.addModelEditorSourceExtra(model.getId(), result);outStream.close();} catch (Exception e) {LOGGER.error("Error saving model", e);throw new ActivitiException("Error saving model", e);}}
}

再次保存,保存成功。Activiti Modeler集成成功

  • 源码下载

转载自https://blog.csdn.net/h1059141989/article/details/79870043


http://chatgpt.dhexx.cn/article/pgA6l42N.shtml

相关文章

【activiti】activiti入门

activiti入门 在本章内容中&#xff0c;我们来创建一个Activiti工作流&#xff0c;并启动这个流程。 创建Activiti工作流主要包含以下几步&#xff1a; 1、定义流程&#xff0c;按照BPMN的规范&#xff0c;使用流程定义工具&#xff0c;用流程符号把整个流程描述出来 2、部署…

Activiti 介绍

一、工作流 1.工作流 工作流(Workflow)&#xff0c;就是“业务过程的部分或整体在计算机应用环境下的自动化”&#xff0c;它主要解决的是“使在多个参与者之间按照某种预定义的规则传递文档、信息或任务的过程自动进行&#xff0c;从而实现某个预期的业务目标&#xff0c;或…

Vuetify组件中常见的v-slot:activator=“{ on, attrs }“是什么意思?

在使用Vuetify组件时&#xff0c;常看到v-slot:activator"{ on, attrs }"以及插槽中的v-bind"attrs" v-on"on" 例如&#xff1a; 由于之前写代码时少有这种写法而且是第一次遇见&#xff0c;用久了难免想知道是什么意思。因为国内没有相关的问…

Tedddby Activator V5.1,免费绕过iOS 14.7Beta,支持iCloud登录

Tedddby Activator 是一款Windows下绕激活的工具&#xff0c;目前来说也是最好用的一款软件&#xff01; Tedddby Activator官网&#xff1a;https://tedddby.com 支持的功能 GSM两网绕过可以打电话/4G/短信/iCloud登陆/完美重启/消息推送 MEID三网游戏机绕过可以登陆iClou…

Spring Boot Actuator详解与深入应用(一):Actuator 1.x

《Spring Boot Actuator详解与深入应用》预计包括三篇&#xff0c;第一篇重点讲Spring Boot Actuator 1.x的应用与定制端点&#xff1b;第二篇将会对比Spring Boot Actuator 2.x 与1.x的区别&#xff0c;以及应用和定制2.x的端点&#xff1b;第三篇将会介绍Actuator metric指标…

springboot 集成 actuator

简介 spring-actuator做度量统计收集&#xff0c;使用Prometheus&#xff08;普罗米修斯&#xff09;进行数据收集&#xff0c;Grafana&#xff08;增强ui&#xff09;进行数据展示&#xff0c;用于监控生成环境机器的性能指标和业务数据指标。一般&#xff0c;我们叫这样的操作…

Activiti应用

1.介绍 Activiti是一个工作流引擎&#xff0c; activiti可以将业务系统中复杂的业务流程抽取出来&#xff0c;使用专门的建模语言 BPMN2.0进行定义&#xff0c;业务流程按照预先定义的流程进行执行&#xff0c;实现了系统的流程由activiti进行管理&#xff0c;减 少业务系统由…

springboot之Actuator

1、Actuator 介绍 Actuator是Springboot提供的用来对应用系统进行自省和监控的功能模块&#xff0c;借助于Actuator开发者可以很方便地对应用系统某些监控指标进行查看、统计等。 Actuator 的核心是端点 Endpoint&#xff0c;它用来监视应用程序及交互&#xff0c;spring-boo…

ActivitiListener

ActivitiListener 目录概述需求&#xff1a; 设计思路实现思路分析1.ActivitiListener2.Activity3.Gateway5.FieldExtension IOSpecification 参考资料和推荐阅读 Survive by day and develop by night. talk for import biz , show your perfect code,full busy&#xff0c;sk…

SolidWorks2016软件,SW2010-2016.Activator.GUI.SSQ激活闪退解决办法:

SolidWorks2016软件&#xff0c;SW2010-2016.Activator.GUI.SSQ激活闪退解决办法&#xff1a; 解决方案&#xff1a; 原贴&#xff1a; https://xcshare.cn/other/1033.html

Actuator

1&#xff0c;简介 Actuator’ ktʃʊˌeɪtə是 Spring Boot 提供的对应用系统的自省和监控的 集成功能&#xff0c;可以对应用系统进行配置查看、相关功能统计等。在 Spring Cloud 中主要是完成 微服务的监控&#xff0c;完成监控治理。可以查看微服务间的数据处理和调用&…

Spring boot——Actuator 详解

一、什么是 Actuator Spring Boot Actuator 模块提供了生产级别的功能&#xff0c;比如健康检查&#xff0c;审计&#xff0c;指标收集&#xff0c;HTTP 跟踪等&#xff0c;帮助我们监控和管理Spring Boot 应用。 这个模块是一个采集应用内部信息暴露给外部的模块&#xff0c…

Spring Boot Actuator详解

Actuator简介 什么是Spring Boot Actuator&#xff1f; Spring Boot Actuator 模块提供了生产级别的功能&#xff0c;比如健康检查&#xff0c;审计&#xff0c;指标收集&#xff0c;HTTP跟踪等&#xff0c;帮助我们监控和管理Spring Boot应用。这个模块是一个采集应用内部信…

C# 反射之Activator用法举例

概述 程序运行时&#xff0c;通过反射可以得到其它程序集或者自己程序集代码的各种信息&#xff0c;包括类、函数、变量等来实例化它们&#xff0c;执行它们&#xff0c;操作它们&#xff0c;实际上就是获取程序在内存中的映像&#xff0c;然后基于这个映像进行各种操作。 Acti…

将IPA放到服务器提供下载

2015年12月15日 09:45:16 LC_畅 阅读数&#xff1a;3696 &#xff0a; 上传到服务器我们需要两个文件&#xff0c;一个ipa和一个 plist文件 &#xff0a; 注意plist文件和ipa包的名字必须要相同&#xff08;最好取名英文&#xff09; 第一步&#xff1a;把ipa文件放到你们服务…

ipa文件包获取服务器地址,iOS获取App ipa包以及资源文件

要获得线上APP的ipa文件&#xff0c;现在有以下几种方案 1.通过PP助手下载安装到手机的应用 2.通过iTools助手下载安装到手机的应用 3.通过Apple Configurator 2(Mac商店)获取 前两种方案网上的教程很多&#xff0c;这里只介绍第三种方案 首先 去Mac上的App Store下载Apple Con…

AppleStore 原始ipa文件提取

//TODO Apple Configurator 2提取ipa文件_饿到饱的博客-CSDN博客安装Apple Configurator 2从Mac AppStore安装Apple Configurator 2下载ipa打开后连接设备&#xff0c;选中设备点击添加&#xff0c;如果没登录就登录Apple ID&#xff0c;登录后会把你在AppStore下过的应用都列…

获取ipa文件下载链接(appstore下载链接)

获取apptore下载链接 所需工具: 一台越狱的iphone 抓包工具(fiddler或burp等) 步骤 1、ios10以下的版本,越狱之后下载插件ssl kill就可对appstore进行抓包 2、ios11以后的版本,越狱后要想访问appstore还需appstore++插件 3、打开appstore,找到要下载的软件,点击下…

Mac 电脑下载 AppStore 中的 ipa 软件包详细流程

附&#xff1a;iPhone 移除描述文件详细步骤&#xff08;Apple Configurator 2&#xff09; 1、Mac 电脑中安装 Apple Configurator 2 软件。 2、电脑连接手机&#xff0c;并信任&#xff0c;在所有设备中&#xff0c;选中设备&#xff0c;然后点击顶部的加号&#xff0c;选…

关于直接下载第三方IPA应用分发平台之蒲公英的研究

目前基于第三方应用分发的平台比较常用的就属蒲公英、fir等&#xff0c;在我们提交到平台后&#xff0c;我们可以通过扫描应用二维码来下载&#xff0c;比如蒲公英平台如下&#xff1a; 那么以上是非常普通的一个操作过程&#xff0c;问题来了&#xff1a;如何直接在电脑端下载…