当前位置: 首页 > article >正文

Drool 7 SpreadSheet Decision Template 笔记

1 Excel Decision table

1.1 很棒的示意图,来自https://blog.csdn.net/justlpf/article/details/128109731
在这里插入图片描述

1.2 参考URL
1.2.1 https://blog.csdn.net/justlpf/article/details/128109731
1.3 多sheet 模式

  • 默认是用第一个sheet
  • 如果要支持多sheet,需要创建一个同名的.properties文件
    • sheets=Sheet1,Sheet2

1.4 sheet内主要内容
1.4.1 一个RuleSet :注意RuleSet里面的定义都是对package有影响,不仅仅是excel文件
默认package 名就是Ruleset 名称

  • 具体实现代码-final Package ruleset = new Package( (showPackage) ? rulesetName : null );

属性

  • RuleSet
    The package name for the generated DRL file. Optional, the default is rule_table.
  • Sequential
    true or false. If true, then salience is used to ensure that rules fire from the top down.
  • SequentialMaxPriority
    Optional, at most once. In sequential mode, this option is used to set the start value of the salience. If omitted, the default value is 65535.
  • SequentialMinPriorit
    Optional, at most once. In sequential mode, this option is used to check if this minimum salience value is not violated. If omitted, the default value is 0.
  • EscapeQuotes
  • NumericDisabled
    If true, then a String representation is used for DRL instead of a double value from a Numeric cell. It would also skip additional numeric processing for the double value.
  • IgnoreNumericFormat
    If true, then the format for numeric values is ignored
  • Import
    可以多行
  • Variables
    可以多行
  • Functions
    可以多行
  • Queries
    可以多行
  • Declare
    可以多行
  • Unit 实验性,不用
  • Dialect
    java or mvel. The dialect used in the actions of the decision table.

1.4.2 一个或者多个RuleTable

  • 以空行分割多个RuleTable
  • 无论CONDITION/RULE,值为空代表忽略
  • metadata
    • Code snippet and interpolated values for constructing a metadata entry for the rule.
    • 没有google到例子

Properties 和rule 属性差不多,但注意salience 被priority代替

  • PRIORITY An integer defining the salience value of the rule
  • DATE-EFFECTIVE
    Example: DATE-EFFECTIVE “4-Sep-2018”
  • DATE-EXPIRES
  • NO-LOOP
  • AGENDA-GROUP
  • ACTIVATION-GROUP
  • DURATION
  • TIMER
  • CALENDAR
  • AUTO-FOCUS
  • LOCK-ON-ACTIVE
  • RULEFLOW-GROUP

1.5 excel 转换为drl文件的核心类是public class DefaultRuleSheetListener
1.5.1 核心函数buildRuleSet()

2 template

2.1 用途

  • 使用外部存储的变量列表:如数据库、excel 生成drl文件
  • 默认提供了从excel ,对象、list导入数据模式

2.2 相关生成drl的compiler

  • ExternalSpreadsheetCompiler
  • DataProviderCompiler
    可以以DataProviderCompiler为父类,自行定义开发新的compiler
  • ObjectDataCompiler
    • extends DataProviderCompiler
    • 当对象有null值被引用的时候,DefaultGenerator如下代码可能返回空condition
String drl = String.valueOf( TemplateRuntime.execute( template,vars,factory,registry ) );

http://www.kler.cn/news/148467.html

相关文章:

  • SpringBoot 项目中获取 Request 的四种方法
  • [Linux] Linux入门必备的基本指令(不全你打我)
  • 外观设计模式
  • 【双指针】三数之和
  • 设计模式在实际业务中应用 - 模版方法
  • 万媒易发:以RPA自动化和AIGC为基础实现多平台分发
  • modbus协议及modbus TCP协议
  • 类指针压缩空间
  • 【Vue】图片切换
  • 【视觉SLAM十四讲学习笔记】第三讲——四元数
  • 一些关于开关电源经典回答
  • Java面向对象第6天
  • C 标准库 - <stdlib.h>和<string.h>详解
  • 基于mvc的大学生家教信息网站系统php+vue
  • INFINI Gateway 与华为鲲鹏完成产品兼容互认证
  • 5.golang字符串的拆解和拼接
  • 耗时一个星期整理的APP自动化测试工具大全
  • 【网络】传输层 --- 详解TCP协议
  • lv11 嵌入式开发 WDT实验 12
  • C语言:输入10个整数,写一个函数将其中最小的数和第一个数对换,把最大的数和最后一个数对换。(指针)
  • 14 网关实战:网关聚合API文档
  • 基于51单片机冰箱温度控制器设计
  • Sass混合器的详细使用教程
  • squid代理服务器(传统代理、透明代理、反向代理、ACL、日志分析)
  • ESP32-Web-Server编程- JS 基础 3
  • NFS 速度变慢问题排查 性能优化
  • 6、信息收集(1)
  • 23种设计模式之C++实践
  • 构建强大的接口自动化测试框架:Pytest实践指南!
  • 互联网架构演变过程梳理和架构思想的学习