Nearly all of my LDAP attributes are Object not Array ... The problem is that if you have a single value in LDAP, it returns as a String, but if you have a multivalue, it returns as an Array, so your API has to be prepared for that. I've been considering making a proper "MultiValue<T>" object that can be either one (so you can get an array off it or a value, etc). For now, I cover the Object method with multiple methods that can return a typesafe single value from the multivalue or an array.

ms

On May 25, 2009, at 3:42 AM, Gustavo Adolfo Pizano wrote:

Hello Mike.

Im here again with this trouble. I was reading old post about handling the MV form LDAP. But couldn''t understand very much what they were talking about..

I did as Sharpy suggested me
I set up my model as follwoing:

External Type: Directory String
Class: com.webobjects.foundation.NSArray
Data Type: Custom - Custom
Value Class: com.webobjects.foundation.NSArray

But when I try to access the array, I get a JavaClassCastException java.lang.String

I checked and it's raised from the

return (com .webobjects .foundation.NSArray)storedValuesForKey("labeledTelephoneNumber");



I got lost here.. :S

Any idea? I must be missing something really important.

:(:'(

Thanks

Gustavo



On May 14, 2009, at 1:02 PM, Mike Schrag wrote:

i just make most things return "object" ... you'll find that multivalue attributes can either be an NSArray OR a String depending on whether it happens to have one value or several ... then I write cover methods to get the "primary" (first) value to make it easier to bind to.

On May 14, 2009, at 6:38 AM, Gustavo Pizano wrote:



---------- Forwarded message ----------
From: Gustavo Pizano <[email protected]>
Date: Thu, May 14, 2009 at 12:35 PM
Subject: Re: handling multivalues attributes
To: sharpy <[email protected]>


mm
Value Class:?/ where is that one?


On Thu, May 14, 2009 at 12:33 PM, Gustavo Pizano <[email protected] > wrote: WOW thanks a lot.. so far I think this will be read only.... but I must be prepared for write also... :S .... freaking out...

Gus


On Thu, May 14, 2009 at 12:31 PM, sharpy <[email protected]> wrote:
Hi Gus,

A quick look at one of our models shows the following for a multi value attribute:

External Type: Directory String
Class: com.webobjects.foundation.NSArray
Data Type: Custom - Custom
Value Class: com.webobjects.foundation.NSArray

Note: I've used this for reading only, no idea if the above works for writes..

Sharpy.

(forgot to include the list first time around)


On 14/05/2009, at 7:53 PM, Gustavo Pizano wrote:

Hello well, I didn't get this one.. my LDAP schema has a multi value attribute in one of its classes., I was told that the LDAP returns an array with those values... but the EOModel when imported just sets as external type of those attributes as IA5 String.

I was reading a LONG post about LDAP, and found out that they were talking about a EOModel that has some multivalues... but I never saw the model on the emails.. maybe if I can get that model also, or if someone could explain me how to handle those multy value attributes.

I also read in and old post also that if I change the external type to be NSArray the problem is gone. But I tried, and well what should I change the external type, the class, or the Data Type... I thought it was the class.. so I put NSArray.. or com.webobjects.foundation.NSArray; but then what to put in the other fields?


thanks


Gustavo

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/getsharp%40gmail.com

This email sent to [email protected]




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40mdimension.com

This email sent to [email protected]

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/webobjectspicora%40gmail.com

This email sent to [email protected]


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

This email sent to [email protected]

Reply via email to