[rules-users] Template salience

Bertrand Grottier b_grottier at hotmail.com
Wed Mar 10 09:01:19 EST 2010


Hello,

Is it possible to specify a template salience such as:

function long getNbJours(String pStrDDeb, String pStrDFin)
{
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    
    Date dDeb = sdf.parse(pStrDDeb) ;
    Date dFin = sdf.parse(pStrDFin) ;

    long diff = dFin.getTime() - dDeb.getTime() ;
    
    return (diff / (24 * 60 * 60 * 1000)) ;
}

template "tarification_produit"

rule "Periode@{row.rowNumber}"
    salience getNbJours("@{ddeb}", "@{dfin}")
    when
        $p : Produit(id == 1, eval( dDeb.before( getDate("@{ddeb}") ) ) )
    then
        $p.setId(2) ; 
        $p.setPrix(@{prix}) ;
        update( $p );        
end
end template

I encounter a java.lang.NullPointerException.

Thank you in advance for your help.

Regards,

Benoît
 		 	   		  
_________________________________________________________________
Hotmail arrive sur votre téléphone ! Compatible Iphone, Windows Phone, Blackberry, …
http://www.messengersurvotremobile.com/?d=Hotmail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100310/3305c7ef/attachment.html 


More information about the rules-users mailing list