<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left>
<P><SPAN class=954245415-06042007><FONT face=Arial color=#0000ff size=2>Thanks 
Edson .. i tried with these syntaxes but does not work .. any other clues&nbsp; 
? just to let you know that itemValidationDao is declared global and itemvo is 
asserted </FONT></SPAN></P>
<P><FONT face=Arial size=2><STRONG>when</STRONG></FONT></P>
<P><FONT face=Arial size=2><STRONG>item : ItemVo(itemStatusCode != 
ItemVo.STATUS_ACTIVE , 
(itemValidationDao.isValidItemStatus(itemStatusCode)))</STRONG></FONT></P><FONT 
color=#0000ff><FONT color=#0000ff>
<P><FONT face=Arial size=2>Caused by: org.drools.rule.InvalidRulePackage: 
unknown:15:70 Unexpected token '('</FONT></P>
<P><FONT face=Arial size=2>unknown:16:1 mismatched token: 
[@160,673:676='then',&lt;33&gt;,16:1]; expecting type ')'</FONT></P>
<P><FONT face=Arial size=2>unknown:17:29 Unexpected token 
'"itemStatusCode"'</FONT></P>
<P><FONT face=Arial size=2>unknown:18:22 Unexpected token '"Item is cross ref 
prime"'</FONT></P>
<P><STRONG><FONT face=Arial color=#000000 size=2>when</FONT></STRONG></P>
<P><STRONG><FONT face=Arial color=#000000 size=2>item : ItemVo(statusCode : 
itemStatusCode != ItemVo.STATUS_ACTIVE , 
itemValidationDao.isValidItemStatus(statusCode))</FONT></STRONG></P><FONT 
color=#0000ff>
<P><FONT face=Arial size=2>Caused by: org.drools.rule.InvalidRulePackage: 
unknown:15:70 Unexpected token 'itemValidationDao'</FONT></P>
<P><FONT face=Arial size=2>unknown:16:1 mismatched token: 
[@158,671:674='then',&lt;33&gt;,16:1]; expecting type ')'</FONT></P>
<P><FONT face=Arial size=2>unknown:17:29 Unexpected token 
'"itemStatusCode"'</FONT></P>
<P><FONT face=Arial size=2>unknown:18:22 Unexpected token '"Item is cross ref 
prime"'</FONT></P></FONT></FONT></FONT></DIV>
<DIV><SPAN class=954245415-06042007></SPAN><FONT face=Arial><FONT 
color=#0000ff><FONT size=2></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT><FONT><FONT face=Arial><FONT color=#0000ff><FONT 
size=2>This&nbsp;also&nbsp;does&nbsp;not&nbsp;seem&nbsp;to&nbsp;work&nbsp;<SPAN 
class=954245415-06042007>-- i have 3.1.0 M1 version .. 
</SPAN></FONT></FONT></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT>item : ItemVo ( itemStatusCode == ItemVo.STATUS_ACTIVE | == 
ItemVo.STATUS_DELETE )<BR></FONT></FONT><SPAN 
class=954245415-06042007></SPAN><FONT face=Arial><FONT color=#0000ff><FONT 
size=2>w<SPAN class=954245415-06042007>hile this still works 
:</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=954245415-06042007><FONT face="Times New Roman" color=#000000 size=3>item 
: ItemVo(itemStatusCode == ItemVo.STATUS_INACTIVE) or ItemVo(itemStatusCode == 
ItemVo.STATUS_DELETE)</FONT><BR></SPAN></FONT></FONT></FONT><BR></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org 
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Edson 
Tirelli<BR><B>Sent:</B> Friday, April 06, 2007 10:22 AM<BR><B>To:</B> Rules 
Users List<BR><B>Subject:</B> Re: [rules-users] LHS Dao 
Calls<BR></FONT><BR></DIV>
<DIV></DIV><BR>&nbsp;&nbsp; Sunjay,<BR><BR>&nbsp;&nbsp; Methods called by using 
the "from" CE are expected to return a collection of VO's, not boolean results. 
For your case, probably what you want is something like:<BR><BR><FONT face=Arial 
size=2>ItemVo( statusCode : itemStatusCode != null, (</FONT><FONT 
color=#ff0000><FONT face=Arial><FONT 
size=2><STRONG>itemValidationDao.isValidItemStatus(statusCode)</STRONG></FONT></FONT></FONT><FONT 
face=Arial size=2>) )</FONT><BR><BR>&nbsp;&nbsp; A predicate allow you to call a 
method returning a boolean value and use it as a constraint. 
<BR><BR>&nbsp;&nbsp; []s<BR>&nbsp;&nbsp; Edson<BR><BR>
<DIV><SPAN class=gmail_quote>2007/4/5, Sanjay Singh - s0singh &lt;<A 
href="mailto:Sanjay.Singh@wal-mart.com">Sanjay.Singh@wal-mart.com</A>&gt;:</SPAN>
<BLOCKQUOTE class=gmail_quote 
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
  <DIV>
  <DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>Here is a 
  quick test i was trying to do for calling the dao in LHS but it fails ... what 
  am i missing .. </FONT></SPAN></DIV>
  <DIV dir=ltr align=left><SPAN><FONT color=#0000ff><FONT face=Arial 
  size=2></FONT></FONT></SPAN>&nbsp;</DIV>
  <DIV dir=ltr align=left><SPAN><FONT color=#0000ff><FONT face=Arial 
  size=2>global com.itemfile.item.dao.ItemValidationDao 
  itemValidationDao;</FONT></FONT></SPAN></DIV>
  <DIV dir=ltr align=left>
  <P><FONT face=Arial size=2>global com.itemfile.rules.ValidationErrorMap 
  errors;</FONT></P>
  <P><FONT face=Arial size=2>rule "Item should have a valid status"</FONT></P>
  <P><FONT face=Arial size=2>when</FONT></P>
  <P><FONT face=Arial size=2>ItemVo( statusCode : itemStatusCode != 
  null)</FONT></P>
  <P><FONT color=#ff0000><FONT face=Arial><FONT size=2><STRONG><FONT 
  color=#00ff00>ItemVo( statusCode<SPAN> == true</SPAN>&nbsp;)</FONT> from 
  itemValidationDao.isValidItemStatus(statusCode)</STRONG></FONT></FONT></FONT></P>
  <P><FONT face=Arial size=2>then</FONT></P>
  <P><FONT face=Arial 
  size=2>errors.addValidationError("nullItemStatusCode","Item Status Code is 
  null");</FONT></P>
  <P><FONT face=Arial size=2>System.out.println("Item Base Defaults Called" + 
  itemValidationDao.isValidItemStatus(statusCode));</FONT></P>
  <P><FONT face=Arial size=2>System.out.println("Item Status Code is 
  null");</FONT></P>
  <P><FONT face=Arial size=2>end</FONT></P>
  <DIV dir=ltr align=left><SPAN><FONT face=Arial color=#800000 size=2>
  <P>Caused by: org.drools.rule.InvalidRulePackage: unknown:32:28 Unexpected 
  token 'itemValidationDao'</P></FONT></SPAN></DIV>
  <P><SPAN><FONT face=Arial><FONT color=#000000><FONT 
  size=2>isValidItemStatus<SPAN><FONT color=#0000ff>&nbsp;()&nbsp;</FONT></SPAN> 
  method returns a boolean and i need to check if thats true than go to the RHS 
  side ....&nbsp;<SPAN><FONT color=#0000ff>&nbsp;somehow </FONT></SPAN>it does 
  not recognize itemValidationDao in LHS side .. RHS same call works 
  ...&nbsp;<SPAN><FONT 
  color=#0000ff>&nbsp;</FONT></SPAN></FONT></FONT></FONT></SPAN></P>
  <P><SPAN><FONT face=Arial><FONT size=+0><FONT 
  size=2><SPAN></SPAN></FONT></FONT></FONT></SPAN><BR><FONT face=Arial 
  size=2><SPAN><SPAN>Can anybody suggest how to call database in LHS 
  ...&nbsp;</SPAN></SPAN></FONT></P>
  <P><SPAN><FONT face=Arial><FONT 
  size=2><SPAN>thanks</SPAN></FONT></FONT></SPAN></P></DIV></DIV>
  <DIV>
  <P></P>
  <HR SIZE=1>

  <P></P><BR>
  <P><STRONG><BR>*******************************************************************<BR>*** 
  This email and any files transmitted with it are confidential<BR>and intended 
  solely for the individual or entity to whom they are<BR>addressed. If you have 
  received this email in error destroy it<BR>immediately. 
  ******************************************************<BR>**************** 
  Wal-Mart Confidential 
  ****************************<BR>******************************************<BR></STRONG></P></DIV><BR>_______________________________________________<BR>rules-users 
  mailing list<BR><A onclick="return top.js.OpenExtLink(window,event,this)" 
  href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR><A 
  onclick="return top.js.OpenExtLink(window,event,this)" 
  href="https://lists.jboss.org/mailman/listinfo/rules-users" 
  target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR><BR></BLOCKQUOTE></DIV><BR><BR 
clear=all><BR>-- <BR>&nbsp;&nbsp;Edson Tirelli<BR>&nbsp;&nbsp;Software Engineer 
- JBoss Rules Core Developer<BR>&nbsp;&nbsp;Office: +55 11 
3124-6000<BR>&nbsp;&nbsp;Mobile: +55 11 9218-4151 <BR>&nbsp;&nbsp;JBoss, a 
division of Red Hat @ <A href="http://www.jboss.com">www.jboss.com</A> 
</BODY></HTML>


<HTML><BODY><P><hr size=1></P><br>
<P><STRONG><br>
*******************************************************************<br>
*** This email and any files transmitted with it are confidential<br>
and intended solely for the individual or entity to whom they are<br>
addressed. If you have received this email in error destroy it<br>
immediately. ******************************************************<br>
**************** Wal-Mart Confidential ****************************<br>
******************************************<br>
</STRONG></P></BODY></HTML>