[rules-users] How to write Drools rule basing on a changed property?

Wolfgang Laun wolfgang.laun at gmail.com
Wed Nov 9 06:55:59 EST 2011


It seems that this is more of a technical problem on the Java side: how to
register the fact that a certain property of an element has changed. You'll
need somthing like a "clone" method.

The old version of Person need and should not remain in Working Memory, but
a simple wrapper fact referencing to the cloned Person object (not a fact!)
would be required. Then you might do

   Person( $adress: adress )
   Wrapper( $person: person, eval( $adress != $person.getAddress() ) )

-W






On 9 November 2011 09:57, kapokfly <ivan.jiang.ww at foxmail.com> wrote:

> Thanks, when I am saying person address is changed, our app only concerns
> about its initial value and its final value, any change in the middle, we
> don't care.
>
> Examples:
>   person.address.address1 starts with 'my addr1'
>
>   later a couple of changes were made, say its final value is 'my addr1',
> we treat it as no change and no middle rules should be fired.
>
> Even for the 2 objects approach, how I can write the rules to get the old
> and new object matched correctly?
>
> They are both Person instances without any identity to tell which one is
> the
> old which one is the new one, unless I enable some kinds of map/or list in
> the rule and one structure to host only new objects and the other one hosts
> only the old values?
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-to-write-Drools-rule-basing-on-a-changed-property-tp3492926p3492979.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111109/fd98fffb/attachment.html 


More information about the rules-users mailing list