I think Srini wrote:
> Hi,
>   I have an complex java bean tree where a parent bean has a
> collection of children beans and in turn the child bean has a
> reference to the parent bean. This bean tree is created when paring an
> XML. Now this bean tree has to be validated against some business
> rules which requires to traverse up and down the tree. Now my question
> is
> 
> 1. how write rules for such a scenario? 

This is such a general question, I'm not sure how to answer. If there
was a specific rule you wanted help with, I'd be glad to
oblige. Otherwise, there shouldn't be anything special about these
rules compared to the general case.

> 2. Should the tree be pushed on the Jess when the tree is being build
> or just push the root of the tree.

You probably want each JavaBean to have a separate entry in working
memory, so at some point you'll need to walk the tree and call
definstance() for each Bean. You can do this as you build the tree, or
you can do it afterwards -- it doesn't really matter one way or
another.

> 
> Please help out if there any examples for such scenarios? 
> 

There are lots of interesting examples and discussions in the mailing
list archives; here's one:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg00345.html .

There was also a recent, excellent discussion of a technique for
automatically definstancing contained objects using defadvice, but I
can't find it in the archive -- maybe somebody else can.

---------------------------------------------------------
Ernest Friedman-Hill  
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to