04 flowable DMN规则引擎几种类型解释
项目地址:https://gitee.com/lwj/flowable.git 分支flowable-base
视频地址:https://www.bilibili.com/video/av79774697/
*业务场景:
往往在我们实际业务中,规则异常重要,比方说输入一批数据得到某些结果数据,从而来简化我们的BPMN流程图,
*
flowableDMN规则引擎几种类型解释
- 单一命中
- 第一个(FIRST)
- 唯一(UNIQUE)
- 优先级(PRIORITY)
- 任何(ANY)
- 多重命中
- 输出顺序(OUTPUT ORDER)
- 规则顺序(RULE ORDER)
- 采集(COLLECT)
单一命中
第一个(FIRST)
可以匹配多个(重叠)具有不同输出条目的规则。返回规则顺序中的第一次命中(返回后停止评估)。
唯一(UNIQUE)
没有重叠的可能,所有规则都是互斥的。只能匹配到一条规则。
如果多个会报错
可以利用设置解决这个问题
dmnEngine.getDmnEngineConfiguration().setStrictMode(false);
优先级(PRIORITY)
具有不同的输出条目的多个规则可以匹配。此策略返回具有最高输出优先级的匹配规则。输出优先级在输出值的有序列表中按优先级递减的顺序指定。当禁用strict mode且未定义输出值时,结果是最后一个有效规则。(违规将以验证消息的形式出现)
任何(ANY)
可能会有重叠,但如果所有匹配规则显示每个输出的输出条目相等,就可以使用任何匹配。如果输出条目不相等,则命中策略不正确,结果将为空并标记为failed。当禁用strict mode时,结果是最后一个有效规则。(违规将以验证消息的形式出现)
多重命中
输出顺序(OUTPUT ORDER)
按输出优先级递减的顺序返回所有命中规则。输出优先级在输出值的有序列表中按优先级递减的顺序指定。
规则顺序(RULE ORDER)
按规则顺序返回所有命中。
1、叠加变量
${output1 + 10}
2、包含 任意都在
输入:
List inputVariable1 = Arrays.asList("test1", "test2", "test3");
processVariablesInput.put("collection1", inputVariable1);
输出:
test2 or test5 in collection1
${collection:containsAny(collection1, '"test2", "test5"')}
3、传入对象
输入:
Person customerOne = new Person();
customerOne.setName("test1");
customerOne.setAge(10L);
processVariablesInput.put("customerOne", customerOne);
输出:${collection:contains("test1", customerOne.name)}
4、json传入匹配 IN 两个并且都在
输入:
ArrayNode arrayNode1 = objectMapper.createArrayNode().add("test1").add("test2").add("test3");
processVariablesInput.put("arrayNode1", arrayNode1);
输出:"test1 and test2 in arrayNode1"
${collection:contains(arrayNode1, '"test1", "test2"')}
5、不包含 任意都不在
传入:
List inputVariable1 = Arrays.asList("test1", "test2", "test3");
processVariablesInput.put("collection1", inputVariable1);
表达式:test3 and / or test6 not in collection1
${collection:notContainsAny(collection1, '"test3", "test6"')}
6、不包含 not in 两个并且都不在
输入:
List inputVariable1 = Arrays.asList("test1", "test2", "test3");
processVariablesInput.put("collection1", inputVariable1);
输出:
test3 and test5 not in collection1
${collection:notContains(collection1, '"test3", "test5"')}
1、叠加变量
${output1 + 10}
2、包含 任意都在
输入:
List inputVariable1 = Arrays.asList(“test1”, “test2”, “test3”);
processVariablesInput.put(“collection1”, inputVariable1);
输出:
test2 or test5 in collection1
collection:containsAny(collection1,′"test2","test5"′)3、传入对象输入:PersoncustomerOne=newPerson();customerOne.setName("test1");customerOne.setAge(10L);processVariablesInput.put("customerOne",customerOne);输出:{collection:containsAny(collection1, '"test2", "test5"')} 3、传入对象 输入: Person customerOne = new Person(); customerOne.setName("test1"); customerOne.setAge(10L); processVariablesInput.put("customerOne", customerOne); 输出:collection:containsAny(collection1,′"test2","test5"′)3、传入对象输入:PersoncustomerOne=newPerson();customerOne.setName("test1");customerOne.setAge(10L);processVariablesInput.put("customerOne",customerOne);输出:{collection:contains(“test1”, customerOne.name)}
4、json传入匹配 IN 两个并且都在
输入:
ArrayNode arrayNode1 = objectMapper.createArrayNode().add(“test1”).add(“test2”).add(“test3”);
processVariablesInput.put(“arrayNode1”, arrayNode1);
输出:“test1 and test2 in arrayNode1”
${collection:contains(arrayNode1, ‘“test1”, “test2”’)}
5、不包含 任意都不在
传入:
List inputVariable1 = Arrays.asList(“test1”, “test2”, “test3”);
processVariablesInput.put(“collection1”, inputVariable1);
表达式:test3 and / or test6 not in collection1
${collection:notContainsAny(collection1, ‘“test3”, “test6”’)}
6、不包含 not in 两个并且都不在
输入:
List inputVariable1 = Arrays.asList(“test1”, “test2”, “test3”);
processVariablesInput.put(“collection1”, inputVariable1);
输出:
test3 and test5 not in collection1
${collection:notContains(collection1, ‘“test3”, “test5”’)}
1、叠加变量
${output1 + 10}
2、包含 任意都在
输入:
List inputVariable1 = Arrays.asList(“test1”, “test2”, “test3”);
processVariablesInput.put(“collection1”, inputVariable1);
输出:
test2 or test5 in collection1
collection:containsAny(collection1,′"test2","test5"′)3、传入对象输入:PersoncustomerOne=newPerson();customerOne.setName("test1");customerOne.setAge(10L);processVariablesInput.put("customerOne",customerOne);输出:{collection:containsAny(collection1, '"test2", "test5"')} 3、传入对象 输入: Person customerOne = new Person(); customerOne.setName("test1"); customerOne.setAge(10L); processVariablesInput.put("customerOne", customerOne); 输出:collection:containsAny(collection1,′"test2","test5"′)3、传入对象输入:PersoncustomerOne=newPerson();customerOne.setName("test1");customerOne.setAge(10L);processVariablesInput.put("customerOne",customerOne);输出:{collection:contains(“test1”, customerOne.name)}
4、json传入匹配 IN 两个并且都在
输入:
ArrayNode arrayNode1 = objectMapper.createArrayNode().add(“test1”).add(“test2”).add(“test3”);
processVariablesInput.put(“arrayNode1”, arrayNode1);
输出:“test1 and test2 in arrayNode1”
${collection:contains(arrayNode1, ‘“test1”, “test2”’)}
5、不包含 任意都不在
传入:
List inputVariable1 = Arrays.asList(“test1”, “test2”, “test3”);
processVariablesInput.put(“collection1”, inputVariable1);
表达式:test3 and / or test6 not in collection1
${collection:notContainsAny(collection1, ‘“test3”, “test6”’)}
6、不包含 not in 两个并且都不在
输入:
List inputVariable1 = Arrays.asList(“test1”, “test2”, “test3”);
processVariablesInput.put(“collection1”, inputVariable1);
输出:
test3 and test5 not in collection1
${collection:notContains(collection1, ‘“test3”, “test5”’)}
采集(COLLECT)
以任意顺序返回所有命中。我们可以添加运算符(+,<,>,#)来将一个简单函数应用于输出。如果没有运算符,则结果是所有输出条目的列表。
+(总和):决策表的结果是所有不同输出的总和。
<(最小值):决策表的结果是所有输出中的最小值。
‘>(最大值):决策表的结果是所有输出中的最大值。
#(计数):决策表的结果是不同输出的数量。
04 flowable DMN规则引擎几种类型解释相关推荐
- flowable DMN规则引擎几种类型解释_04
文章目录 单一命中 第一个(FIRST) 唯一(UNIQUE) 优先级(PRIORITY) 任何(ANY) 多重命中 输出顺序(OUTPUT ORDER) 规则顺序(RULE ORDER) 采集(CO ...
- drools规则引擎可视化_一文看懂开源工作流引擎 Flowable「转」
原文链接:[https://xie.infoq.cn/article/ece75889c715e0bc87a73e44c]. 一.工作流引擎使用场景 工作流在企业管理系统中是高频使用的功能,一个最常见 ...
- flowable dmn引擎
原文地址:flowable dmn引擎 http://www.shareniu.com/ 在Flowable版本发布后,Flowable框架开始实现DMN规范,换言之,Flowable正在实现自己的规 ...
- 并发编程-04线程安全性之原子性Atomic包的4种类型详解
文章目录 线程安全性文章索引 脑图 概述 原子更新基本类型 Demo AtomicBoolean 场景举例 原子更新数组 Demo 原子更新引用类型 Demo 原子更新字段类型 使用注意事项: Dem ...
- 规则引擎和流程引擎我该怎么理解
流程引擎 什么是流程引擎 流程引擎就是"业务过程的部分或整体在计算机应用环境下的自动化",它主要解决的是"使在多个参与者之间按照某种预定义的规则传递文档.信息或任务的过程 ...
- 规则引擎drools系列(一)
规则引擎 Drools 1. 问题引出 现有一个在线申请信用卡的业务场景,用户需要录入个人信息,如下图所示: //此处为伪代码 //检查用户信息合法性,返回true表示检查通过,返回false表示 ...
- 开源规则引擎——ice:致力于解决灵活繁复的硬编码问题
背景介绍 业务中是否写了大量的 if-else?是否受够了这些 if-else 还要经常变动? 业务中是否做了大量抽象,发现新的业务场景还是用不上? 是否各种调研规则引擎,发现不是太重就是接入或维护太 ...
- 【转】什么是规则引擎(Drools、OpenL Tablets、Easy Rules、RuleBook)
什么是规则引擎(Drools.OpenL Tablets.Easy Rules.RuleBook) 发表于:2021年1月23日 分类:Drools, 规则引擎 标签:Drools, Easy-Rul ...
- 规则引擎JBoss Drools简介
一.简介 项目官网:Drools - Drools - Business Rules Management System (Java™, Open Source) 源码:GitHub - kiegro ...
最新文章
- 让word不显示计算机名作者,如何使word在其他电脑上也不显示回车符
- windows10 中 安装 ffmpeg
- 打造完全绿色的TOTAL COMMANDER
- buuctf N种方法解决
- 英特尔核芯显卡控制面板怎么找不到_【全球首发】英特尔第十代Cometlake台式机处理器详解与评测...
- 【15】万魂杀服务器开发之原始NIO、Mina、Netty使用
- UltraEdit脱机注册免费使用版本
- android Rect
- 电脑文件误删除如何恢复?
- modelsim与debussy的联合仿真
- java工程师怎么找兼职,快来看鸭~
- BitComet的简介与下载
- 马云的江湖 史玉柱的兵法
- 华为手机助手 无法访问服务器,EMUI4.X手机及windowsXP系统无法正常使用华为手机助手问题...
- chemistry 原子核
- android 4.3 nfc,nfc读卡在android 4.4以上与4.4以下写法的区别
- oh-my-zsh配置 alias 指定指令别名
- KVM is required to run this AVD /dev/kvm permission denied Ubuntu Android Studio
- php获取用户豆瓣电影,用来获取豆瓣网上电影信息的简介
- 第四方聚合支付系统源码PHP版