Re: How to selectively save EO
Re: How to selectively save EO
- Subject: Re: How to selectively save EO
- From: Arturo PĂ©rez <email@hidden>
- Date: Mon, 24 Apr 2006 22:14:08 -0400
On Apr 24, 2006, at 6:54 PM, Louis Demers wrote:
At 6:36 PM -0400 2006/04/24, Paul Suh wrote:
Louis,
If I understand your problem correctly, you would like to put in an
audit trail whenever a user opens an EO for editing, and again once
the EO is actually changed, right?
Yes, I wanted to avoid using the word audit simply because I'm not
nust about how rigurous it has to be. I simply wanted some traces
about some of the actions. What you propose is a bit more rigourous
than what I had in mind but would certainly like to move into that
direction.
In that case, you can trigger a save to the object graph before the
user ever sees the page. The sequence of actions is:
1) User selects which EO he wishes to edit.
2) As a part of the action method, you insert an audit EO into the
user's EC, relate it to the EO that is to be edited, then save the
EC.
3) Return an edit page to the user with the EO to be edited in a
page-level editing context. As a part of instantiating the edit page,
insert another audit trail EO, indicating that the object has been
edited.
4) If the user hits save, then both the EO to be edited and the audit
trail EO that marks the edit will be saved. If the user hits cancel,
then all of the changes in the page-level editing context are thrown
away, which is exactly the desired behavior. In either case, there is
an audit trail EO saved to the DB that marks that there was an edit
attempt.
You can do similar things if a user wants to create a new EO or
delete an EO. Does this make sense?
Perfect Sense.
When you say "you can trigger a save to the object graph before the
user ever sees the page" , you mean by overridding "appendToResponse"
of the page used to edit ?
Thanks.
If it's WO all the way then in the action that shows goes to the EO you
can make your little audit thing:
public WOComponent goEditEO() {
EOGenericRecord egr = EOUtilities.createAndInsert(ec, "Audit"):
egr.takeValueForKey...
ec.saveChanges();
return pageWithName("editTheDarnThingAlready");
}
-arturo
_______________________________________________
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