Why not put the parameters into a "container" Fact in WM?
rule "bundle A - included units"
dialect "mvel"
when
Parameters($p1 : param1, $p2 : param2, $p3 : param3)
$order : OrderDTO( )
$line : OrderLineDTO( itemId == $p1, $quantity : quantity )
from
$order.lines
SubscriptionResult( userId == $order.userId, itemId == $p2,
subscribed
== true )
$pricing : PricingResult(userId == $order.userId, itemId ==
$p3)
then
$order.getLines().remove($
line);
OrderLineBL.addItem($order, $p3, new
Integer($quantity.intValue()),
$pricing.getPrice());update($order);
end
You could load the "Parameter" objects either with a lower salience rule
or
from Java; both from a database.
The issues with Guvnor sound like a bug to me and I request you raise a JIRA
for investigation.
Thanks,
Mike
On 27 December 2010 12:27, wasim.khan318 <khanwasim07(a)yahoo.co.in> wrote:
It is a Test Code , and i am very new to java and drools
i have a inbuilt
rule "bundle A - included units"
dialect "mvel"
when
$order : OrderDTO( )
$line : OrderLineDTO( itemId == 16, $quantity : quantity )
from
$order.lines
SubscriptionResult( userId == $order.userId, itemId == 12,
subscribed ==
true )
$pricing : PricingResult(userId == $order.userId, itemId ==
13)
then
$order.getLines().remove($line);
OrderLineBL.addItem($order, 13, new
Integer($quantity.intValue()),
$pricing.getPrice());update($order);
end
i want to modify this rule like
rule "bundle A - included units"
dialect "mvel"
when
$order : OrderDTO( )
$line : OrderLineDTO( itemId == param1, $quantity : quantity
) from
$order.lines
SubscriptionResult( userId == $order.userId, itemId ==
param2, subscribed
== true )
$pricing : PricingResult(userId == $order.userId, itemId ==
param3)
then
$order.getLines().remove($line);
OrderLineBL.addItem($order, param3, new
Integer($quantity.intValue()),
$pricing.getPrice());update($order);
end
1.i want to replace hardcoded value to params as ItemId16 to param1
,Itemid12 to param2 so when any one see my rule can not guess about
hardcoded value. and i want that the values of param1,param2 some how come
from database
2.Till now what i did from my reading and exploring is
i have created java functions in jboss which returns value like
GetParam1(some var),GetParam2(some var),GetParam3()
i tested them in jboss drools application they are working fine
3. then i build package and upload in guvnor
4.while writing technical ander Fact field i am getting only GetParam3()
not
GetParam1(some var) and
GetParam2(some var)
5. I dont know why . when i remove parameter value say make GetParam1() ,
without parameter it comes under class field.
6. please tell me is it right approach and if right then how i handle
GetParam1(some var) ,because they return param1 value which passed in
modified rule
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Modifying-in-built-ru...
Sent from the Drools - User mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users