LDAP and Enterprise Objects
LDAP and Enterprise Objects
- Subject: LDAP and Enterprise Objects
- From: William Norris <email@hidden>
- Date: Fri, 21 Jan 2005 14:36:44 -0600
So I've finally discovered why I've been having so many problems with
LDAP EOs... when working with multi-valued LDAP attributes,
storedValueForKey() will return different things depending on how many
values are in the directory.
For example, if you have a single value in your `mail` LDAP attribute,
then storedValueForKey("mail") will return a String with that value.
However, if you have multiple values stored in the `mail` attribute in
your directory, then storedValueForKey("mail") will return a
NSMutableArray object containing those multiple values. The mail
accessor method expects to have a String returned, so it throws an
Exception if it tries to return an NSMutableArray.
So one solutions would be to rewrite the mail accessor method to have
it always return an NSArray. Then you check the type that is returned
from storedValueForKey("mail") -- if it is an array just return it, if
it is a string, throw it into an array and return it. I'm totally
okay with using this solution, except for the next problem I ran
into...
I use WOGen to create my EO Classes. The method signature for the
mail accessor is "public String mail()". I could override this method
and put the above custom logic in it, except that it would have to
have an identical signature -- returning a String. the only other
thing i could think to do is create a new method "mailArray" that
ignores the auto-generated mail() method altogether.
Has anyone else run into this? What did you do?
_______________________________________________
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