org.ldaptive
Class LdapEntry

java.lang.Object
  extended by org.ldaptive.AbstractLdapBean
      extended by org.ldaptive.LdapEntry
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
SearchEntry

public class LdapEntry
extends AbstractLdapBean

Simple bean representing an ldap entry. Contains a DN and ldap attributes.

Version:
$Revision: 2885 $ $Date: 2014-02-05 16:28:49 -0500 (Wed, 05 Feb 2014) $
Author:
Middleware Services
See Also:
Serialized Form

Constructor Summary
LdapEntry()
          Default constructor.
LdapEntry(SortBehavior sb)
          Creates a new ldap entry.
LdapEntry(String dn)
          Creates a new ldap entry.
LdapEntry(String dn, Collection<LdapAttribute> attrs)
          Creates a new ldap entry.
LdapEntry(String dn, LdapAttribute... attr)
          Creates a new ldap entry.
 
Method Summary
 void addAttribute(LdapAttribute... attr)
          Adds an attribute to this ldap attributes.
 void addAttributes(Collection<LdapAttribute> attrs)
          Adds attribute(s) to this ldap attributes.
 void clear()
          Removes all the attributes in this ldap attributes.
static AttributeModification[] computeModifications(LdapEntry source, LdapEntry target)
          Returns the list of attribute modifications needed to change the supplied target entry into the supplied source entry.
 LdapAttribute getAttribute()
          Returns a single attribute of this attributes.
 LdapAttribute getAttribute(String name)
          Returns the attribute with the supplied name.
 String[] getAttributeNames()
          Returns the attribute names in this entry.
 Collection<LdapAttribute> getAttributes()
          Returns a collection of ldap attribute.
 String getDn()
          Returns the DN.
 int hashCode()
          
 void removeAttribute(LdapAttribute... attr)
          Removes an attribute from this ldap attributes.
 void removeAttribute(String name)
          Removes the attribute of the supplied name from this ldap attributes.
 void removeAttributes(Collection<LdapAttribute> attrs)
          Removes the attribute(s) from this ldap attributes.
 void setDn(String dn)
          Sets the DN.
 int size()
          Returns the number of attributes in this ldap attributes.
 String toString()
          
 
Methods inherited from class org.ldaptive.AbstractLdapBean
equals, getSortBehavior
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LdapEntry

public LdapEntry()
Default constructor.


LdapEntry

public LdapEntry(SortBehavior sb)
Creates a new ldap entry.

Parameters:
sb - sort behavior

LdapEntry

public LdapEntry(String dn)
Creates a new ldap entry.

Parameters:
dn - dn for this entry

LdapEntry

public LdapEntry(String dn,
                 LdapAttribute... attr)
Creates a new ldap entry.

Parameters:
dn - dn for this entry
attr - ldap attribute for this entry

LdapEntry

public LdapEntry(String dn,
                 Collection<LdapAttribute> attrs)
Creates a new ldap entry.

Parameters:
dn - dn for this entry
attrs - collection of attributes to add
Method Detail

getDn

public String getDn()
Returns the DN.

Returns:
entry DN

setDn

public void setDn(String dn)
Sets the DN.

Parameters:
dn - dn to set

getAttributes

public Collection<LdapAttribute> getAttributes()
Returns a collection of ldap attribute.

Returns:
collection of ldap attribute

getAttribute

public LdapAttribute getAttribute()
Returns a single attribute of this attributes. If multiple attributes exist the first attribute returned by the underlying iterator is used. If no attributes exist null is returned.

Returns:
single attribute

getAttribute

public LdapAttribute getAttribute(String name)
Returns the attribute with the supplied name.

Parameters:
name - of the attribute to return
Returns:
ldap attribute

getAttributeNames

public String[] getAttributeNames()
Returns the attribute names in this entry.

Returns:
string array of attribute names

addAttribute

public void addAttribute(LdapAttribute... attr)
Adds an attribute to this ldap attributes.

Parameters:
attr - attribute to add

addAttributes

public void addAttributes(Collection<LdapAttribute> attrs)
Adds attribute(s) to this ldap attributes.

Parameters:
attrs - collection of attributes to add

removeAttribute

public void removeAttribute(LdapAttribute... attr)
Removes an attribute from this ldap attributes.

Parameters:
attr - attribute to remove

removeAttribute

public void removeAttribute(String name)
Removes the attribute of the supplied name from this ldap attributes.

Parameters:
name - of attribute to remove

removeAttributes

public void removeAttributes(Collection<LdapAttribute> attrs)
Removes the attribute(s) from this ldap attributes.

Parameters:
attrs - collection of ldap attributes to remove

size

public int size()
Returns the number of attributes in this ldap attributes.

Returns:
number of attributes in this ldap attributes

clear

public void clear()
Removes all the attributes in this ldap attributes.


hashCode

public int hashCode()

Specified by:
hashCode in class AbstractLdapBean

toString

public String toString()

Overrides:
toString in class Object

computeModifications

public static AttributeModification[] computeModifications(LdapEntry source,
                                                           LdapEntry target)
Returns the list of attribute modifications needed to change the supplied target entry into the supplied source entry.

Parameters:
source - ldap entry containing new data
target - ldap entry containing existing data
Returns:
attribute modifications needed to change target into source or an empty array


Copyright © 2003-2015 Virginia Tech. All Rights Reserved.