Announcement Announcement Module
Collapse
No announcement yet.
Fetch binary multivalued attributes Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Fetch binary multivalued attributes

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

  • #2
    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.

    Comment


    • #3
      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.

      Comment


      • #4
        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.

        Comment


        • #5
          FYI, it's in the trunk now. Working hard on the 1.3 release.

          Comment


          • #6
            Ok.Thanks!

            Comment


            • #7
              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.

              Comment


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

                Comment


                • #9
                  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.

                  Comment


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

                    Comment


                    • #11
                      FYI, getObjectAttributes is committed in trunk now. We're aiming to have the 1.3-rc1 out in a couple of days.

                      Comment


                      • #12
                        Ok.Great.I am looking at the trunk now.

                        Comment

                        Working...
                        X