org.apache.directory.api.ldap.model.entry
Interface Entry

All Superinterfaces:
Cloneable, Externalizable, Iterable<Attribute>, Serializable
All Known Implementing Classes:
DefaultEntry, ImmutableEntry

public interface Entry
extends Cloneable, Iterable<Attribute>, Externalizable

This interface represent a LDAP entry. An LDAP entry contains :

  • A distinguished name (Dn)
  • A list of attributes
  • The available methods on this object are described in this interface.

    This interface is used by the serverEntry and clientEntry interfaces.

    Author:
    Apache Directory Project

    Method Summary
     void add(Attribute... attributes)
              Add some Attributes to the current Entry.
     void add(AttributeType attributeType, byte[]... values)
               Add an attribute (represented by its AttributeType and some binary values) into an entry.
     void add(AttributeType attributeType, String... values)
               Add an attribute (represented by its AttributeType and some String values) into an entry.
     void add(AttributeType attributeType, Value<?>... values)
               Add an attribute (represented by its AttributeType and some values) into an entry.
     void add(String upId, AttributeType attributeType, byte[]... values)
               Add an attribute (represented by its AttributeType and some binary values) into an entry.
     void add(String upId, AttributeType attributeType, String... values)
               Add an attribute (represented by its AttributeType and some String values) into an entry.
     void add(String upId, AttributeType attributeType, Value<?>... values)
               Add an attribute (represented by its AttributeType and some values) into an entry.
     void add(String upId, byte[]... values)
              Add some binary values to the current Entry.
     void add(String upId, String... values)
              Add some String values to the current Entry.
     void add(String upId, Value<?>... values)
              Add some Values to the current Entry.
     void clear()
              Remove all the attributes for this entry.
     Entry clone()
              Clone the current entry
     boolean contains(Attribute... attributes)
               Checks if an entry contains a list of attributes.
     boolean contains(AttributeType attributeType, byte[]... values)
              Checks if an entry contains an attribute with some given binary values.
     boolean contains(AttributeType attributeType, String... values)
              Checks if an entry contains an attribute with some given String values.
     boolean contains(AttributeType attributeType, Value<?>... values)
              Checks if an entry contains an attribute with some given binary values.
     boolean contains(String upId, byte[]... values)
              Checks if an entry contains an attribute with some binary values.
     boolean contains(String upId, String... values)
              Checks if an entry contains an attribute with some String values.
     boolean contains(String upId, Value<?>... values)
              Checks if an entry contains an attribute with some values.
     boolean containsAttribute(AttributeType attributeType)
              Checks if an entry contains a specific AttributeType.
     boolean containsAttribute(String... attributes)
              Checks if an entry contains some specific attributes.
     Attribute get(AttributeType attributeType)
              Returns the attribute associated with an AttributeType
     Attribute get(String alias)
               Returns the attribute with the specified alias.
     Collection<Attribute> getAttributes()
              Gets all the attributes
     Dn getDn()
              Get this entry's Dn.
     boolean hasObjectClass(Attribute... objectClasses)
              Tells if an entry has some specific ObjectClasses Attributes
     boolean hasObjectClass(String... objectClasses)
              Tells if an entry as some specific ObjectClasses values
     boolean isSchemaAware()
              Tells if the Entry is schema aware
     Iterator<Attribute> iterator()
              Returns an iterator on the attributes for this entry.
     List<Attribute> put(Attribute... attributes)
               Places attributes in the attribute collection.
     Attribute put(AttributeType attributeType, byte[]... values)
               Places a new attribute with the supplied AttributeType and binary values into the attribute collection.
     Attribute put(AttributeType attributeType, String... values)
               Places a new attribute with the supplied AttributeType and String values into the attribute collection.
     Attribute put(AttributeType attributeType, Value<?>... values)
               Places a new attribute with the supplied AttributeType and some values into the attribute collection.
     Attribute put(String upId, AttributeType attributeType, byte[]... values)
               Places a new attribute with the supplied AttributeType and some binary values into the attribute collection.
     Attribute put(String upId, AttributeType attributeType, String... values)
               Places a new attribute with the supplied AttributeType and some String values into the attribute collection.
     Attribute put(String upId, AttributeType attributeType, Value<?>... values)
               Places a new attribute with the supplied AttributeType and some values into the attribute collection.
     Attribute put(String upId, byte[]... values)
               Put an attribute (represented by its ID and some binary values) into an entry.
     Attribute put(String upId, String... values)
               Put an attribute (represented by its ID and some String values) into an entry.
     Attribute put(String upId, Value<?>... values)
               Put an attribute (represented by its ID and some values) into an entry.
     List<Attribute> remove(Attribute... attributes)
              Removes the specified attributes.
     boolean remove(AttributeType attributeType, byte[]... values)
               Removes the specified binary values from an attribute.
     boolean remove(AttributeType attributeType, String... values)
               Removes the specified String values from an attribute.
     boolean remove(AttributeType attributeType, Value<?>... values)
               Removes the specified values from an attribute.
     boolean remove(String upId, byte[]... values)
               Removes the specified binary values from an attribute.
     boolean remove(String upId, String... values)
               Removes the specified String values from an attribute.
     boolean remove(String upId, Value<?>... values)
               Removes the specified values from an attribute.
     void removeAttributes(AttributeType... attributes)
               Removes the attribute with the specified AttributeTypes.
     void removeAttributes(String... attributes)
               Removes the attribute with the specified alias.
     void setDn(Dn dn)
              Set this entry's Dn.
     void setDn(String dn)
              Set this entry's Dn.
     int size()
              Returns the number of attributes.
     String toString(String tabs)
              A pretty-pinter for Entries
     
    Methods inherited from interface java.io.Externalizable
    readExternal, writeExternal
     

    Method Detail

    clear

    void clear()
    Remove all the attributes for this entry. The Dn is not reset


    clone

    Entry clone()
    Clone the current entry


    getDn

    Dn getDn()
    Get this entry's Dn.

    Returns:
    The entry's Dn

    hasObjectClass

    boolean hasObjectClass(String... objectClasses)
    Tells if an entry as some specific ObjectClasses values

    Parameters:
    objectClasses - The ObjectClasses we want to check
    Returns:
    true if all the ObjectClasses value are present in the ObjectClass attribute

    hasObjectClass

    boolean hasObjectClass(Attribute... objectClasses)
    Tells if an entry has some specific ObjectClasses Attributes

    Parameters:
    objectClasses - The ObjectClasses we want to check
    Returns:
    true if the ObjectClasses Attribute are present in the ObjectClass attribute

    get

    Attribute get(String alias)

    Returns the attribute with the specified alias. The return value is null if no match is found.

    An Attribute with an id different from the supplied alias may be returned: for example a call with 'cn' may in some implementations return an Attribute whose getId() field returns 'commonName'.

    Parameters:
    alias - an aliased name of the attribute identifier
    Returns:
    the attribute associated with the alias

    get

    Attribute get(AttributeType attributeType)
    Returns the attribute associated with an AttributeType

    Parameters:
    attributeType - the AttributeType we are looking for
    Returns:
    the associated attribute

    getAttributes

    Collection<Attribute> getAttributes()
    Gets all the attributes

    Returns:
    The combined set of all the attributes.

    setDn

    void setDn(Dn dn)
    Set this entry's Dn.

    Parameters:
    dn - The Dn associated with this entry

    setDn

    void setDn(String dn)
               throws LdapInvalidDnException
    Set this entry's Dn.

    Parameters:
    dn - The String Dn associated with this entry
    Throws:
    LdapInvalidDnException - if the provided Dn is invalid

    iterator

    Iterator<Attribute> iterator()
    Returns an iterator on the attributes for this entry.

    Specified by:
    iterator in interface Iterable<Attribute>
    Returns:
    an iterator on top of all contained attributes

    add

    void add(Attribute... attributes)
             throws LdapException
    Add some Attributes to the current Entry.

    Parameters:
    attributes - The attributes to add
    Throws:
    LdapException - If we can't add any of the attributes

    add

    void add(AttributeType attributeType,
             byte[]... values)
             throws LdapException

    Add an attribute (represented by its AttributeType and some binary values) into an entry.

    If we already have an attribute with the same values, the duplicated values are not added (duplicated values are not allowed)

    If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.

    Parameters:
    attributeType - The attribute Type.
    values - The list of binary values to inject. It can be empty.
    Throws:
    LdapException - If the attribute does not exist

    add

    void add(AttributeType attributeType,
             String... values)
             throws LdapException

    Add an attribute (represented by its AttributeType and some String values) into an entry.

    If we already have an attribute with the same values, the duplicated values are not added (duplicated values are not allowed)

    If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.

    Parameters:
    attributeType - The attribute Type
    values - The list of binary values to inject. It can be empty
    Throws:
    LdapException - If the attribute does not exist

    add

    void add(AttributeType attributeType,
             Value<?>... values)
             throws LdapException

    Add an attribute (represented by its AttributeType and some values) into an entry.

    If we already have an attribute with the same values, the duplicated values are not added (duplicated values are not allowed)

    If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.

    Parameters:
    attributeType - The attribute Type
    values - The list of binary values to inject. It can be empty
    Throws:
    LdapException - If the attribute does not exist

    add

    void add(String upId,
             AttributeType attributeType,
             byte[]... values)
             throws LdapException

    Add an attribute (represented by its AttributeType and some binary values) into an entry. Set the User Provider ID at the same time

    If we already have an attribute with the same values, the duplicated values are not added (duplicated values are not allowed)

    If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.

    Parameters:
    upId - The user provided ID for the added AttributeType
    attributeType - The attribute Type.
    values - The list of binary values to add. It can be empty.
    Throws:
    LdapException - If the attribute does not exist

    add

    void add(String upId,
             AttributeType attributeType,
             String... values)
             throws LdapException

    Add an attribute (represented by its AttributeType and some String values) into an entry. Set the User Provider ID at the same time

    If we already have an attribute with the same values, the duplicated values are not added (duplicated values are not allowed)

    If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.

    Parameters:
    upId - The user provided ID for the added AttributeType
    attributeType - The attribute Type.
    values - The list of String values to add. It can be empty.
    Throws:
    LdapException - If the attribute does not exist

    add

    void add(String upId,
             AttributeType attributeType,
             Value<?>... values)
             throws LdapException

    Add an attribute (represented by its AttributeType and some values) into an entry. Set the User Provider ID at the same time

    If we already have an attribute with the same values, nothing is done (duplicated values are not allowed)

    If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.

    Parameters:
    upId - The user provided ID for the added AttributeType
    attributeType - The attribute Type.
    values - The list of values to add. It can be empty.
    Throws:
    LdapException - If the attribute does not exist

    add

    void add(String upId,
             String... values)
             throws LdapException
    Add some String values to the current Entry.

    Parameters:
    upId - The user provided ID of the attribute we want to add some values to
    values - The list of String values to add
    Throws:
    LdapException - If we can't add any of the values

    add

    void add(String upId,
             byte[]... values)
             throws LdapException
    Add some binary values to the current Entry.

    Parameters:
    upId - The user provided ID of the attribute we want to add some values to
    values - The list of binary values to add
    Throws:
    LdapException - If we can't add any of the values

    add

    void add(String upId,
             Value<?>... values)
             throws LdapException
    Add some Values to the current Entry.

    Parameters:
    upId - The user provided ID of the attribute we want to add some values to
    values - The list of Values to add
    Throws:
    LdapException - If we can't add any of the values

    put

    List<Attribute> put(Attribute... attributes)
                        throws LdapException

    Places attributes in the attribute collection.

    If there is already an attribute with the same ID as any of the new attributes, the old ones are removed from the collection and are returned by this method. If there was no attribute with the same ID the return value is null.

    Parameters:
    attributes - the attributes to be put
    Returns:
    the old attributes with the same OID, if exist; otherwise null
    Throws:
    LdapException - if the operation fails

    put

    Attribute put(AttributeType attributeType,
                  byte[]... values)
                  throws LdapException

    Places a new attribute with the supplied AttributeType and binary values into the attribute collection.

    If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

    This method provides a mechanism to put an attribute with a null value: the value may be null.

    Parameters:
    attributeType - the type of the new attribute to be put
    values - the binary values of the new attribute to be put
    Returns:
    the old attribute with the same identifier, if exists; otherwise null
    Throws:
    LdapException - if there are failures

    put

    Attribute put(AttributeType attributeType,
                  String... values)
                  throws LdapException

    Places a new attribute with the supplied AttributeType and String values into the attribute collection.

    If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

    This method provides a mechanism to put an attribute with a null value: the value may be null.

    Parameters:
    attributeType - the type of the new attribute to be put
    values - the String values of the new attribute to be put
    Returns:
    the old attribute with the same identifier, if exists; otherwise null
    Throws:
    LdapException - if there are failures

    put

    Attribute put(AttributeType attributeType,
                  Value<?>... values)
                  throws LdapException

    Places a new attribute with the supplied AttributeType and some values into the attribute collection.

    If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

    This method provides a mechanism to put an attribute with a null value: the value may be null.

    Parameters:
    attributeType - the type of the new attribute to be put
    values - the values of the new attribute to be put
    Returns:
    the old attribute with the same identifier, if exists; otherwise null
    Throws:
    LdapException - if there are failures

    put

    Attribute put(String upId,
                  AttributeType attributeType,
                  byte[]... values)
                  throws LdapException

    Places a new attribute with the supplied AttributeType and some binary values into the attribute collection.

    The given User provided ID will be used for this new AttributeEntry.

    If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

    This method provides a mechanism to put an attribute with a null value: the value may be null.

    Parameters:
    upId - The User Provided ID to be stored into the AttributeEntry
    values - the binary values of the new attribute to be put
    Returns:
    the old attribute with the same identifier, if exists; otherwise null
    Throws:
    LdapException - if there are failures.

    put

    Attribute put(String upId,
                  AttributeType attributeType,
                  String... values)
                  throws LdapException

    Places a new attribute with the supplied AttributeType and some String values into the attribute collection.

    The given User provided ID will be used for this new AttributeEntry.

    If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

    This method provides a mechanism to put an attribute with a null value: the value may be null.

    Parameters:
    upId - The User Provided ID to be stored into the AttributeEntry
    attributeType - the type of the new attribute to be put
    values - the String values of the new attribute to be put
    Returns:
    the old attribute with the same identifier, if exists; otherwise null
    Throws:
    LdapException - if there are failures.

    put

    Attribute put(String upId,
                  AttributeType attributeType,
                  Value<?>... values)
                  throws LdapException

    Places a new attribute with the supplied AttributeType and some values into the attribute collection.

    The given User provided ID will be used for this new AttributeEntry.

    If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

    This method provides a mechanism to put an attribute with a null value: the value may be null.

    Parameters:
    upId - The User Provided ID to be stored into the AttributeEntry
    attributeType - the type of the new attribute to be put
    values - the values of the new attribute to be put
    Returns:
    the old attribute with the same identifier, if exists; otherwise null
    Throws:
    LdapException - if there are failures.

    put

    Attribute put(String upId,
                  byte[]... values)

    Put an attribute (represented by its ID and some binary values) into an entry.

    If the attribute already exists, the previous attribute will be replaced and returned.

    Parameters:
    upId - The attribute ID
    values - The list of binary values to put. It can be empty.
    Returns:
    The replaced attribute

    put

    Attribute put(String upId,
                  String... values)

    Put an attribute (represented by its ID and some String values) into an entry.

    If the attribute already exists, the previous attribute will be replaced and returned.

    Parameters:
    upId - The attribute ID
    values - The list of String values to put. It can be empty.
    Returns:
    The replaced attribute

    put

    Attribute put(String upId,
                  Value<?>... values)

    Put an attribute (represented by its ID and some values) into an entry.

    If the attribute already exists, the previous attribute will be replaced and returned.

    Parameters:
    upId - The attribute ID
    values - The list of values to put. It can be empty.
    Returns:
    The replaced attribute

    remove

    boolean remove(AttributeType attributeType,
                   byte[]... values)
                   throws LdapException

    Removes the specified binary values from an attribute.

    If at least one value is removed, this method returns true.

    If there is no more value after having removed the values, the attribute will be removed too.

    If the attribute does not exist, nothing is done and the method returns false

    Parameters:
    attributeType - The attribute type
    values - the values to be removed
    Returns:
    true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
    Throws:
    LdapException

    remove

    boolean remove(AttributeType attributeType,
                   String... values)
                   throws LdapException

    Removes the specified String values from an attribute.

    If at least one value is removed, this method returns true.

    If there is no more value after having removed the values, the attribute will be removed too.

    If the attribute does not exist, nothing is done and the method returns false

    Parameters:
    attributeType - The attribute type
    values - the values to be removed
    Returns:
    true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
    Throws:
    LdapException

    remove

    boolean remove(AttributeType attributeType,
                   Value<?>... values)
                   throws LdapException

    Removes the specified values from an attribute.

    If at least one value is removed, this method returns true.

    If there is no more value after having removed the values, the attribute will be removed too.

    If the attribute does not exist, nothing is done and the method returns false

    Parameters:
    attributeType - The attribute type
    values - the values to be removed
    Returns:
    true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
    Throws:
    LdapException

    remove

    List<Attribute> remove(Attribute... attributes)
                           throws LdapException
    Removes the specified attributes. The removed attributes are returned by this method. If there were no attribute the return value is null.

    Parameters:
    attributes - the attributes to be removed
    Returns:
    the removed attribute, if exists; otherwise null
    Throws:
    LdapException

    removeAttributes

    void removeAttributes(AttributeType... attributes)

    Removes the attribute with the specified AttributeTypes.

    The removed attribute are returned by this method.

    If there is no attribute with the specified AttributeTypes, the return value is null.

    Parameters:
    attributes - the AttributeTypes to be removed

    remove

    boolean remove(String upId,
                   byte[]... values)
                   throws LdapException

    Removes the specified binary values from an attribute.

    If at least one value is removed, this method returns true.

    If there is no more value after having removed the values, the attribute will be removed too.

    If the attribute does not exist, nothing is done and the method returns false

    Parameters:
    upId - The attribute ID
    values - the attribute's values to be removed
    Returns:
    true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
    Throws:
    LdapException

    remove

    boolean remove(String upId,
                   String... values)
                   throws LdapException

    Removes the specified String values from an attribute.

    If at least one value is removed, this method returns true.

    If there is no more value after havong removed the values, the attribute will be removed too.

    If the attribute does not exist, nothing is done and the method returns false

    Parameters:
    upId - The attribute ID
    values - the attribute's values to be removed
    Returns:
    true if at least a value is removed, false if no values have been removed or if the attribute does not exist.
    Throws:
    LdapException

    remove

    boolean remove(String upId,
                   Value<?>... values)
                   throws LdapException

    Removes the specified values from an attribute.

    If at least one value is removed, this method returns true.

    If there is no more value after having removed the values, the attribute will be removed too.

    If the attribute does not exist, nothing is done and the method returns false

    Parameters:
    upId - The attribute ID
    values - the attribute's values to be removed
    Returns:
    true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
    Throws:
    LdapException - if the attribute does not exists

    removeAttributes

    void removeAttributes(String... attributes)

    Removes the attribute with the specified alias.

    The removed attribute are returned by this method.

    If there is no attribute with the specified alias, the return value is null.

    Parameters:
    attributes - an aliased name of the attribute to be removed

    contains

    boolean contains(AttributeType attributeType,
                     byte[]... values)
    Checks if an entry contains an attribute with some given binary values.

    Parameters:
    attributeType - The Attribute we are looking for.
    values - The searched binary values.
    Returns:
    true if all the values are found within the attribute, false otherwise, or if the attributes does not exist.

    contains

    boolean contains(AttributeType attributeType,
                     String... values)
    Checks if an entry contains an attribute with some given String values.

    Parameters:
    attributeType - The Attribute we are looking for.
    values - The searched String values.
    Returns:
    true if all the values are found within the attribute, false otherwise, or if the attributes does not exist.

    contains

    boolean contains(AttributeType attributeType,
                     Value<?>... values)
    Checks if an entry contains an attribute with some given binary values.

    Parameters:
    attributeType - The Attribute we are looking for.
    values - The searched values.
    Returns:
    true if all the values are found within the attribute, false otherwise, or if the attributes does not exist.

    containsAttribute

    boolean containsAttribute(AttributeType attributeType)
    Checks if an entry contains a specific AttributeType.

    Parameters:
    attributeType - The AttributeType to look for.
    Returns:
    true if the attribute is found within the entry.

    contains

    boolean contains(Attribute... attributes)

    Checks if an entry contains a list of attributes.

    If the list is null or empty, this method will return true if the entry has no attribute, false otherwise.

    Parameters:
    attributes - The Attributes to look for
    Returns:
    true if all the attributes are found within the entry, false if at least one of them is not present.

    contains

    boolean contains(String upId,
                     byte[]... values)
    Checks if an entry contains an attribute with some binary values.

    Parameters:
    upId - The Attribute we are looking for.
    values - The searched values.
    Returns:
    true if all the values are found within the attribute, false if at least one value is not present or if the ID is not valid.

    contains

    boolean contains(String upId,
                     String... values)
    Checks if an entry contains an attribute with some String values.

    Parameters:
    upId - The Attribute we are looking for.
    values - The searched values.
    Returns:
    true if all the values are found within the attribute, false if at least one value is not present or if the ID is not valid.

    contains

    boolean contains(String upId,
                     Value<?>... values)
    Checks if an entry contains an attribute with some values.

    Parameters:
    upId - The Attribute we are looking for.
    values - The searched values.
    Returns:
    true if all the values are found within the attribute, false if at least one value is not present or if the ID is not valid.

    containsAttribute

    boolean containsAttribute(String... attributes)
    Checks if an entry contains some specific attributes.

    Parameters:
    attributes - The Attributes to look for.
    Returns:
    true if the attributes are all found within the entry.

    size

    int size()
    Returns the number of attributes.

    Returns:
    the number of attributes

    isSchemaAware

    boolean isSchemaAware()
    Tells if the Entry is schema aware

    Returns:
    true if the Entry is schema aware

    toString

    String toString(String tabs)
    A pretty-pinter for Entries

    Parameters:
    tabs - The tabs to add before any output
    Returns:
    The pretty-printed entry


    Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.