Results 1 to 3 of 3

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

  1. #1
    Join Date
    Jun 2009
    Posts
    4

    Default 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. #2
    Join Date
    Jun 2009
    Posts
    4

    Default

    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 (?)

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

    Default

    The general recommendation is to use ContextMapper anyway - manually fiddling with Attributes is tedious and error prone.
    Mattias Arthursson
    Jayway AB (www.jayway.se)
    Spring-LDAP project member

Posting Permissions

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