Package org.ldaptive

Class LdapEntry

    • Field Detail

      • HASH_CODE_SEED

        private static final int HASH_CODE_SEED
        hash code seed.
        See Also:
        Constant Field Values
      • serialVersionUID

        private static final long serialVersionUID
        serial version uid.
        See Also:
        Constant Field Values
      • entryDn

        private String entryDn
        Distinguished name for this entry.
      • entryAttributes

        private final Map<String,​LdapAttribute> entryAttributes
        Attributes contained in this bean.
    • 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
      • renameAttribute

        public void renameAttribute​(String oldName,
                                    String newName)
        Changes the name of an attribute in this entry. The old attribute is removed from this entry, the name is changed with LdapAttribute.setName(String), and the attribute is added back to this entry. If oldName does not exist, this method does nothing.
        Parameters:
        oldName - attribute name to change from
        newName - attribute name to change to
      • 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()
        Overrides:
        hashCode 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