Announcement Announcement Module
Collapse
No announcement yet.
How to check if a certain attribute exists in LDAP? (using AttributesMapper) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to check if a certain attribute exists in LDAP? (using AttributesMapper)

    Yet another basic question: (don't even know if it belongs here. Please feel free to delete and let me know if it doesn't).

    I am trying to figure out how to check whether a certain Attribute exists in LDAP using AttributesMapper. I glanced at http://java.sun.com/j2se/1.5.0/docs/...ttributes.html but the only method that I see there with a boolean result is isCaseIgnored() which is not what I need.

    I am getting the attributes, using the following:

    attrs.get("employeeName").get()

    where, attrs is a reference to an object of type Attributes.

    I wish to check if "employeeName" attribute exists, and only if it exists, I want to set a variable with its value.

    Thanks in advance for your help!

    Regards,

    Chintan Zaveri.

  • #2
    I came across DirContextAdapter having the boolean test

    Code:
    protected  boolean 	exists(Attribute attr)
              Checks if an entry has a specific attribute.
    But since I am using AttributesMapper I assume, that is not an option (?)

    Comment


    • #3
      The general recommendation is to use ContextMapper anyway - manually fiddling with Attributes is tedious and error prone.

      Comment

      Working...
      X