使用flowable 6.1.2 REST API 运行请假审批流程

2024-03-20 23:18

本文主要是介绍使用flowable 6.1.2 REST API 运行请假审批流程,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

一、下载 flowable rest war 包

http://download.csdn.net/detail/teamlet/9913312

二、部署

复制flowable REST.war到Tomcat 7.0.64 webapps下。

三、自定义回调

将上一章的java org.flowable.CallExternalSystemDelegate 打包成jar,复制到tomcat flowabe-rest/WEB-INF/lib 中。

四、启动

cd /apache-tomcat-7.0.64
./bin/startup.sh

五、以curl 方式调用 REST API

1、验证引擎安装正确

curl --user kermit:kermit http://localhost:8080/flowable-rest/service/management/engine

返回

{"name":"default","resourceUrl":null,"exception":null,"version":"6.1.2.0"}

2、部署流程定义

将上篇文章中的 holiday-request.bpmn20.xml 放到当前cUrl执行的路径下,执行:

curl --user kermit:kermit -F "file=@holiday-request.bpmn20.xml" http://localhost:8080/flowable-rest/service/repository/deployments

返回

{"id":"27","name":"holiday-request","deploymentTime":"2017-07-28T09:03:00.305+08:00","category":null,"url":"http://localhost:8080/flowable-rest/service/repository/deployments/27","tenantId":""}

3、验证流程部署正确

curl --user kermit:kermit http://localhost:8080/flowable-rest/service/repository/process-definitions

返回

{"data":[{"id":"createTimersProcess:1:23","url":"http://localhost:8080/flowable-rest/service/repository/process-definitions/createTimersProcess:1:23","key":"createTimersProcess","version":1,"name":"Create timers process","description":"Test process to create a number of timers.","tenantId":"","deploymentId":"7","deploymentUrl":"http://localhost:8080/flowable-rest/service/repository/deployments/7","resource":"http://localhost:8080/flowable-rest/service/repository/deployments/7/resources/createTimersProcess.bpmn20.xml","diagramResource":null,"category":"Examples","graphicalNotationDefined":false,"suspended":false,"startFormDefined":false},{"id":"oneTaskProcess:1:22","url":"http://localhost:8080/flowable-rest/service/repository/process-definitions/oneTaskProcess:1:22","key":"oneTaskProcess","version":1,"name":"Famous One Task Process","description":null,"tenantId":"","deploymentId":"7","deploymentUrl":"http://localhost:8080/flowable-rest/service/repository/deployments/7","resource":"http://localhost:8080/flowable-rest/service/repository/deployments/7/resources/oneTaskProcess.bpmn20.xml","diagramResource":null,"category":"Examples","graphicalNotationDefined":false,"suspended":false,"startFormDefined":false},{"id":"fixSystemFailure:1:19","url":"http://localhost:8080/flowable-rest/service/repository/process-definitions/fixSystemFailure:1:19","key":"fixSystemFailure","version":1,"name":"Fix system failure","description":null,"tenantId":"","deploymentId":"7","deploymentUrl":"http://localhost:8080/flowable-rest/service/repository/deployments/7","resource":"http://localhost:8080/flowable-rest/service/repository/deployments/7/resources/FixSystemFailureProcess.bpmn20.xml","diagramResource":"http://localhost:8080/flowable-rest/service/repository/deployments/7/resources/FixSystemFailureProcess.png","category":"Examples","graphicalNotationDefined":false,"suspended":false,"startFormDefined":false},{"id":"escalationExample:1:21","url":"http://localhost:8080/flowable-rest/service/repository/process-definitions/escalationExample:1:21","key":"escalationExample","version":1,"name":"Helpdesk process","description":null,"tenantId":"","deploymentId":"7","deploymentUrl":"http://localhost:8080/flowable-rest/service/repository/deployments/7","resource":"http://localhost:8080/flowable-rest/service/repository/deployments/7/resources/Helpdesk.bpmn20.xml","diagramResource":"http://localhost:8080/flowable-rest/service/repository/deployments/7/resources/Helpdesk.png","category":"Examples","graphicalNotationDefined":false,"suspended":false,"startFormDefined":false},{"id":"holidayRequest:1:29","url":"http://localhost:8080/flowable-rest/service/repository/process-definitions/holidayRequest:1:29","key":"holidayRequest","version":1,"name":"Holiday Request","description":null,"tenantId":"","deploymentId":"27","deploymentUrl":"http://localhost:8080/flowable-rest/service/repository/deployments/27","resource":"http://localhost:8080/flowable-rest/service/repository/deployments/27/resources/holiday-request.bpmn20.xml","diagramResource":null,"category":"http://www.flowable.org/processdef","graphicalNotationDefined":false,"suspended":false,"startFormDefined":false},{"id":"reviewSaledLead:1:20","url":"http://localhost:8080/flowable-rest/service/repository/process-definitions/reviewSaledLead:1:20","key":"reviewSaledLead","version":1,"name":"Review sales lead","description":null,"tenantId":"","deploymentId":"7","deploymentUrl":"http://localhost:8080/flowable-rest/service/repository/deployments/7","resource":"http://localhost:8080/flowable-rest/service/repository/deployments/7/resources/reviewSalesLead.bpmn20.xml","diagramResource":"http://localhost:8080/flowable-rest/service/repository/deployments/7/resources/reviewSalesLead.reviewSaledLead.png","category":"Examples","graphicalNotationDefined":true,"suspended":false,"startFormDefined":false},{"id":"vacationRequest:1:18","url":"http://localhost:8080/flowable-rest/service/repository/process-definitions/vacationRequest:1:18","key":"vacationRequest","version":1,"name":"Vacation request","description":null,"tenantId":"","deploymentId":"7","deploymentUrl":"http://localhost:8080/flowable-rest/service/repository/deployments/7","resource":"http://localhost:8080/flowable-rest/service/repository/deployments/7/resources/VacationRequest.bpmn20.xml","diagramResource":"http://localhost:8080/flowable-rest/service/repository/deployments/7/resources/VacationRequest.png","category":"http://activiti.org/bpmn20","graphicalNotationDefined":false,"suspended":false,"startFormDefined":false}],"total":7,"start":0,"sort":"name","order":"asc","size":7}

