"Smart" Bindings?
"Smart" Bindings?
- Subject: "Smart" Bindings?
- From: Kieran Kelleher <email@hidden>
- Date: Wed, 26 Jan 2005 07:14:56 -0500
I have CTUser <->> CTPrivilege
CTPrivilege primarily defines a text privilege such as "canEditCustomers", "canEditUsers", etc.
I am using bindings such as su.canEditCustomers, su.canEditUsers, etc in WOConditionals in my components. "su" is not a real method ..... just a prefix to intercept in overridden valueForKeyPath.
Based on the "Smart Bindings" pattern in WWDC2003-614, I have overridden valueForKeyPath in my custom WOComponent subclass (effectively overriding valueForKeyPath in every component) to intercept keyPaths beginning with "su.can" in which case the privilege relationship is checked and a Boolean object is returned by valueForKeyPath. This works fine but the severe warnings in the WOComponent API that valueForKeyPath is highly optimized and should not be over-ridden worries me!
Is this best practice or is there a more efficient way to achieve the same goal? For example should I instead have a method "su" that returns the session user and override something in the CTUser EOCustomObject subclass? If so, what should I override, storedValueForKey, valueForKey, storedValueForKeyPath, valueForKeyPath and would that be more efficient than intercepting every component's valueForKeyPath?
Advice is appreciated,
Kieran
___________________________________
Kieran Kelleher
Palm Harbor, Florida USA
_______________________________________________
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