【问题标题】:How to determine if an object is an instance of a certain class in IBM Rules Designer/ODM?如何确定对象是否是 IBM Rules Designer/ODM 中某个类的实例?
【发布时间】:2018-05-21 02:07:48
【问题描述】:

这可能是一个简单的方法,但我还没有找到一种简单的方法来确定在规则中由实现的接口表示的工作内存中的对象是 IBM Rules Designer 8.8.1 中的特定类。例如,假设HousingPeriod 是一个接口,如果我有一个声明:

definitions
    set 'the housing period' to a housing period...

然后我想用where 子句进一步细化实现HousingPeriod 作为实现类列表之一的对象集合,比如CollegeHousingPeriodInternshipHousingPeriod,我怎么能这样做?比如:

        where this housing period is a college housing period

        where any of the following is true:
            - this housing period is a college housing period
            - this housing period is an internship housing period,

似乎不起作用。提前感谢您提供的任何帮助!

【问题讨论】:

    标签: rules rule-engine business-rules jrules ibm-odm


    【解决方案1】:

    据我所知,没有内置方法可以查询对象的类型。相反,我看到了两种可能的方法来获得所需的结果:

    为每个实现类创建一个带有自定义 B2X 映射的虚拟 BOM 条目。在 B2X-Mapping 中,您实现必要的 Java 代码来比较对象类型并返回一个布尔值。语言化类似于{1} is a college housing period。这显然只有在您以前知道对象并且对象不多的情况下才有效。

    选项二是不创建不同的对象,而是使用单独的属性来区分住房周期类型。然后,语言化将类似于where the type of this housing period is college housing。使用这种方法,您必须更改规则项目的界面,这对您来说可能是不可能的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-16
      • 2012-01-21
      • 2013-01-12
      • 2015-08-03
      • 1970-01-01
      • 2015-07-24
      • 1970-01-01
      相关资源
      最近更新 更多