I need to create a new business data which needs to be exposed and used in the Rule. I have the logic and code with me.
问问题
51 次
1 回答
1
理想情况下,数据点作为动态数据添加并通过配置绑定到您的规则。但是,如果要向整个 Wynsure 实现添加持久变量,则需要:
- 创建一个自定义规则引擎,该引擎源自与相关规则类别相关的主规则引擎,即 aWLIRuleEngine(适用于所有规则)aWLIClaimRuleEngine(适用于索赔规则)aWLO_LoanRuleEngoine(适用于贷款规则)等等。
- 在新的或重新实现的规则引擎中,为要公开的每个数据点添加一个变量来保存。这应该与类型中的业务变量匹配。
- 添加第二个布尔变量以跟踪第一个变量是否已加载。
- 创建一个函数以从 Wynsure 业务类中检索数据并将该数据复制到规则引擎占位符(并更改布尔值以验证这已完成)。
- 覆盖声明所有检索函数的 Proc(继承父级中的所有先前版本,然后附加您自己的)。
- 覆盖您的主要业务对象以使用您的自定义规则引擎而不是原始客户端。
示例:我们有一个用于 Wynsure 特定实现的城市代码。该项目是个人生活,客户希望向处理其生活项目的所有规则引擎提供。我们需要覆盖规则引擎类和单个产品类:
; aCUS_RuleEngine (aWLIRuleEngine) (Def Version:2) (Implem Version:3)
uses CUS_Types, aWLIContract, aListOfInstances, aMethodDesc
memory Master : aCUS_RuleEngine override
v_Subscriber__TrinCityCode : tCUS_ParishDynamicEnum
Subscriber__TrinCodeUpdated : Boolean
v_Subscriber__TriniID : CString
Subscriber__TriniIDUpdated : Boolean
function Subscriber__TriniID return CString
uses aCUS_Person
if self.Master <> Nil
return self.Master.Subscriber__TriniID
else
if not self.Subscriber__TriniIDUpdated and not self.Test
self.v_Subscriber__TriniID = aCUS_Person(self.ForContract.Subscriber).IDNumber
self.Subscriber__TriniIDUpdated = True
endIf
return self.v_Subscriber__TriniID
endIf
endFunc
function Subscriber__TrinCityCode return tCUS_ParishDynamicEnum
uses aCUS_Person
if self.Master <> Nil
return self.Master.Subscriber__TrinCityCode
else
if not self.Subscriber__TrinCodeUpdated and not self.Test
self.v_Subscriber__TrinCityCode = aCUS_Person(self.ForContract.Subscriber).BirthParish
self.Subscriber__TrinCodeUpdated = True
endIf
return self.v_Subscriber__TrinCityCode
endIf
endFunc
procedure DeclareSubscriberAsPersonBusinessFunctions(List : aListOfInstances) override
inherited self.DeclareSubscriberAsPersonBusinessFunctions(List)
List.AppendObject(MetaModelEntity(self.Subscriber__TrinCityCode))
List.AppendObject(MetaModelEntity(self.Subscriber__TriniID))
endProc
; aCUS_LifeIndividualProduct (aWLI_LifeIndividualProduct) (Def Version:3) (Implem Version:4)
uses aCUS_IndividualCoverage, aClassDef
Options : listOf [O] aCUS_IndividualCoverage inverse MyOwner override
function RuleEngineClassDef return aClassDef override
uses aCUS_RuleEngine
_Result = MetaModelEntity(aCUS_RuleEngine)
endFunc
于 2017-09-25T19:06:27.140 回答