Re: Updating EO by inserting new EO and archiving the old EO - any suggestions?
Re: Updating EO by inserting new EO and archiving the old EO - any suggestions?
- Subject: Re: Updating EO by inserting new EO and archiving the old EO - any suggestions?
- From: Amiel Montecillo <email@hidden>
- Date: Tue, 26 Jan 2010 08:05:06 +0800
Once again, thank you for your ideas. Going to increase my caffeine intake now.
Amiel
On Tue, Jan 26, 2010 at 4:24 AM, Chuck Hill
<email@hidden> wrote:
On Jan 25, 2010, at 12:32 AM, Amiel Montecillo wrote:
Hi List,
I am having a dilemma on how to best implement this kind of scenario.
I need the update process of an EO by creating an new EO with the updated values and archiving the old one. This EO has quiet a few to-many relationships that needs to be archived as well.
I am thinking of copying the existing values along with the relationship values to an NSDictionary and tie that to the form. Once the save action fires, inspect if there are any changed values and create a new EO with the updated values and archive the old one.
Can anyone suggest a better way of handling this?
Use the EOCopying code from Practical WebObjects. If you want to edit eo, instead edit eo.copy(). The copy() method should mark the existing object as archived. If the user saves, the existing object will be saved marked as archived, and new objects will be created. You will need to handle how these objects are referenced in relationships so you don't show archived versions.
The GVCGenericObjects framework shows one way of doing this, though it is NOT intended for use as an audit trail.
http://www.global-village.net/chill/gvc_frameworks
There have been several good discussions on various audit trail implementations on the list. Search for "audit trail". You need to carefully evaluate your requirements and choose your implementation accordingly.
--
socket error: unable to connect to 127.0.0.1
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden