Load Drools Guided Decision Table to Java List/Map

231 views Asked by At

Hi I was wondering if there is a way to load all the content of the guided decision table to java collection (list/map)? I achieved this by making each rule(row) calling a java method where I add this to a hashmap but performance-wise is really bad I was wondering if there is a better way to do so. Thanks in advance!

Guided Desion Table

[![enter image description here]

   package MyPkg;

import com.abc.por.model.Bborder;
import com.abc.por.utils.BborderUtil;
import com.abc.por.utils.MyUtil;
import com.abc.por.model.constants.FE;

//from row number: 1
//PRE_Regression
rule "Row 1 HPDT"
    @RuleName(OnlyOnePharmacy)
    no-loop true
    lock-on-active true
    ruleflow-group "HighPayer"
    dialect "mvel"
    when
        borderUtil : BborderUtil( )
        Bborder( src : src == "SPECIAL" )
        border : Bborder( requestDateTime >= "24-Dec-2020" , requestDateTime < "03-May-2022" )
    then
        MyUtil myUtil = new MyUtil();
        myUtil.setPlanCode( "RGC" );
        myUtil.setPlanType( "RGC" );
        myUtil.setFeIndicator( "NO" );
        myUtil.setPharmacies( "RED" );
        insert( myUtil );
        modify( borderUtil ) {
                setRuleFired( true )
        }
        borderUtil.populateDrugDataToMap( null, myUtil, border );
        retract( myUtil);
end

//from row number: 2
//PRE_Regression
rule "Row 2 HPDT"
    @RuleName(SinglePharmacy)
    no-loop true
    lock-on-active true
    ruleflow-group "HighPayer"
    dialect "mvel"
    when
        borderUtil : BborderUtil( )
        Bborder( src : src == "SPECIAL" )
        border : Bborder( requestDateTime >= "24-Dec-2020" )
    then
        MyUtil myUtil = new MyUtil();
        myUtil.setPlanCode( "RGA" );
        myUtil.setPlanType( "RGA" );
        myUtil.setFeIndicator( "NO" );
        myUtil.setPharmacies( "MPT,RED" );
        insert( myUtil );
        modify( borderUtil ) {
                setRuleFired( true )
        }
        borderUtil.populateDrugDataToMap( null, myUtil, border );
        retract( myUtil);
end

//from row number: 3
//PRE_Regression
rule "Row 3 HPDT"
    @RuleName(FE=BE)
    no-loop true
    lock-on-active true
    ruleflow-group "HighPayer"
    dialect "mvel"
    when
        borderUtil : BborderUtil( )
        Bborder( src : src == "SPECIAL" )
        border : Bborder( requestDateTime >= "24-Dec-2020" )
    then
        MyUtil myUtil = new MyUtil();
        myUtil.setPlanCode( "RGB" );
        myUtil.setPlanType( "RGB" );
        myUtil.setFeIndicator( "YES" );
        myUtil.setPharmacies( "MPT,RED" );
        insert( myUtil );
        modify( borderUtil ) {
                setRuleFired( true )
        }
        borderUtil.populateDrugDataToMap( null, myUtil, border );
        retract( myUtil);
end
0

There are 0 answers