I think you could also use application data, instead of asserting the
delegate

ie.

workingMemory.setApplicationData("someDelegateUser", someObject);

and then in your consequence call

someDelegateUser.setDelegate(new LoginDelegate(...));


On 4/13/06, Lionel Port <[EMAIL PROTECTED]> wrote:
>
> I kinda question your need for a rules engine when all your doing is
> delegating to another action but maybe there is more to it that your not
> telling us about.
> Anyway, if your rule is not dependant on the existence of a delegate, then
> don't add it as a parameter. You can do something like this.
>
>
> <rule name="LoginRequest">
>     <parameter identifier="request">
>        <class>com.dtcc.dnv.request.IServiceRequest</class>
>     </parameter>
>     <java:condition>request.getId().equals("Login")</java:condition>
>     <java:consequence>drools.assertObject(new
> com.dtcc.dnv.delegate.LoginDelegate());</java:consequence>
>
> </rule>
>
> On 4/13/06, Susan G Lee <[EMAIL PROTECTED]> wrote:
> >
> > Hi Mike.
> >
> > The scenario is that in the service request and it contains a request
> id,
> > which is really a rule name.  So depending on the rule name being
> called,
> > a specific delegate would handle the service request, which is why I did
> > what I did.  Here's maybe a clearer example
> >
> > <rule name="LoginRequest">
> >       <parameter identifier="request">
> >          <class>com.dtcc.dnv.request.IServiceRequest</class>
> >       </parameter>
> >       <parameter identifier="delegate">
> >          <class>com.dtcc.dnv.delegate.IDelegate</class>
> >       </parameter>
> >
> >       <java:consequence>delegate = new
> > com.dtcc.dnv.delegate.LoginDelegate();</java:consequence>
> >
> >   </rule>
> >
> > <rule name="DBRequest">
> >       <parameter identifier="request">
> >          <class>com.dtcc.dnv.request.IServiceRequest</class>
> >       </parameter>
> >       <parameter identifier="delegate">
> >          <class>com.dtcc.dnv.delegate.IDelegate</class>
> >       </parameter>
> >
> >       <java:consequence>delegate = new
> > com.dtcc.dnv.delegate.DBDelegate();</java:consequence>
> >
> >   </rule>
> >
> > Thanks,
> > Susan G. Lee
> >
> >
> >
> >
> > "Michael Neale" <[EMAIL PROTECTED]>
> > 04/12/2006 01:29 AM
> > Please respond to
> > [email protected]
> >
> >
> > To
> > [email protected]
> > cc
> >
> > Subject
> > Re: [drools-user] Assert Null objects
> >
> >
> >
> >
> >
> >
> > that rule doesn't quite make sense. you can set a null pointer to a new
> > object in that way and have it do anything useful.
> > explain a bit more what you are trying to do?
> >
> > On 4/11/06, Susan G Lee <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi,
> > >
> > > I'm trying to genericize the use of the drl files. For example, I'm
> > going
> > > to pass in a request and from the request, I will be able to determine
> > > what delegate to use.  So I assert a request and delegate, but the
> > > delegate is instantiated to null, so when i do this:
> > >
> > > rule name="testRequest">
> > >      <parameter identifier="request">
> > >         <class>com.dtcc.dnv.request.IServiceRequest</class>
> > >      </parameter>
> > >      <parameter identifier="delegate">
> > >         <class>com.dtcc.dnv.delegate.IDelegate</class>
> > >      </parameter>
> > >
> > >      <java:consequence>delegate = new
> > > com.dtcc.dnv.delegate.LoginDelegate();</java:consequence>
> > >
> > >   </rule>
> > >
> > > it doesn't even get into the rule b/c the delegate is null.  I'm using
> > > drools 2.5. Can someone help with this?
> > >
> > >
> > > Thanks,
> > > Susan G. Lee
> > >
> > >
> > >
> >
> >
> >
>
>


--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference

Reply via email to