Use a decorator.  In it you can utilize a variety of techniques to track the
"old" value and compare it with the "new" value.  For example...

1) Create an ActionAfterNewTransferEvent observer, which calls a method on
your decorator.  I use configAfterNew() in mine.  For an example of how to
register such an observer, I would recommend taking a look at the
TDOBeanInjectorObserver in Brian Kotek's ColdSpringUtils project (
http://coldspringutils.riaforge.org/).

2) In your configAfterNew() method, set a local property (e.g. not part of
the Transfer object itself) to the current value.  For example, I track
changes to UserName.  So, in my UserDecorator, I have the following:

<cffunction name="configAfterNew" returntype="void">
     <cfscript>
          setCurrentUserName(getUserName());
     </cfscript>
</cffunction>

<cffunction name="getCurrentUserName" returntype="string">
     <cfscript>
          if ( ) {

          setCurrentUserName(getUserName());
     </cfscript>
</cffunction>



On Wed, Aug 5, 2009 at 2:30 PM, Denver <[email protected]> wrote:

>
> Can anyone help with this???
>
> -Denver
>
> On Aug 3, 2:42 am, Denver <[email protected]> wrote:
> > Hello,
> > I am attempting to use event handlers to catch updates to my
> > TransferObjects before they happen, so that I can log changes into a
> > history table.
> >
> > So far I have set up a beforeUpdateObserver and the event being passed
> > in allows me to access the object that is about to get saved to the
> > database, but I can't figure out how to take a look at a pristine copy
> > of that object.
> > (i.e. I have a user, and I have changed his first name.  When I save()
> > that user object, the beforeUpdateObserver is called, and I am able to
> > access the object with the new first name, but I can't figure out how
> > to see what his first name was before the change).
> >
> > What should I do?
> >
> > I have thought about cloning the changed object and then discarding
> > it, retrieving a fresh copy of the object, and then comparing those,
> > but that seems like a bad idea.
> >
> > Thoughts?
> >
> > -Denver Root
> >
>

--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to