4、启动流程

curl --user kermit:kermit -H "Content-Type: application/json" -X POST -d '{ "processDefinitionKey":"holidayRequest", "variables": [ { "name":"employee", "value": "John Doe" }, { "name":"nrOfHolidays", "value": 7 }]}' http://localhost:8080/flowable-rest/service/runtime/process-instances

返回

{"id":"30","url":"http://localhost:8080/flowable-rest/service/runtime/process-instances/30","businessKey":null,"suspended":false,"ended":false,"processDefinitionId":"holidayRequest:1:29","processDefinitionUrl":"http://localhost:8080/flowable-rest/service/repository/process-definitions/holidayRequest:1:29","activityId":null,"variables":[],"tenantId":"","completed":false}

5、查看任务列表

curl --user kermit:kermit -H "Content-Type: application/json" -X POST -d '{ "candidateGroup" : "managers" }' http://localhost:8080/flowable-rest/service/query/tasks

返回

{"data":[{"id":"39","url":"http://localhost:8080/flowable-rest/service/runtime/tasks/39","owner":null,"assignee":null,"delegationState":null,"name":"Approve or reject request","description":null,"createTime":"2017-07-28T09:03:51.993+08:00","dueDate":null,"priority":50,"suspended":false,"taskDefinitionKey":"approveTask","tenantId":"","category":null,"formKey":null,"parentTaskId":null,"parentTaskUrl":null,"executionId":"36","executionUrl":"http://localhost:8080/flowable-rest/service/runtime/executions/36","processInstanceId":"30","processInstanceUrl":"http://localhost:8080/flowable-rest/service/runtime/process-instances/30","processDefinitionId":"holidayRequest:1:29","processDefinitionUrl":"http://localhost:8080/flowable-rest/service/repository/process-definitions/holidayRequest:1:29","variables":[]}],"total":1,"start":0,"sort":"id","order":"asc","size":1}

6、完成审批

注意:参数重的 39是上面查看任务列表中的 id 值,不同的运行实例这个参数可能会变化。

curl --user kermit:kermit -H "Contes" : [ { "name" : "approved", "value" : true} ]  }' http://localhost:8080/flowable-rest/service/runtime/tasks/39

tomcat终端输出

Calling the external system for employee John Doe

这篇关于使用flowable 6.1.2 REST API 运行请假审批流程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/831063

