[rules-users] Fwd: how to import function in drl file on guvnor

Michael Anstis michael.anstis at gmail.com
Wed Sep 5 05:02:44 EDT 2012


Forwarded to mailing list.

You would have to consider use of free-format DRL in this scenario.

---------- Forwarded message ----------
From: <avneesh.sisodia at intelegencia.com>
Date: 4 September 2012 12:33
Subject: how to import function in drl file on guvnor
To: michael.anstis at gmail.com


Hello mantis,
I am very new in drools and guvnor users. I have a problem during making
rules. I want to use my predefined functions in rule execution.
Suppose I have a rule "companyDivision" and i want to import it into my
rule file like this:

package com.exp.test

import com.abc.bean.CompanyBean
import function
        com.abc.util.Validation.companyDivision;

rule "CompanyInfo"
        dialect "mvel"
        when
                CompanyBean( businessType == "ABC" , insuranceProgram ==
"XYZ" )
        then
                CompanyBean fact0 = new CompanyBean();
                fact0.setBusinessType( "ABC" );
                fact0.setInsuranceProgram( "XYZ" );
                companyDivision(fact0 );
end


How I can do this.
I am doing following steps to c\generate rules::
1. creating com.exp.test package
2. uploading jar(model) file which included all pojo files of application
3. creating "CompanyInfo" rule

rule file generated by guvnor is like this:::

package com.exp.test

import com.abc.bean.CompanyBean


rule "CompanyInfo"
        dialect "mvel"
        when
                CompanyBean( businessType == "ABC" , insuranceProgram ==
"XYZ" )
        then
                CompanyBean fact0 = new CompanyBean();
                fact0.setBusinessType( "ABC" );
                fact0.setInsuranceProgram( "XYZ" );
                insert(fact0 );
end

I have only two options there 1. insert and 2. insert logically.
but on place of insert and insert logically I want to use "companyDivision"
function.
Please guys tell me how it is possible.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120905/d618e33a/attachment.html 


More information about the rules-users mailing list