Guys:
I wanted to ask about the condition element within a rule. Take for
example the rule below. There are four conditions. This rule is not
'asserted' unless all four conditions are true. This equates to an AND
conditional set of statements. Does drools support the OR behavior? I guess
it could if you wrote a separate rule reflecting the OR condition, but I would
not like to design a solution this way as it could lead to conflicting
behavior.
<rule name="Stock Price Low Enough">
<!-- parameters to pass to business rule -->
<parameter identifier="stockOffer">
<class>StockOffer</class>
</parameter>
<!-- Conditions or 'left hand side' (LHS) that must be met for
business rule to fire-->
<java:condition>daoFactory.getStockDAO().isOnStockList(stockOffer.getStockName())</java:condition>
<java:condition>stockOffer.getRecommendPurchase() == null
</java:condition>
<!-- Must us the escape character for "<" as it indicates start of
element -->
<java:condition>stockOffer.getStockPrice() < 100 </java:condition>
<java:condition>stockOffer.getStockPrice() > 0 </java:condition>
<java:consequence>
stockOffer.setRecommendPurchase(StockOffer.YES);
printStock(stockOffer);
</java:consequence>
</rule>
Thank you for sharing your thoughts.
Russ