logo       

[drools-user] ApplicationData/Globals usage in when condition in drools-3: msg#00117

java.drools.user

Subject: [drools-user] ApplicationData/Globals usage in when condition in drools-3


I'm evaluating Drools-3 for my project.
I have a small drools-2 based application where I used to put an object of
Type "Item" into the working memory as an application data and then do the
comparison with the asserted object of type "GroupedItem" using:

<application-data identifier="newOrderItem">Item</application-data>
<rule name="grouped item exists">
<parameter identifier="gi">
<java:class>GroupedItem</java:class>
</parameter>

<java:condition>gi.getItemId().equals(newOrderItem.getItemId())</java:condition>

<java:consequence>
some code......
</java:consequence>
</rule>

I want to do the same using drools-3 and .drl file. Can i use globals here
to do the comparison, like below ?

global Item newOrderItem

rule "grouped item exists"
when
$newOrderItem : Item($itemId : itemId)
$gi : GroupedItem(itemId == $itemId)
then
end

Whatever parameter that we declare in "when" condition, could point to an
asserted object as well as the Globals ?
Shouldnt the static information be supplied as application-data/global ?
--
View this message in context:
http://www.nabble.com/ApplicationData-Globals-usage-in-when-condition-in-drools-3-tf2838989.html#a7926365
Sent from the drools - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise