Hi all.

I’ve been attempting to automate the setting of some common attributes in my 
EOs, like creationDate, createdByUser etc. etc. Usually one might populate 
attributes like that in awakeFromInsertion, but that's boilerplate I’d rather 
not add to my EO classes. So instead, I’ve taken a different route. Simple 
example:

I have an interface TimeStamped, objects that I want stamped with the creation 
date implement this interface. My application then listens for 
EOEditingContext.ObjectsChangedInEditingContextNotification and when it’s 
received, I iterate through inserted objects, check if they implement 
TimeStamped and update their creation dates.

This works fine, apart from a little kink: The 
EOEditingContext.ObjectsChangedInEditingContextNotification is not broadcast 
until WO calls processRecentChanges on the EditingContext—and that happens at 
the *end* of the r/r-loop. This means that if I create an object, assign it to 
a page and return it, WO will happily render the page, and THEN stamp the 
values on the EO (which are thus not shown until the user next refreshes the 
page).

I’m aware I can expedite the broadcasting of the notification by manually 
invoking processRecentChanges before returning the page—but that kind of ruins 
the whole “get this functionality out of my face” aspect of the mechanism.

Anyone have any happy litle ideas on how to tackle the problem?

Cheers,
- hugi

// Hugi Þórðarson
// Góður kóði
// 895-6688 / 561-0896

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to