Search code examples
ewam

Which method to change to expose Business data in ewam?


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.


Solution

  • Ideally data points are added as dynamic data and tied to your rules through configuration. However if you are adding persistent variables to the entire Wynsure implementation you will need to:

    1. Create a Custom rules engine which descends from the main rules engine tied for the relevant rule category i.e. aWLIRuleEngine (for all rules) aWLIClaimRuleEngine (for claims rules) aWLO_LoanRuleEngoine (for loan rules) and so on.
    2. In the new or reimplemented rules engine add a variables to hold for each data point you want to expose. This should match the business variable in type.
    3. Add a Second Boolean variable to track whether or not the the first variable has been loaded or not.
    4. Create a function to retrieve the data from the Wynsure business class and copy that data to the rules engine place holder (and change the boolean to verify this had been done).
    5. Override the Proc that declares all the the retrieval functions (inherit all previous versions in the parents then append your own).
    6. Override your Main business object to use your custom rules engine instead of the original client.

    Example: We have a city code that is used in a particular implementation of Wynsure. This project is Individual life and the client would like to make available to all the rules engines that deal with their life projects. We need to override the Rules engine class, and the individual product class:

    ; 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