<!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><SPAN class=730581414-06042007><FONT face=Arial
color=#0000ff size=2>Hello everybody,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=730581414-06042007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=730581414-06042007><FONT face=Arial
color=#0000ff size=2>I still have 2 of my questions pending and i would really
appreciate if somebody could get back to me and help me out.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=730581414-06042007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=730581414-06042007><FONT face=Arial
color=#0000ff size=2>1.Calling dao in LHS when the method calls does not return
collection and returns lets say a boolean .. Code is attached below for a quick
look.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=730581414-06042007>
<DIV dir=ltr align=left><SPAN class=300315015-03042007><FONT color=#0000ff>
<P><FONT face=Arial size=2></FONT></P><FONT face=Arial size=2>rule "Item should
have a valid status"</FONT></DIV>
<DIV dir=ltr align=left>
<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 class=300315015-03042007> ==
true</SPAN> )</FONT> from
itemValidationDao.isValidItemStatus(statusCode)</STRONG></FONT></FONT></FONT></P>
<P><FONT face=Arial size=2>then</FONT></P>
<P>
<P><FONT face=Arial size=2></FONT></P><FONT face=Arial
size=2>System.out.println("Item Status Code is <SPAN
class=730581414-06042007>valid</SPAN>");</FONT></P>
<P><FONT face=Arial size=2>end</FONT></P>
<DIV dir=ltr align=left><SPAN class=300315015-03042007><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 class=300315015-03042007><FONT face=Arial><FONT color=#000000><FONT
size=2>isValidItemStatus<SPAN class=922475718-05042007><FONT
color=#0000ff> () </FONT></SPAN> method returns a boolean and i need
to check if thats true than go to the RHS side .... <SPAN
class=922475718-05042007><FONT color=#0000ff> somehow </FONT></SPAN>it does
not recognize itemValidationDao in LHS side .. RHS same call works ... <SPAN
class=922475718-05042007><FONT
color=#0000ff> </FONT></SPAN></FONT></FONT></FONT></SPAN><FONT face=Arial
size=2><SPAN class=300315015-03042007><SPAN class=922475718-05042007>Can anybody
suggest how to call database in LHS .. </SPAN></SPAN></FONT></P>
<P></FONT></SPAN></SPAN><SPAN class=730581414-06042007><FONT face=Arial
color=#0000ff size=2>2.If I have a method with the signature
</FONT></SPAN></P></DIV></DIV>
<DIV dir=ltr align=left><SPAN class=730581414-06042007><FONT face=Arial
size=2><STRONG>public ValidationErrorMap validateItemOrdEffDateMaintain(ItemVo
oldItem, ItemVo newItem, ValidationErrorMap errors, UserVo user){ }</STRONG>
</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=730581414-06042007><FONT face=Arial
size=2>Is there a way that i can assert two objects of same type in my working
memory ?? Like oldItem and newItem are same ItemVo's and they have exactly same
fields .. How do i assert two same type objects so that i can deal with them in
drl differently .. I have one ItemMaintVo which can give me oldItem and newItem
and i can only assert ItemMaintVo but again how do i refer to two same type
objects .. Here is the syntax ..</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=730581414-06042007><STRONG><FONT face=Arial
color=#ff0000 size=2></FONT></STRONG></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=730581414-06042007><FONT color=#ff0000>
<P><FONT face=Arial color=#000000 size=2>rule "Item status cannot be
null"</FONT></P>
<P><FONT face=Arial color=#000000 size=2>when</FONT></P>
<P><FONT face=Arial color=#000000 size=2>oldItemMaint : ItemMaintWorkVo(oldItem
: currentItem)</FONT></P>
<P><FONT face=Arial color=#000000 size=2>newItemMaint : ItemMaintWorkVo(newItem
: newItem)</FONT></P>
<P><SPAN class=730581414-06042007><FONT face=Arial color=#000000 size=2>// I
need to reach to the ItemVo (from old and new item) .. how do i do it here
?</FONT></SPAN></P>
<P><FONT face=Arial color=#000000 size=2>then</FONT></P>
<P><FONT face=Arial><FONT color=#000000><FONT size=2><SPAN
class=730581414-06042007>S</SPAN>ystem.out.println( "Item Status Code is
" <SPAN class=730581414-06042007> + old or new item <STRONG>.
getItemStatuscode</STRONG>() </SPAN>);</FONT></FONT></FONT></P>
<P><FONT face=Arial color=#000000 size=2>end</FONT></P></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=730581414-06042007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=730581414-06042007><FONT face=Arial
color=#0000ff size=2>This does not seem to work .. whats the way to operate
on two different instances of same class in DRL files
....</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=730581414-06042007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV><FONT face=Arial color=#0000ff
size=2></FONT><BR>
<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 8:53 AM<BR><B>To:</B> Rules Users
List<BR><B>Subject:</B> Re: [rules-users] Checking OR condition in
LHS<BR></FONT><BR></DIV>
<DIV></DIV> Sanjay,<BR><BR> You almost got it right. If you are
using 3.1M1 or later, you can do:<BR><BR>item : ItemVo ( itemStatusCode ==
ItemVo.STATUS_ACTIVE | == ItemVo.STATUS_DELETE )<BR><BR> field
connective constraints use a single "|" or "&". <BR><BR>
[]s<BR> Edson<BR><BR>
<DIV><SPAN class=gmail_quote>2007/4/4, Sanjay Singh - s0singh <<A
href="mailto:Sanjay.Singh@wal-mart.com">Sanjay.Singh@wal-mart.com</A>>:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">While
this is
working<BR><BR>when<BR> item :
ItemVo(itemStatusCode == ItemVo.STATUS_INACTIVE) or<BR>ItemVo(itemStatusCode
== ItemVo.STATUS_DELETE)<BR><BR>Is this the right way of doing it
?<BR><BR>thanks<BR><BR>-----Original Message----- <BR>From: <A
href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</A><BR>[mailto:<A
href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</A>]
On Behalf Of Sanjay Singh - <BR>s0singh<BR>Sent: Wednesday, April 04, 2007
2:12 PM<BR>To: Rules Users List<BR>Subject: [rules-users] Checking OR
condition in
LHS<BR><BR>when<BR> item :
ItemVo ( itemStatusCode == ItemVo.STATUS_ACTIVE ||<BR>ItemVo.STATUS_DELETE
)<BR>when<BR> item : ItemVo (
itemStatusCode == ItemVo.STATUS_ACTIVE ||<BR>itemStatusCode ==
ItemVo.STATUS_DELETE
)<BR>when<BR> item : ItemVo (
(itemStatusCode == ItemVo.STATUS_ACTIVE ||<BR>itemStatusCode ==
ItemVo.STATUS_DELETE)
)<BR>when<BR> item : ItemVo (
itemStatusCode == ItemVo.STATUS_ACTIVE || ==<BR>ItemVo.STATUS_DELETE
)<BR>when<BR> item : ItemVo ( (
itemStatusCode == ItemVo.STATUS_ACTIVE ) || (<BR>itemStatusCode ==
ItemVo.STATUS_DELETE )
)<BR>when<BR> item : ItemVo (
itemStatusCode == ItemVo.STATUS_ACTIVE OR<BR>itemStatusCode ==
ItemVo.STATUS_DELETE )<BR><BR>All of these when conditions fail for me ... Can
somebody send the syntax <BR>for two attributes check with OR condition
..<BR><BR>thanks<BR><BR><BR>-----Original Message-----<BR>From: <A
href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</A><BR>[mailto:<A
href="mailto:rules-users-bounces@lists.jboss.org">
rules-users-bounces@lists.jboss.org</A>] On Behalf Of Sanjay Singh
-<BR>s0singh<BR>Sent: Wednesday, April 04, 2007 8:13 AM<BR>To: Rules Users
List<BR>Subject: RE: [rules-users] NullPointer in LHS dao calls
..<BR><BR>Thanks Rahul <BR>Yes i was setting it in working memory thats why it
was working in
RHS<BR>.....<BR><BR>workingMemory.setGlobal("itemValidationDao",
itemValidationDao);<BR>and then in the DRL<BR>global
com.walmart.itemfile.item.dao.ItemValidationDao
<BR>itemValidationDao;<BR><BR>I think i am missing something very basic
..<BR><BR>thanks<BR><BR>-----Original Message-----<BR>From: <A
href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</A>
<BR>[mailto:<A
href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</A>]
On Behalf Of Rahul Phadnis<BR>Sent: Tuesday, April 03, 2007 5:42 PM<BR>To:
Rules Users List<BR>Subject: Re: [rules-users] NullPointer in LHS dao calls ..
<BR><BR>Did you set the global in the WorkingMemory?<BR><BR>You can do that
using the API at<BR><BR><A
href="http://labs.jboss.com/file-access/default/members/jbossrules/freezone/do">http://labs.jboss.com/file-access/default/members/jbossrules/freezone/do
</A><BR>cs/3.0.5/apidocs/index.html<BR>and yes that is for 3.0.5. I am sure
there is an<BR>equivalent for the version that you are
using.<BR><BR>-Rahul<BR><BR><BR>--- Sanjay Singh - s0singh <<A
href="mailto:Sanjay.Singh@wal-mart.com">
Sanjay.Singh@wal-mart.com</A>><BR>wrote:<BR><BR>> Since i could not get
the earlier code running i<BR>> tried using eval in LHS<BR>> side for
Dao calls but i keep on getting<BR>> NullPointerException
..<BR>><BR>> rule "Item should have a valid status"<BR>><BR>>
when<BR>><BR>> ItemVo (statusCode : itemStatusCode !=
null)<BR>><BR>> eval(<BR>>
!itemValidationDao.isValidItemStatus(statusCode) ) <BR>><BR>>
then<BR>><BR>><BR>errors.addValidationError("invalidtemStatusCode","Item<BR>>
Status Code is<BR>> invalid ");<BR>><BR>> end<BR>><BR>>
Exception data: org.drools.RuntimeDroolsException :<BR>>
java.lang.NullPointerException<BR>><BR>> at
org.drools.rule.EvalCondition.isAllowed(Unknown<BR>>
Source)<BR>><BR>>
at<BR>><BR>org.drools.reteoo.EvalConditionNode.assertTuple(Unknown<BR>>
Source) <BR>><BR>>
at<BR>><BR>org.drools.reteoo.LeftInputAdapterNode.createAndAssertTuple(Unknown<BR>>
Source)<BR>><BR>>
at<BR>><BR>org.drools.reteoo.LeftInputAdapterNode.assertObject(Unknown<BR>>
Source)<BR>><BR>>
at<BR>><BR>org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown<BR>>
Source)<BR>><BR>> Can somebody please help .. thanks<BR>><BR>>
________________________________<BR>><BR>> From: Sanjay Singh - s0singh
<BR>> Sent: Tuesday, April 03, 2007 11:01 AM<BR>> To: 'Anstis, Michael
(M.)'; Rules Users List<BR>> Subject: RE:
Hi.<BR>><BR>><BR>><BR>> Thanks for getting back to me Mike and
Edson and<BR>> Sorry for the delayed <BR>> response.<BR>><BR>> I
looked at your examples Mike and i felt better as<BR>> you said that we
can<BR>> make dao calls in LHS .. And Edson suggested not to<BR>> be
afraid of<BR>> suggesting the same constraint for more than one <BR>>
rule .. i guess i was<BR>> looking at it more procedural way and dint want
any<BR>> repetition of those<BR>> conditions as the top level IF block
but looks like<BR>> it won't hurt to<BR>> mention these constraints in
all the rules related <BR>> to this check ...so i<BR>> can include this
check in all the rules .. hmm ..<BR>><BR>> Here is a quick test i was
trying to do for calling<BR>> the dao in LHS but<BR>> it fails ... what
am i missing .. <BR>><BR>> package
com.walmart.itemfile.item.rules<BR>><BR>> import
com.walmart.itemfile.item.vo.ItemVo;<BR>><BR>> import
com.walmart.itemfile.item.dao.ItemDao;<BR>><BR>> import<BR>>
com.walmart.itemfile.item.dao.ItemValidationDao ;<BR>><BR>> import
java.lang.String;<BR>><BR>> global<BR>>
com.walmart.itemfile.item.dao.ItemValidationDao<BR>>
itemValidationDao;<BR>><BR>> global
com.walmart.itemfile.rules.ValidationErrorMap<BR>> errors;<BR>><BR>>
rule "Item should have a valid status"<BR>><BR>> when<BR>><BR>>
ItemVo( statusCode : itemStatusCode != null)<BR>><BR>> ItemVo(
statusCode == true ) from<BR>> itemValidationDao.isValidItemStatus
(statusCode) ..<BR>> my isValidItemStatus<BR>> method returns a boolean
(not collection of codes)<BR>> and i need to check<BR>> if thats true
than go to the RHS side .. is the line<BR>> in green even right<BR>> ...
in any case it does not recognize<BR>> itemValidationDao to begin with
in<BR>> LHS side .. RHS same call works ..<BR>><BR>>
then<BR>><BR>> errors.addValidationError("nullItemStatusCode","Item
<BR>> Status Code is<BR>> null");<BR>><BR>>
System.out.println("Item Base Defaults Called" +<BR>>
itemValidationDao.isValidItemStatus(statusCode));<BR>><BR>>
System.out.println("Item Status Code is null"); <BR>><BR>>
end<BR>><BR>> Caused by: org.drools.rule.InvalidRulePackage:<BR>>
unknown:32:28 Unexpected<BR>> token
'itemValidationDao'<BR>><BR>><BR>> thanks for the help guys
..<BR>><BR>> Sanjay<BR>><BR>>
________________________________<BR>><BR>> From: Anstis, Michael
(M.)<BR>> [mailto:<A
href="mailto:manstis1@ford.com">manstis1@ford.com</A>]<BR>> Sent: Monday,
March 26, 2007 8:57 AM <BR>> To: Rules Users List<BR>> Cc: Sanjay Singh
- s0singh<BR>> Subject: RE: Hi.<BR>><BR>><BR>> Hi
Sanjay,<BR>><BR>> To firstly answer your questions (in my
opinion):<BR>> 1. You can't do nested whens in the LHS but you can <BR>>
do nested if / else<BR>> in the RHS (although you'd fore go the benefits of
a<BR>> RETE-based<BR>> inference engine; but possible if you've got
very<BR>> few rules and<BR>> facts...). I believe that there is work to
have an <BR>> "otherwise" statement<BR>> for rule syntax, how progressed
this is and how it<BR>> will work I don't<BR>> know - over to Mark and
team?!?<BR>> 2. Yes, take a look at the "from" statement (new for <BR>>
3.1-M1, see<BR>><BR><A
href="http://wiki.jboss.org/wiki/Wiki.jsp?page=3.1M1ReleaseNotes">http://wiki.jboss.org/wiki/Wiki.jsp?page=3.1M1ReleaseNotes</A>)<BR>>
3. Yes, take a look at rule-flow at<BR>><BR><A
href="http://labs.jboss.com/portal/index.html?ctrl:cmd=render&ctrl:window=defa">http://labs.jboss.com/portal/index.html?ctrl:cmd=render&ctrl:window=defa</A><BR>><BR>ult.blog.PrjBlogPortletWindowDefaultBlog&project=jbossrules&from=1&link=<BR>><BR>RuleFlow_%28Kris_Verlaenen%29#RuleFlow_%28Kris_Verlaenen%29
<BR>> (although I<BR>> don't know if this is complete if 3.1-M1 - I
think<BR>> it's not). Although I<BR>> don't think your rules really need
rule-flow; you<BR>> just need to identify<BR>> and isolate the patterns
(IF's) that would cause <BR>> each "Do Something" to<BR>> be ran and
create a rule for each - this has the<BR>> benefit of separating<BR>>
each action into a separate rule making maintenance<BR>> a whole
bunch<BR>> easier). <BR>><BR>> Anyway, I'd try some rules like the
following<BR>> examples (the rest are<BR>> based upon
these):-<BR>><BR>> Rule "Rule 1"<BR>>
when<BR>> NewItem ( itemStatusCode == null)
<BR>> then<BR>> //do something<BR>>
end<BR>><BR>> Rule "Rule 2"<BR>> when<BR>>
$u : User( )<BR>> $ni : NewItem ( $isc :
itemStatusCode != null )<BR>> not Codes ( codes
contains $isc ) from <BR>>
valDao.getValidItemStatusCodesForUser($u)<BR>>
then<BR>> //Do something<BR>>
end<BR>><BR>> Rule "Rule 3"<BR>> when<BR>><BR>=== message
truncated ===><BR>_______________________________________________ <BR>>
rules-users mailing list<BR>> <A
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR>>
<A
href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users
</A><BR>><BR><BR><BR><BR>_______________________________________________<BR>rules-users
mailing list<BR><A
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR><A
href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</A><BR><BR>-----------------------------------------<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><BR><BR>_______________________________________________<BR>rules-users
mailing list<BR><A
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR><A
href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</A><BR><BR>-----------------------------------------<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><BR><BR>_______________________________________________<BR>rules-users
mailing list<BR><A
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR><A
href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</A><BR><BR>-----------------------------------------<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><BR><BR>_______________________________________________<BR>rules-users
mailing list<BR><A
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR><A
href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</A><BR></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR> Edson Tirelli<BR> Software Engineer
- JBoss Rules Core Developer<BR> Office: +55 11
3124-6000<BR> Mobile: +55 11 9218-4151 <BR> 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>