[rules-users] object creation

thomas kukofka thomaskukofka at web.de
Thu Aug 21 12:58:53 EDT 2008


Hello

the created OutputObjects should be used by the GUI to be displayed
and only reasonable filled OutputObjects should be displayed.
Furthermore an OutputObject of one type can be input for another rule
to create output of another type.
I'm not sure what's better and easier to handle in my case, lazy
initialisation or insert from outside.
Is there anything more to consider using lazy initialisation?

Regards
Thomas

Any reason you can't assert the OutputObject from outside? (i.e.
before rules fire)  You're essentially doing lazy initialization, and
that's always a bit more complex.

--- On Thu, 8/21/08, thomas kukofka <thomaskukofka at web.de> wrote:

> From: thomas kukofka <thomaskukofka at web.de>
> Subject: [rules-users] object creation
> To: "Rules Users List" <rules-users at lists.jboss.org>
> Date: Thursday, August 21, 2008, 9:03 AM
> Hello,
>
> I have a rule which creates an object in the consequence
> part and updates
> this object each time teh rule is executed. So the object
> has to be created
> only the first time.
> So I always need two rules, one init rule which creates the
> object if it
> doesn't exist yet and one if it already exists and it
> should only be
> updated:
>
> rule "init rule"
> when
>    "condition"
>    AND
>    not OutputObject()
> then
>    OutputObject oo = new OutputObject();
>    insert(oo);
>
> rule "update rule"
> when
>    "condition"
>    AND
>    oo: OutputObject()
> then
>    #do something with the object
>    update(oo);
>
> But is it really neccessary to write an extra rule only to
> create the
> output-fact initially? Is it possible/good style to make
> this in one single
> rule?
>
> Appreciate your help.
>
> Regards
> Thomas

**
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080821/516e8d7a/attachment.html 


More information about the rules-users mailing list