相关文章

Security OAuth2 单点登录流程

单点登录(英语:Single sign-on,缩写为 SSO),又译为单一签入,一种对于许多相互关连,但是又是各自独立的软件系统,提供访问控制的属性。当拥有这项属性时,当用户登录时,就可以获取所有系统的访问权限,不用对每个单一系统都逐一登录。这项功能通常是以轻型目录访问协议(LDAP)来实现,在服务器上会将用户信息存储到LDAP数据库中。相同的,单一注销(single sign-off)就是指

Spring Security基于数据库验证流程详解

Spring Security 校验流程图 相关解释说明(认真看哦) AbstractAuthenticationProcessingFilter 抽象类 /*** 调用 #requiresAuthentication(HttpServletRequest, HttpServletResponse) 决定是否需要进行验证操作。* 如果需要验证,则会调用 #attemptAuthentica

中文分词jieba库的使用与实景应用(一)

知识星球:https://articles.zsxq.com/id_fxvgc803qmr2.html 目录 一.定义: 精确模式(默认模式): 全模式: 搜索引擎模式: paddle 模式(基于深度学习的分词模式): 二 自定义词典 三.文本解析   调整词出现的频率 四. 关键词提取 A. 基于TF-IDF算法的关键词提取 B. 基于TextRank算法的关键词提取

使用SecondaryNameNode恢复NameNode的数据

1)需求: NameNode进程挂了并且存储的数据也丢失了,如何恢复NameNode 此种方式恢复的数据可能存在小部分数据的丢失。 2)故障模拟 (1)kill -9 NameNode进程 [lytfly@hadoop102 current]$ kill -9 19886 (2)删除NameNode存储的数据(/opt/module/hadoop-3.1.4/data/tmp/dfs/na

Hadoop数据压缩使用介绍

一、压缩原则 (1)运算密集型的Job,少用压缩 (2)IO密集型的Job,多用压缩 二、压缩算法比较 三、压缩位置选择 四、压缩参数配置 1)为了支持多种压缩/解压缩算法,Hadoop引入了编码/解码器 2)要在Hadoop中启用压缩,可以配置如下参数

Makefile简明使用教程

文章目录 规则makefile文件的基本语法:加在命令前的特殊符号:.PHONY伪目标: Makefilev1 直观写法v2 加上中间过程v3 伪目标v4 变量 make 选项-f-n-C Make 是一种流行的构建工具,常用于将源代码转换成可执行文件或者其他形式的输出文件(如库文件、文档等)。Make 可以自动化地执行编译、链接等一系列操作。 规则 makefile文件

如何用Docker运行Django项目

本章教程,介绍如何用Docker创建一个Django,并运行能够访问。 一、拉取镜像 这里我们使用python3.11版本的docker镜像 docker pull python:3.11 二、运行容器 这里我们将容器内部的8080端口,映射到宿主机的80端口上。 docker run -itd --name python311 -p

使用opencv优化图片(画面变清晰)

文章目录 需求影响照片清晰度的因素 实现降噪测试代码 锐化空间锐化Unsharp Masking频率域锐化对比测试 对比度增强常用算法对比测试 需求 对图像进行优化,使其看起来更清晰,同时保持尺寸不变,通常涉及到图像处理技术如锐化、降噪、对比度增强等 影响照片清晰度的因素 影响照片清晰度的因素有很多,主要可以从以下几个方面来分析 1. 拍摄设备 相机传感器:相机传

pdfmake生成pdf的使用

实际项目中有时会有根据填写的表单数据或者其他格式的数据,将数据自动填充到pdf文件中根据固定模板生成pdf文件的需求 文章目录 利用pdfmake生成pdf文件1.下载安装pdfmake第三方包2.封装生成pdf文件的共用配置3.生成pdf文件的文件模板内容4.调用方法生成pdf 利用pdfmake生成pdf文件 1.下载安装pdfmake第三方包 npm i pdfma

零基础学习Redis(10) -- zset类型命令使用

zset是有序集合,内部除了存储元素外,还会存储一个score,存储在zset中的元素会按照score的大小升序排列,不同元素的score可以重复,score相同的元素会按照元素的字典序排列。 1. zset常用命令 1.1 zadd  zadd key [NX | XX] [GT | LT]   [CH] [INCR] score member [score member ...]