[rules-users] TypeCasting in BusinessRule

Vinoth Kumar Somasundaram vinoth.k at technologiaworld.com
Tue Aug 26 07:53:07 EDT 2008


Hi All,

 

I have used drools-jbrms.war and drools-guvnor.war. I facing a Problem
in both.

 

I have a package called Rating which has the following source.

 

'Rule 1' is Business-Rule; 'Rule 2' is a Technical-Rule(DRL).

 

------------------------------------------------------------------------
--------------------------------

 

package rating

 

import com.esspl.ic.dom.CallDetail;

import com.esspl.ic.dom.ICConstants;

import com.esspl.ic.dom.RateDetail;

import java.util.Map;

import java.lang.String;

 

global Map rateCache;

 

 

rule "Rule 1"

      dialect "mvel"

      when

            cd : CallDetail( callType == "VOICE" )

      then

            cd.setRate( cd.getCallDuration()  *  ((RateDetail)
rateCache.get("VOICE")).getRate()  );

end

 

 

rule "Rule 2"

      when

            cd : CallDetail( callType == "SMS")

      then        

            cd.setRate(cd.getCallDuration()  *  ((RateDetail)
rateCache.get("SMS")).getRate() );

            End

 

------------------------------------------------------------------------
---------------------------------

 

 

Rule 2 Compiles fine but Rule 1 does not.

It seems there is a Problem in compiling a BusinessRule. The Business
Rule Compiler doesn't support Typecasting. Whereas the Technical rule
compiler supports type casting.

 

I have to make all my rules as Business Rules. But it doesn't get
compiled.

Can anyone help me get rid of this problem.

 

 

Thanks in Advance,

 

Vinoth

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080826/4d456985/attachment.html 


More information about the rules-users mailing list