Has anyone in the users list tested any DAO calls from condition side
.... without using from keyword .. something like this .. i know i am
supposed to test this in trunk but is there anyone who has actually done
it either in trunk or M1
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Edson Tirelli
Sent: Friday, April 06, 2007 1:50 PM
To: Rules Users List
Subject: Re: [rules-users] LHS Dao Calls
Sanjay,
Are you trying with trunk? there was an issue using globals inside
predicates that was fixed after M1...
Let me know...
[]s
Edson
2007/4/6, Sanjay Singh - s0singh < Sanjay.Singh(a)wal-mart.com>:
Thanks Edson .. i tried with these syntaxes but does not work ..
any other clues ? just to let you know that itemValidationDao is
declared global and itemvo is asserted
when
item : ItemVo(itemStatusCode != ItemVo.STATUS_ACTIVE ,
(itemValidationDao.isValidItemStatus(itemStatusCode)))
Caused by: org.drools.rule.InvalidRulePackage: unknown:15:70
Unexpected token '('
unknown:16:1 mismatched token: [@160,673:676='then',<33>,16:1];
expecting type ')'
unknown:17:29 Unexpected token '"itemStatusCode"'
unknown:18:22 Unexpected token '"Item is cross ref prime"'
when
item : ItemVo(statusCode : itemStatusCode !=
ItemVo.STATUS_ACTIVE , itemValidationDao.isValidItemStatus(statusCode))
Caused by: org.drools.rule.InvalidRulePackage: unknown:15:70
Unexpected token 'itemValidationDao'
unknown:16:1 mismatched token: [@158,671:674='then',<33>,16:1];
expecting type ')'
unknown:17:29 Unexpected token '"itemStatusCode"'
unknown:18:22 Unexpected token '"Item is cross ref prime"'
This also does not seem to work -- i have 3.1.0 M1 version ..
item : ItemVo ( itemStatusCode == ItemVo.STATUS_ACTIVE | ==
ItemVo.STATUS_DELETE )
while this still works :
item : ItemVo(itemStatusCode == ItemVo.STATUS_INACTIVE) or
ItemVo(itemStatusCode == ItemVo.STATUS_DELETE)
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Edson Tirelli
Sent: Friday, April 06, 2007 10:22 AM
To: Rules Users List
Subject: Re: [rules-users] LHS Dao Calls
Sunjay,
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:
ItemVo( statusCode : itemStatusCode != null,
(itemValidationDao.isValidItemStatus (statusCode)) )
A predicate allow you to call a method returning a boolean
value and use it as a constraint.
[]s
Edson
2007/4/5, Sanjay Singh - s0singh <Sanjay.Singh(a)wal-mart.com>:
Here is a quick test i was trying to do for calling the
dao in LHS but it fails ... what am i missing ..
global com.itemfile.item.dao.ItemValidationDao
itemValidationDao;
global com.itemfile.rules.ValidationErrorMap errors;
rule "Item should have a valid status"
when
ItemVo( statusCode : itemStatusCode != null)
ItemVo( statusCode == true ) from
itemValidationDao.isValidItemStatus(statusCode)
then
errors.addValidationError("nullItemStatusCode","Item
Status Code is null");
System.out.println("Item Base Defaults Called" +
itemValidationDao.isValidItemStatus(statusCode));
System.out.println("Item Status Code is null");
end
Caused by: org.drools.rule.InvalidRulePackage:
unknown:32:28 Unexpected token 'itemValidationDao'
isValidItemStatus () method returns a boolean and i
need to check if thats true than go to the RHS side .... somehow it
does not recognize itemValidationDao in LHS side .. RHS same call works
....
Can anybody suggest how to call database in LHS ...
thanks
________________________________
*******************************************************************
*** This email and any files transmitted with it are
confidential
and intended solely for the individual or entity to whom
they are
addressed. If you have received this email in error
destroy it
immediately.
******************************************************
**************** Wal-Mart Confidential
****************************
******************************************
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3124-6000
Mobile: +55 11 9218-4151
JBoss, a division of Red Hat @
www.jboss.com
________________________________
*******************************************************************
*** This email and any files transmitted with it are
confidential
and intended solely for the individual or entity to whom they
are
addressed. If you have received this email in error destroy it
immediately.
******************************************************
**************** Wal-Mart Confidential
****************************
******************************************
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3124-6000
Mobile: +55 11 9218-4151
JBoss, a division of Red Hat @
www.jboss.com
-----------------------------------------
*******************************************************************
*** This email and any files transmitted with it are confidential
and intended solely for the individual or entity to whom they are
addressed. If you have received this email in error destroy it
immediately. ******************************************************
**************** Wal-Mart Confidential ****************************
******************************************