Interface LDAPAddRequest

  • All Superinterfaces:
    Cloneable, LDAPRequest

    public interface LDAPAddRequest
    extends LDAPRequest
    Represents an LDAP add request, which can be used to perform an LDAPv3 add operation to create a new entry in the directory.

    Note that LDAPAddRequest objects should not be considered thread-safe, thus should not be used concurrently by multiple threads. Each thread wishing to process a request should have its own instance of that request.

    See Also:
    LDAPProvider
    • Method Detail

      • clone

        LDAPAddRequest clone()
        Creates and returns a copy of this add request that may be modified without impacting this request.
        Specified by:
        clone in interface LDAPRequest
        Returns:
        A copy of this add request that may be modified without impacting this request.
      • getDN

        String getDN()
        Returns the distinguished name for this add request.
        Returns:
        the distinguished name for this add request.
      • setDN

        LDAPAddRequest setDN​(String dn)
        Sets the distinguished name for this add request.
        Parameters:
        dn - the distinguished name for this add request. It must not be null.
        Returns:
        this add request.
      • addAttribute

        LDAPAddRequest addAttribute​(LDAPAttribute attribute)
        Adds the specified attribute to this add request.
        Parameters:
        attribute - the attribute to add. It must not be null.
        Returns:
        this add request.
      • addAttribute

        LDAPAddRequest addAttribute​(String attrName,
                                    String... values)
        Adds the attribute with given name and set of values to this add request.
        Parameters:
        attrName - the name of the attribute to add. It must not be null.
        values - the set of values for the attribute to add. It must not be null.
        Returns:
        this add request.
      • addAttribute

        LDAPAddRequest addAttribute​(String attrName,
                                    byte[]... values)
        Adds the attribute with given name and set of values to this add request.
        Parameters:
        attrName - the name of the attribute to add. It must not be null.
        values - the set of values for the attribute to add. It must not be null.
        Returns:
        this add request.
      • attributesIterator

        Iterator<LDAPAttribute> attributesIterator()
        Returns an iterator over the set of attributes from this add request.
        Returns:
        an iterator over the set of attributes from this add request.
      • getAttribute

        LDAPAttribute getAttribute​(String attrName)
        Returns the specified attribute from this add request.
        Parameters:
        attrName - the name of the attribute to return. It must not be null.
        Returns:
        the attribute in the add request that has exactly the same name, or null (if no attribute in the add request matches the specified name).
      • hasAttribute

        boolean hasAttribute​(LDAPAttribute attribute)
        Reports whether this add request contains the specified attribute.
        Parameters:
        attribute - the attribute for which to make the check. It must not be null.
        Returns:
        true if the add request contains the specified attribute, or false if not.
      • hasAttribute

        boolean hasAttribute​(String attrName)
        Reports whether this add request contains the specified attribute.
        Parameters:
        attrName - the name of the attribute for which to make the check. It must not be null.
        Returns:
        true if the add request contains the specified attribute, or false if not.
      • hasAttributeValue

        boolean hasAttributeValue​(String attrName,
                                  byte[] value)
        Reports whether this add request contains an attribute with the given name and value.
        Parameters:
        attrName - the name of the attribute for which to make the check. It must not be null.
        value - the value for which to make the check. It must not be null.
        Returns:
        true if the add request contains an attribute with the specified name and value, or false if not.
      • hasAttributeValue

        boolean hasAttributeValue​(String attrName,
                                  String value)
        Reports whether this add request contains an attribute with the given name and value.
        Parameters:
        attrName - the name of the attribute for which to make the check. It must not be null.
        value - the value for which to make the check. It must not be null.
        Returns:
        true if the add request contains an attribute with the specified name and value, or false if not.
      • removeAttribute

        boolean removeAttribute​(String attrName)
        Removes the attribute with the specified name from this add request.
        Parameters:
        attrName - the name of the attribute to remove. It must not be null.
        Returns:
        true if the attribute was removed from this add request, or false if no attribute in the add request matches the specified name.
      • removeAttributeValue

        boolean removeAttributeValue​(String attrName,
                                     byte[] value)
        Removes the specified attribute value from this add request.
        Parameters:
        attrName - the name of the attribute to remove. It must not be null.
        value - the value of the attribute to remove. It must not be null.
        Returns:
        true if the attribute value was removed from this add request, or false if no attribute value in the add request matches the specified attribute value.
      • removeAttributeValue

        boolean removeAttributeValue​(String attrName,
                                     String value)
        Removes the specified attribute value from this add request.
        Parameters:
        attrName - the name of the attribute to remove. It must not be null.
        value - the value of the attribute to remove. It must not be null.
        Returns:
        true if the attribute value was removed from this add request, or false if no attribute value in the add request matches the specified attribute value.
      • replaceAttribute

        LDAPAddRequest replaceAttribute​(LDAPAttribute attribute)
        Replaces the specified attribute in this add request. If no attribute with the given name exists in the add request, it will be added.
        Parameters:
        attribute - the attribute to be replaced in this add request. It must not be null.
        Returns:
        this add request.
      • replaceAttribute

        LDAPAddRequest replaceAttribute​(String attrName,
                                        byte[]... values)
        Replaces the specified attribute in this add request. If no attribute with the given name exists in the add request, it will be added.
        Parameters:
        attrName - the name of the attribute to be replaced. It must not be null.
        values - the new set of values for the attribute. It must not be null.
        Returns:
        this add request.
      • replaceAttribute

        LDAPAddRequest replaceAttribute​(String attrName,
                                        String... values)
        Replaces the specified attribute in this add request. If no attribute with the given name exists in the add request, it will be added.
        Parameters:
        attrName - the name of the attribute to be replaced. It must not be null.
        values - the new set of values for the attribute. It must not be null.
        Returns:
        this add request.
      • setAttributes

        LDAPAddRequest setAttributes​(LDAPAttribute... attributes)
        Replaces the existing set of attributes for this add request with the provided attributes.
        Parameters:
        attributes - the set of attributes for this add request. It must not be null.
        Returns:
        this add request.
      • setQueryTimeout

        LDAPAddRequest setQueryTimeout​(long timeout)
        Sets the maximum time, in milliseconds, to wait for a response from the server when processing this add request.

        A value of zero indicates that no timeout should be enforced.

        A value that is less than zero indicates that the default query timeout for the underlying connection should be used.

        Specified by:
        setQueryTimeout in interface LDAPRequest
        Parameters:
        timeout - the maximum time, in milliseconds, to wait for a response from the server when processing this add request.
        Returns:
        this add request.