Sergey,
I don't think you will get the behavior you described, out of the box. What you can do, is delegate to the engine the actual update work.
rule "on updated cost write to archive old value"
when
$cost : Cost( $oldAmount : amount )
$event : CostUpdateEvent( $newAmount : amount, object == $cost )
then
//... write to archive $oldAmount
$cost.setAmount( $newAmount );
update( $cost );
retract( $event );
end
Right now, shadow facts don't expose it's cache for use in rules in a safe way. So, I believe something like the above is the best approach.
[]s
Edson
2007/8/2, Manukyan, Sergey <SManukyan@lear.com>:
Folks,
I need a rule that will track changes to cost amount and do something
with his old value.
Like that :
rule "on updated cost write to archive old value"
when
cost : Cost()
old_cost : Cost(amount != cost.amount) // how can I
specify the OLD cost object before it was updated???
then
... write to archive $old_cost.amount
end
Is it possible at all?
Something like in database system triggers, when you have "on update"
and then you have OLD value and NEW values available...?
Thanks a lot!
-Sergey
**********************
** LEGAL DISCLAIMER **
**********************
This E-mail message and any attachments may contain
legally privileged, confidential or proprietary
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of
this message to the intended recipient(s), you are
hereby notified that any dissemination, distribution
or copying of this E-mail message is strictly
prohibited. If you have received this message in
error, please immediately notify the sender and
delete this E-mail message from your computer.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com