[jboss-jira] [JBoss JIRA] Updated: (JBRULES-2123) issue with the call of a drl function

Geoffrey De Smet (JIRA) jira-events at lists.jboss.org
Sun Sep 25 04:04:48 EDT 2011


     [ https://issues.jboss.org/browse/JBRULES-2123?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Geoffrey De Smet updated JBRULES-2123:
--------------------------------------

    Fix Version/s: 5.3.0.Final
                       (was: 5.3.0.CR1)


> issue with the call of a drl function
> -------------------------------------
>
>                 Key: JBRULES-2123
>                 URL: https://issues.jboss.org/browse/JBRULES-2123
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-core
>    Affects Versions: 5.0.1.FINAL
>            Reporter: Marco Ghanitab
>            Assignee: Mark Proctor
>            Priority: Minor
>             Fix For: 5.3.0.Final
>
>
> in a drl file with a rule "reset" ad a function "formatDate",a bad behaviour is verified when is called the function in the "when" block..it call the function many times, but if the function called is stored in a external java file (not drl) everything works fine, and it call the function only 2 times (correct).
> Here the code of the drl file:
> rule "reset"
>         when
>                 $conversation:Conversation(resource.code == "sms", tickets.size > 0)
>                 not Discount(date == (formatDate($conversation.getStopDate())))
>         then 
>                 Discount discount = new Discount();
>                 discount.setDate(formatDate($conversation.getStopDate()));
>                 discount.setQuantity(495);
>                 insert(discount);               
>                 System.out.println("reset " + discount.getDate());
> end
>  
> declare Discount
>    date : String
>    quantity : int
> end
>  
> function String formatDate(java.util.Date date) {
>         java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("dd/MM/yy");
>         return formatter.format(date);
> }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list