On 4 May 2011 15:02, Panu Suominen <[email protected]> wrote: > Hi, > > we have a problem where we must create audit trail of changes made to > business objects. Also things should run inside transaction. Our first > approach was to create so called command objects from every change but > these would be hard to maintain by hand. For example there would be > ChangePersonName, ChangeXXXName classes and these would have to be > hand created in name: -mehtods. More "clever" approach we come up with > is to copy original object and use proxy that records messages send to > it and sends them to the copy. Also this proxy creates new proxy when > copy returns values. These proxies record message sends to transaction > and when transaction is ready these recorded message from all of the > proxies are done to the actual objects instead of copies. > > To create usable copies I found method that (shallow) copies the > actual object and its instance variables (Object>>copyTwoLevel). The > method is marked to be deprecated soon. > Why is that and is there some alternative way of doing this kind of copy? > Also if you know some way to trivially handle the audit trail problem > I would like to hear... :) > >
I think that this is too special kind of copy to be provided by default in kernel (so whoever stated that this will be deprecated, i agree with him ;). What you can do is to copy down this method to the root class of your domain hierarchy.. I.e. consider that all your domain objects having single root superclass , like MyDomainObject and then you're free to use this specific kind of copy for your classes, without relying on it in Object protocol. > -- > Panu > -- Best regards, Igor Stasenko AKA sig.
