我需要创建一个新的业务数据,需要在规则中公开和使用。我有逻辑和代码。
答案 0 :(得分:1)
理想情况下,数据点会作为动态数据添加,并通过配置与您的规则相关联。但是,如果要将持久变量添加到整个Wynsure实现中,则需要:
示例:我们有一个城市代码,用于Wynsure的特定实现。这个项目是个人生活,客户希望提供所有处理他们生活项目的规则引擎。我们需要覆盖Rules引擎类和单个产品类:
; 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