[rules-users] LHS Dao Calls
Edson Tirelli
tirelli at post.com
Fri Apr 6 11:21:52 EDT 2007
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 at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070406/b49e71e9/attachment.html
More information about the rules-users
mailing list