Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Fetch binary multivalued attributes

  1. #1
    Join Date
    Oct 2008
    Location
    India
    Posts
    20

    Default Fetch binary multivalued attributes

    How should I fetch binary multivalued attributes? I could find method for fetching text attribute.

  2. #2
    Join Date
    Oct 2008
    Location
    India
    Posts
    20

    Exclamation No method as getObjectAttributes() of DirContextAdapter?

    I am using Spring LDAP (Version 1.2.1) and want to fetch multi-valued attributes.So according to the reference I am trying to use getObjectAttributes() of DirContextAdapter, but I could not find the method in the library!:o
    The line which says that is page 11 of Spring LDAP (Version 1.2.1) reference PDF.

  3. #3
    Join Date
    Jul 2005
    Location
    Helsingborg, Sweden
    Posts
    504

    Default

    You're right, there is no getObjectAttributes method in DirContextAdapter. We have added a JIRA issue about this and it will be fixed for release 1.3.

    As a workaround, you can call getAttribute and work with the plain Attribute object.
    Ulrik Sandberg
    Jayway (www.jayway.com)
    Spring LDAP project member

  4. #4
    Join Date
    Oct 2008
    Location
    India
    Posts
    20

    Question AttributesMapper as a workaround?

    Looking forward for 1.3 release! As a workaround I am working with AttributesMapper for now. Any cons working with AttributesMapper instead of ContextMapper? Thanks ulsa for the quick response.

  5. #5
    Join Date
    Mar 2005
    Location
    Landskrona, Sweden
    Posts
    505

    Default

    FYI, it's in the trunk now. Working hard on the 1.3 release.
    Mattias Arthursson
    Jayway AB (www.jayway.se)
    Spring-LDAP project member

  6. #6
    Join Date
    Oct 2008
    Location
    India
    Posts
    20

    Default

    Ok.Thanks!

  7. #7
    Join Date
    Jul 2005
    Location
    Helsingborg, Sweden
    Posts
    504

    Default

    You should probably use an AttributesMapper in this case.

    However, if DirContextAdapter does what you want, the ContextMapper is almost always better. Apart from the convenience methods for getting and setting attributes, it also provides the DN of the entry, which sometimes is crucial. We tend to use an AbstractContextMapper subclass over a ContextMapper implementation.
    Ulrik Sandberg
    Jayway (www.jayway.com)
    Spring LDAP project member

  8. #8
    Join Date
    Oct 2008
    Location
    India
    Posts
    20

    Default

    Currently I will stick to AttributesMapper.I think it will cater to my needs.

  9. #9
    Join Date
    Jul 2005
    Location
    Helsingborg, Sweden
    Posts
    504

    Default

    Note that there is a getAttributes in DirContextAdapter, but for some odd reason it was never added to the interface DirContextOprtations. It's being fixed as I write this. Anyway, as of 1.2.1, you need to cast to DirContextAdapter in order to see it:

    Code:
    Object[] result = (Object[]) ldapTemplate.lookup(DN,
       new AbstractContextMapper() {
          public Object doMapFromContext(DirContextOperations ctx) {
             Attributes attributes = ((DirContextAdapter) ctx).getAttributes();
             ...
    This means that it's possible to perform operations on raw Attributes even in a ContextMapper, if needed. This should practically eliminate the need for AttributesMapper.
    Ulrik Sandberg
    Jayway (www.jayway.com)
    Spring LDAP project member

  10. #10
    Join Date
    Oct 2008
    Location
    India
    Posts
    20

    Default

    Thanks.I tried it, it worked.I should have figured that out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •