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: Chuck Hill <email@hidden>
- Date: Mon, 25 Jan 2010 12:24:07 -0800
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.
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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