LDAPJDK 4.1

netscape.ldap
Class LDAPEntry

java.lang.Object
  |
  +--netscape.ldap.LDAPEntry

public class LDAPEntry
extends java.lang.Object
implements java.io.Serializable

Represents an entry in the directory.

See Also:
Serialized Form

Constructor Summary
LDAPEntry()
          Constructs an empty entry.
LDAPEntry(java.lang.String distinguishedName)
          Constructs a new entry with the specified distinguished name and with an empty attribute set.
LDAPEntry(java.lang.String distinguishedName, LDAPAttributeSet attrs)
          Constructs a new entry with the specified distinguished name and set of attributes.
 
Method Summary
 LDAPAttribute getAttribute(java.lang.String attrName)
          In an entry, returns the single attribute that exactly matches the specified attribute name.
 LDAPAttribute getAttribute(java.lang.String attrName, java.lang.String lang)
          Returns the subtype that matches "attrName" and that best matches a language specification "lang".
 LDAPAttributeSet getAttributeSet()
          Returns the attribute set of the entry.
 LDAPAttributeSet getAttributeSet(java.lang.String subtype)
          Creates a new attribute set containing only the attributes that have the specified subtypes.
 java.lang.String getDN()
          Returns the distinguished name of the current entry.
 java.lang.String toString()
          Retrieves the string representation of the entry's distinguished name (DN) and its attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LDAPEntry

public LDAPEntry()
Constructs an empty entry.

LDAPEntry

public LDAPEntry(java.lang.String distinguishedName)
Constructs a new entry with the specified distinguished name and with an empty attribute set.
Parameters:
distinguishedName - the distinguished name of the new entry

LDAPEntry

public LDAPEntry(java.lang.String distinguishedName,
                 LDAPAttributeSet attrs)
Constructs a new entry with the specified distinguished name and set of attributes.
Parameters:
distinguishedName - the distinguished name of the new entry
attrs - the set of attributes to assign to the new entry
See Also:
LDAPAttributeSet
Method Detail

getDN

public java.lang.String getDN()
Returns the distinguished name of the current entry.
Returns:
distinguished name of the current entry.

getAttributeSet

public LDAPAttributeSet getAttributeSet()
Returns the attribute set of the entry.
Returns:
set of attributes in the entry.
See Also:
LDAPAttributeSet

getAttributeSet

public LDAPAttributeSet getAttributeSet(java.lang.String subtype)
Creates a new attribute set containing only the attributes that have the specified subtypes.

For example, suppose an entry contains the following attributes:

 cn
 cn;lang-ja
 sn;phonetic;lang-ja
 sn;lang-us
 
If you call the getAttributeSet method and pass lang-ja as the argument, the method returns an attribute set containing the following attributes:

 cn;lang-ja
 sn;phonetic;lang-ja
 
Parameters:
subtype - semi-colon delimited list of subtypes that you want to find in attribute names.
     "lang-ja"        // Only Japanese language subtypes
     "binary"         // Only binary subtypes
     "binary;lang-ja" // Only Japanese language subtypes
                         which also are binary
Returns:
attribute set containing the attributes that have the specified subtypes.
See Also:
LDAPAttributeSet, LDAPAttributeSet.getSubset(java.lang.String)

getAttribute

public LDAPAttribute getAttribute(java.lang.String attrName)
In an entry, returns the single attribute that exactly matches the specified attribute name.
Parameters:
attrName - name of attribute to return For example:
     "cn"            // Only a non-subtyped version of cn
     "cn;lang-ja"    // Only a Japanese version of cn, will not
                     // return "cn;lang-ja-JP-kanji", for example
Returns:
attribute in the current entry that has exactly the same name, or null (if no attribute in the entry matches the specified name).
See Also:
LDAPAttribute

getAttribute

public LDAPAttribute getAttribute(java.lang.String attrName,
                                  java.lang.String lang)
Returns the subtype that matches "attrName" and that best matches a language specification "lang". If there are subtypes other than "lang" subtypes included in attrName, e.g. "cn;binary", only attributes with all of those subtypes are returned. If lang is null or empty, the method behaves as getAttribute(attrName). If there are no matching attributes, null is returned. Example:
  Assume the entry contains only the following attributes:
     cn;lang-en
     cn;lang-ja-JP-kanji
     sn
  getAttribute( "cn" ) returns null.
  getAttribute( "sn" ) returns the "sn" attribute.
  getAttribute( "cn", "lang-en-us" ) returns the "cn;lang-en" attribute.
  getAttribute( "cn", "lang-en" ) returns the "cn;lang-en" attribute.
  getAttribute( "cn", "lang-ja" ) returns null.
  getAttribute( "sn", "lang-en" ) returns the "sn" attribute.

Parameters:
attrName - name of attribute to find in the entry
lang - a language specification (for example, lang-en)
Returns:
the attribute that matches the base name and that best matches any specified language subtype.
See Also:
LDAPAttribute

toString

public java.lang.String toString()
Retrieves the string representation of the entry's distinguished name (DN) and its attributes. For example:
 LDAPEntry: uid=bjensen, ou=People, o=airius.com; LDAPAttributeSet:
 LDAPAttribute {type='cn', values='Barbara Jensen,Babs Jensen'}
 LDAPAttribute {type='sn', values='Jensen'}LDAPAttribute {type='givenname',
 values='Barbara'}LDAPAttribute {type='objectclass', values='top,person,
 organizationalPerson,inetOrgPerson'}LDAPAttribute {type='ou',
 values='Product Development,People'}
 
Overrides:
toString in class java.lang.Object
Returns:
string representation of the entry's DN and its attributes.

LDAPJDK 4.1