• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
JNDI/LDAP and multivalued attributs (comming back)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

JNDI/LDAP and multivalued attributs (comming back)


  • Subject: JNDI/LDAP and multivalued attributs (comming back)
  • From: Lionel GUILLAUME <email@hidden>
  • Date: Fri, 02 Apr 2004 10:39:01 +0200

Hi,

I am sorry to come back with an old question with the JNDI connector

I use you sample code since 3 month to read the multivalued attributs
from my
ldap server. That works very well. But I can't write multivalued attributs.

I tried to write the " /ldapSingleValue/ ", but it never works.
I see no solution to make this works :
        takeStoredValueForKey(aNsArray, "uniqueMembers");
I read about writing a custom class to convert NSArray
(http://www.omnigroup.com/mailman/archive/webobjects-dev/2000-December/005118.html)
but I don't know the destination class for the converter.

Should I write the new attribute value by myself with the JNDI API ?
If, yes, how can I force the model
to read the new values ?

Chuck Hill wrote:

> That is *not* a string.  That is the result of calling toString() on
> an NSArray.  I don't know if you can change the model, EOModeler was
> not designed with multi-valued attributes in mind.  You can just
> change the generated code for the Java class.  Like this:
>
> public NSArray uniqueMembers() {
>     return ldapMultiValue(storedValueForKey("uniqueMembers"));
> }
>
> You might need to write the opposite method as well:
> public void setUniqueMembers(NSArray members) {
>     takeStoredValuedForKey(ldapSingleValue(members), "uniqueMembers");
> }
>
>
> Lionel GUILLAUME wrote:
>
>> The String result of the uniquemembers() mithod of a group created by
>> hand is like this one :
>>
>> {"uid=taylor,ou=People,o=example.com,o=isp",
>> "uid=birk,ou=People,o=example.com,o=isp",
>> "uid=beatty,ou=People,o=example.com,o=isp",
>> "uid=perkins,ou=People,o=example.com,o=isp",
>> "uid=bryant,ou=People,o=example.com,o=isp"}
>>
>> I will try to change my eomodel
>>
>> Le 8 janv. 04, ` 21:40, Chuck Hill a icrit :
>>
>>     I think you may have modeled/implemented it wrong. It should be type
>>     Object not String. Then you can set it to null, a String, or an
>>     NSArray. I have not done any updates, but that is what I do for
>>     reading.
>>
>>     Try reading one of these groups and see what uniqueMembers()
>> returns.
>>
>>     Chuck
>>
>>     Lionel GUILLAUME wrote:
>>
>>         No I don't think it is:
>>         I am working with EOF/JNDI and my problem is on an attribute
>>         with can have multiple values but EOModeler show me a String
>>         object for this attribute.
>>         The entity class is Group which has many String attributes :
>>         (cn, mail, owner, uniqueMembers,...)
>>         An export from an Ldap Server could be :
>>         dn: cn=myteam,ou=groups,o=example.com,o=isp
>>         cn: myteam
>>         objectClass: top
>>         objectClass: groupOfUniqueNames
>>         uniqueMember: uid=taylor,ou=People,o=example.com,o=isp
>>         uniqueMember: uid=birk,ou=People,o=example.com,o=isp
>>         uniqueMember: uid=beatty,ou=People,o=example.com,o=isp
>>         uniqueMember: uid=perkins,ou=People,o=example.com,o=isp
>>         uniqueMember: uid=bryant,ou=People,o=example.com,o=isp
>>         mail: email@hidden
>>         mailHost: mail.netscape.com
>>         EOF give me a method setUniqueMember (String uniqueMember), but
>>         uniqueMember may have more than one value. How can I set the
>>         others.
>>         Le 7 janv. 04, ` 22:40, Chuck Hill a icrit :
>>         Is this what you mean?
>>         /**
>>         * Returns an NSArray holding the value(s) from a potentially
>>         multi-valued
>>         LDAP attribute. The
>>         * JNDI adaptor will return these as (for example) null,
>> String, and
>>         NSArray if there are zero,
>>         * one or more values. This method makes these into a consistent
>>         NSArray
>>         return type. The
>>         * NSArray will contain zero, one, or more instances
>> respectively.
>>         *
>>         * @param object <code>Object</code> which is a potentially
>>         multi-valued
>>         LDAP attribute
>>         * @return an NSArray holding the value(s) from
>> <code>object</code>
>>         */
>>         public static NSArray ldapMultiValue(Object object) {
>>         NSArray ldapMultiValue;
>>         if (object == null) {
>>         ldapMultiValue = NSArray.EmptyArray;
>>         }
>>         else if (object instanceof NSArray) {
>>         ldapMultiValue = (NSArray)object;
>>         }
>>         else {
>>         ldapMultiValue = new NSArray(object);
>>         }
>>         return ldapMultiValue;
>>         }
>>         Chuck
>>         At 09:41 PM 07/01/2004 +0100, Lionel GUILLAUME wrote:
>>         Hi,
>>         I am using WebObjects with JNDI/LDAP. I read the example
>>         "DiscussionBoard" to understand
>>         who to create new entries ans it works fine for simple
>>         attributs, but I
>>         can't work
>>         with multivalued attributs (like uniquemenbers with
>>         groupofuniquenames
>>         objectclass).
>>         Does anybody how to work with multivalued attributs?
>>         _______________________________________________
>>         webobjects-dev mailing list | email@hidden
>>         Help/Unsubscribe/Archives:
>>         http://www.lists.apple.com/mailman/listinfo/webobjects-dev
>>         Do not post admin requests to the list. They will be ignored.
>>         -- Chuck Hill email@hidden
>>         Global Village Consulting Inc. http://www.global-village.net
>>         ----------------------------------------------------
>>         Lionel GUILLAUME
>>         email@hidden
>>         ----------------------------------------------------
>>
>>
>>     --
>>     Chuck Hill email@hidden
>>     Global Village Consulting Inc. http://www.global-village.net
>>
>>     Progress is the mother of all problems.
>>     - G. K. Chesterton
>>
>>
>> ----------------------------------------------------
>> Lionel GUILLAUME
>> email@hidden
>> ----------------------------------------------------
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • AppKil.dll 5.2.3 WO UpDate.
      • From: "WebObjects EMail" <email@hidden>
  • Prev by Date: Re: Synchronizing data displayed by two instances of my app
  • Next by Date: TEST - N/M
  • Previous by thread: Re: Where is WOServletAdaptor?
  • Next by thread: AppKil.dll 5.2.3 WO UpDate.
  • Index(es):
    • Date
    • Thread