@Mutable @NotExtensible @ThreadSafety(level=NOT_THREADSAFE) public class Entry extends java.lang.Object implements LDIFRecord
Entry entry = new Entry( "dn: dc=example,dc=com", "objectClass: top", "objectClass: domain", "dc: example");
diff(com.unboundid.ldap.sdk.Entry, com.unboundid.ldap.sdk.Entry, boolean, java.lang.String...)
method may be used to obtain the set of differences
between two entries, and to retrieve a list of Modification
objects
that can be used to modify one entry so that it contains the same set of
data as another. The applyModifications(com.unboundid.ldap.sdk.Entry, boolean, com.unboundid.ldap.sdk.Modification...)
method may be used to
apply a set of modifications to an entry.
Modifier | Constructor and Description |
---|---|
|
Entry(DN dn)
Creates a new entry with the provided DN and no attributes.
|
|
Entry(DN dn,
Attribute... attributes)
Creates a new entry with the provided DN and set of attributes.
|
|
Entry(DN dn,
java.util.Collection<Attribute> attributes)
Creates a new entry with the provided DN and set of attributes.
|
|
Entry(DN dn,
Schema schema)
Creates a new entry with the provided DN and no attributes.
|
|
Entry(DN dn,
Schema schema,
Attribute... attributes)
Creates a new entry with the provided DN and set of attributes.
|
|
Entry(DN dn,
Schema schema,
java.util.Collection<Attribute> attributes)
Creates a new entry with the provided DN and set of attributes.
|
protected |
Entry(Entry e)
Creates a new entry that wraps the provided entry.
|
|
Entry(Schema schema,
java.lang.String... entryLines)
Creates a new entry from the provided LDIF representation.
|
|
Entry(java.lang.String... entryLines)
Creates a new entry from the provided LDIF representation.
|
|
Entry(java.lang.String dn)
Creates a new entry with the provided DN and no attributes.
|
|
Entry(java.lang.String dn,
Attribute... attributes)
Creates a new entry with the provided DN and set of attributes.
|
|
Entry(java.lang.String dn,
java.util.Collection<Attribute> attributes)
Creates a new entry with the provided DN and set of attributes.
|
|
Entry(java.lang.String dn,
Schema schema)
Creates a new entry with the provided DN and no attributes.
|
|
Entry(java.lang.String dn,
Schema schema,
Attribute... attributes)
Creates a new entry with the provided DN and set of attributes.
|
|
Entry(java.lang.String dn,
Schema schema,
java.util.Collection<Attribute> attributes)
Creates a new entry with the provided DN and set of attributes.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addAttribute(Attribute attribute)
Adds the provided attribute to this entry.
|
boolean |
addAttribute(java.lang.String attributeName,
byte[]... attributeValues)
Adds the provided attribute to this entry.
|
boolean |
addAttribute(java.lang.String attributeName,
byte[] attributeValue)
Adds the specified attribute value to this entry, if it is not already
present.
|
boolean |
addAttribute(java.lang.String attributeName,
java.util.Collection<java.lang.String> attributeValues)
Adds the provided attribute to this entry.
|
boolean |
addAttribute(java.lang.String attributeName,
java.lang.String... attributeValues)
Adds the provided attribute to this entry.
|
boolean |
addAttribute(java.lang.String attributeName,
java.lang.String attributeValue)
Adds the specified attribute value to this entry, if it is not already
present.
|
static Entry |
applyModifications(Entry entry,
boolean lenient,
java.util.List<Modification> modifications)
Creates a duplicate of the provided entry with the given set of
modifications applied to it.
|
static Entry |
applyModifications(Entry entry,
boolean lenient,
Modification... modifications)
Creates a duplicate of the provided entry with the given set of
modifications applied to it.
|
static Entry |
applyModifyDN(Entry entry,
java.lang.String newRDN,
boolean deleteOldRDN)
Creates a duplicate of the provided entry with the appropriate changes for
a modify DN operation.
|
static Entry |
applyModifyDN(Entry entry,
java.lang.String newRDN,
boolean deleteOldRDN,
java.lang.String newSuperiorDN)
Creates a duplicate of the provided entry with the appropriate changes for
a modify DN operation.
|
static java.util.List<Modification> |
diff(Entry sourceEntry,
Entry targetEntry,
boolean ignoreRDN,
boolean reversible,
boolean byteForByte,
java.lang.String... attributes)
Retrieves a set of modifications that can be applied to the source entry in
order to make it match the target entry.
|
static java.util.List<Modification> |
diff(Entry sourceEntry,
Entry targetEntry,
boolean ignoreRDN,
boolean reversible,
java.lang.String... attributes)
Retrieves a set of modifications that can be applied to the source entry in
order to make it match the target entry.
|
static java.util.List<Modification> |
diff(Entry sourceEntry,
Entry targetEntry,
boolean ignoreRDN,
java.lang.String... attributes)
Retrieves a set of modifications that can be applied to the source entry in
order to make it match the target entry.
|
Entry |
duplicate()
Creates a new entry that is a duplicate of this entry.
|
boolean |
equals(java.lang.Object o)
Indicates whether the provided object is equal to this entry.
|
Attribute |
getAttribute(java.lang.String attributeName)
Retrieves the attribute with the specified name.
|
Attribute |
getAttribute(java.lang.String attributeName,
Schema schema)
Retrieves the attribute with the specified name.
|
java.util.Collection<Attribute> |
getAttributes()
Retrieves the set of attributes contained in this entry.
|
java.util.List<Attribute> |
getAttributesWithOptions(java.lang.String baseName,
java.util.Set<java.lang.String> options)
Retrieves the list of attributes with the given base name and all of the
specified options.
|
java.lang.String |
getAttributeValue(java.lang.String attributeName)
Retrieves the value for the specified attribute, if available.
|
java.lang.Boolean |
getAttributeValueAsBoolean(java.lang.String attributeName)
Retrieves the value for the specified attribute as a Boolean, if available.
|
java.util.Date |
getAttributeValueAsDate(java.lang.String attributeName)
Retrieves the value for the specified attribute as a Date, formatted using
the generalized time syntax, if available.
|
DN |
getAttributeValueAsDN(java.lang.String attributeName)
Retrieves the value for the specified attribute as a DN, if available.
|
java.lang.Integer |
getAttributeValueAsInteger(java.lang.String attributeName)
Retrieves the value for the specified attribute as an Integer, if
available.
|
java.lang.Long |
getAttributeValueAsLong(java.lang.String attributeName)
Retrieves the value for the specified attribute as a Long, if available.
|
byte[][] |
getAttributeValueByteArrays(java.lang.String attributeName)
Retrieves the set of values for the specified attribute as byte arrays, if
available.
|
byte[] |
getAttributeValueBytes(java.lang.String attributeName)
Retrieves the value for the specified attribute as a byte array, if
available.
|
java.lang.String[] |
getAttributeValues(java.lang.String attributeName)
Retrieves the set of values for the specified attribute, if available.
|
java.lang.String |
getDN()
Retrieves the DN for this entry.
|
Attribute |
getObjectClassAttribute()
Retrieves the "objectClass" attribute from the entry, if available.
|
java.lang.String[] |
getObjectClassValues()
Retrieves the values of the "objectClass" attribute from the entry, if
available.
|
DN |
getParentDN()
Retrieves the parent DN for this entry.
|
java.lang.String |
getParentDNString()
Retrieves the parent DN for this entry as a string.
|
DN |
getParsedDN()
Retrieves the parsed DN for this entry.
|
RDN |
getRDN()
Retrieves the RDN for this entry.
|
protected Schema |
getSchema()
Retrieves the schema that will be used for this entry, if any.
|
boolean |
hasAttribute(Attribute attribute)
Indicates whether this entry contains the specified attribute.
|
boolean |
hasAttribute(java.lang.String attributeName)
Indicates whether this entry contains the specified attribute.
|
boolean |
hasAttribute(java.lang.String attributeName,
Schema schema)
Indicates whether this entry contains the specified attribute.
|
boolean |
hasAttributeValue(java.lang.String attributeName,
byte[] attributeValue)
Indicates whether this entry contains an attribute with the given name and
value.
|
boolean |
hasAttributeValue(java.lang.String attributeName,
byte[] attributeValue,
MatchingRule matchingRule)
Indicates whether this entry contains an attribute with the given name and
value.
|
boolean |
hasAttributeValue(java.lang.String attributeName,
java.lang.String attributeValue)
Indicates whether this entry contains an attribute with the given name and
value.
|
boolean |
hasAttributeValue(java.lang.String attributeName,
java.lang.String attributeValue,
MatchingRule matchingRule)
Indicates whether this entry contains an attribute with the given name and
value.
|
int |
hashCode()
Generates a hash code for this entry.
|
boolean |
hasObjectClass(java.lang.String objectClassName)
Indicates whether this entry contains the specified object class.
|
static Entry |
intersectEntries(Entry... entries)
Intersects the contents of all provided entries so that the resulting
entry will contain only attribute values present in all of the provided
entries.
|
boolean |
matchesBaseAndScope(DN baseDN,
SearchScope scope)
Indicates whether this entry falls within the range of the provided search
base DN and scope.
|
boolean |
matchesBaseAndScope(java.lang.String baseDN,
SearchScope scope)
Indicates whether this entry falls within the range of the provided search
base DN and scope.
|
static Entry |
mergeEntries(Entry... entries)
Merges the contents of all provided entries so that the resulting entry
will contain all attribute values present in at least one of the entries.
|
boolean |
removeAttribute(java.lang.String attributeName)
Removes the specified attribute from this entry.
|
boolean |
removeAttributeValue(java.lang.String attributeName,
byte[] attributeValue)
Removes the specified attribute value from this entry if it is present.
|
boolean |
removeAttributeValue(java.lang.String attributeName,
byte[] attributeValue,
MatchingRule matchingRule)
Removes the specified attribute value from this entry if it is present.
|
boolean |
removeAttributeValue(java.lang.String attributeName,
java.lang.String attributeValue)
Removes the specified attribute value from this entry if it is present.
|
boolean |
removeAttributeValue(java.lang.String attributeName,
java.lang.String attributeValue,
MatchingRule matchingRule)
Removes the specified attribute value from this entry if it is present.
|
boolean |
removeAttributeValues(java.lang.String attributeName,
byte[]... attributeValues)
Removes the specified attribute values from this entry if they are present.
|
boolean |
removeAttributeValues(java.lang.String attributeName,
java.lang.String... attributeValues)
Removes the specified attribute values from this entry if they are present.
|
void |
setAttribute(Attribute attribute)
Adds the provided attribute to this entry, replacing any existing set of
values for the associated attribute.
|
void |
setAttribute(java.lang.String attributeName,
byte[]... attributeValues)
Adds the provided attribute to this entry, replacing any existing set of
values for the associated attribute.
|
void |
setAttribute(java.lang.String attributeName,
byte[] attributeValue)
Adds the provided attribute to this entry, replacing any existing set of
values for the associated attribute.
|
void |
setAttribute(java.lang.String attributeName,
java.util.Collection<java.lang.String> attributeValues)
Adds the provided attribute to this entry, replacing any existing set of
values for the associated attribute.
|
void |
setAttribute(java.lang.String attributeName,
java.lang.String... attributeValues)
Adds the provided attribute to this entry, replacing any existing set of
values for the associated attribute.
|
void |
setAttribute(java.lang.String attributeName,
java.lang.String attributeValue)
Adds the provided attribute to this entry, replacing any existing set of
values for the associated attribute.
|
void |
setDN(DN dn)
Specifies the DN for this entry.
|
void |
setDN(java.lang.String dn)
Specifies the DN for this entry.
|
java.lang.String[] |
toLDIF()
Retrieves an LDIF representation of this entry, with each attribute value
on a separate line.
|
void |
toLDIF(ByteStringBuffer buffer)
Appends an LDIF representation of this entry to the provided buffer.
|
void |
toLDIF(ByteStringBuffer buffer,
int wrapColumn)
Appends an LDIF representation of this entry to the provided buffer.
|
java.lang.String[] |
toLDIF(int wrapColumn)
Retrieves an LDIF representation of this entry, with each attribute value
on a separate line.
|
java.lang.String |
toLDIFString()
Retrieves an LDIF-formatted string representation of this entry.
|
java.lang.String |
toLDIFString(int wrapColumn)
Retrieves an LDIF-formatted string representation of this entry.
|
void |
toLDIFString(java.lang.StringBuilder buffer)
Appends an LDIF-formatted string representation of this entry to the
provided buffer.
|
void |
toLDIFString(java.lang.StringBuilder buffer,
int wrapColumn)
Appends an LDIF-formatted string representation of this entry to the
provided buffer.
|
java.lang.String |
toString()
Retrieves a string representation of this entry.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this entry to the provided buffer.
|
protected Entry(@NotNull Entry e)
e
- The entry to be wrapped.public Entry(@NotNull java.lang.String dn)
dn
- The DN for this entry. It must not be null
.public Entry(@NotNull java.lang.String dn, @Nullable Schema schema)
dn
- The DN for this entry. It must not be null
.schema
- The schema to use for operations involving this entry. It
may be null
if no schema is available.public Entry(@NotNull DN dn)
dn
- The DN for this entry. It must not be null
.public Entry(@NotNull DN dn, @Nullable Schema schema)
dn
- The DN for this entry. It must not be null
.schema
- The schema to use for operations involving this entry. It
may be null
if no schema is available.public Entry(@NotNull java.lang.String dn, @NotNull Attribute... attributes)
dn
- The DN for this entry. It must not be null
.attributes
- The set of attributes for this entry. It must not be
null
.public Entry(@NotNull java.lang.String dn, @Nullable Schema schema, @NotNull Attribute... attributes)
dn
- The DN for this entry. It must not be null
.schema
- The schema to use for operations involving this entry.
It may be null
if no schema is available.attributes
- The set of attributes for this entry. It must not be
null
.public Entry(@NotNull DN dn, @NotNull Attribute... attributes)
dn
- The DN for this entry. It must not be null
.attributes
- The set of attributes for this entry. It must not be
null
.public Entry(@NotNull DN dn, @Nullable Schema schema, @NotNull Attribute... attributes)
dn
- The DN for this entry. It must not be null
.schema
- The schema to use for operations involving this entry.
It may be null
if no schema is available.attributes
- The set of attributes for this entry. It must not be
null
.public Entry(@NotNull java.lang.String dn, @NotNull java.util.Collection<Attribute> attributes)
dn
- The DN for this entry. It must not be null
.attributes
- The set of attributes for this entry. It must not be
null
.public Entry(@NotNull java.lang.String dn, @Nullable Schema schema, @NotNull java.util.Collection<Attribute> attributes)
dn
- The DN for this entry. It must not be null
.schema
- The schema to use for operations involving this entry.
It may be null
if no schema is available.attributes
- The set of attributes for this entry. It must not be
null
.public Entry(@NotNull DN dn, @NotNull java.util.Collection<Attribute> attributes)
dn
- The DN for this entry. It must not be null
.attributes
- The set of attributes for this entry. It must not be
null
.public Entry(@NotNull DN dn, @Nullable Schema schema, @NotNull java.util.Collection<Attribute> attributes)
dn
- The DN for this entry. It must not be null
.schema
- The schema to use for operations involving this entry.
It may be null
if no schema is available.attributes
- The set of attributes for this entry. It must not be
null
.public Entry(@NotNull java.lang.String... entryLines) throws LDIFException
entryLines
- The set of lines that comprise an LDIF representation
of the entry. It must not be null
or empty.LDIFException
- If the provided lines cannot be decoded as an entry
in LDIF format.public Entry(@Nullable Schema schema, @NotNull java.lang.String... entryLines) throws LDIFException
schema
- The schema to use for operations involving this entry.
It may be null
if no schema is available.entryLines
- The set of lines that comprise an LDIF representation
of the entry. It must not be null
or empty.LDIFException
- If the provided lines cannot be decoded as an entry
in LDIF format.@NotNull public final java.lang.String getDN()
getDN
in interface LDIFRecord
public void setDN(@NotNull java.lang.String dn)
dn
- The DN for this entry. It must not be null
.public void setDN(@NotNull DN dn)
dn
- The DN for this entry. It must not be null
.@NotNull public final DN getParsedDN() throws LDAPException
getParsedDN
in interface LDIFRecord
LDAPException
- If the DN string cannot be parsed as a valid DN.@Nullable public final RDN getRDN() throws LDAPException
null
if the DN is the null DN.LDAPException
- If the DN string cannot be parsed as a valid DN.@Nullable public final DN getParentDN() throws LDAPException
null
if there is no
parent.LDAPException
- If the DN string cannot be parsed as a valid DN.@NotNull public final java.lang.String getParentDNString() throws LDAPException
null
if there
is no parent.LDAPException
- If the DN string cannot be parsed as a valid DN.@Nullable protected Schema getSchema()
null
if
no schema was provided.public final boolean hasAttribute(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to make the
determination. It must not be null
.true
if this entry contains the specified attribute, or
false
if not.public final boolean hasAttribute(@NotNull java.lang.String attributeName, @Nullable Schema schema)
attributeName
- The name of the attribute for which to make the
determination. It must not be null
.schema
- The schema to use to determine whether there may be
alternate names for the specified attribute. It may
be null
if no schema is available.true
if this entry contains the specified attribute, or
false
if not.public final boolean hasAttribute(@NotNull Attribute attribute)
true
if this entry contains an attribute with the same
name and exact set of values.attribute
- The attribute for which to make the determination. It
must not be null
.true
if this entry contains the specified attribute, or
false
if not.public final boolean hasAttributeValue(@NotNull java.lang.String attributeName, @NotNull java.lang.String attributeValue)
attributeName
- The name of the attribute for which to make the
determination. It must not be null
.attributeValue
- The value for which to make the determination. It
must not be null
.true
if this entry contains an attribute with the
specified name and value, or false
if not.public final boolean hasAttributeValue(@NotNull java.lang.String attributeName, @NotNull java.lang.String attributeValue, @NotNull MatchingRule matchingRule)
attributeName
- The name of the attribute for which to make the
determination. It must not be null
.attributeValue
- The value for which to make the determination. It
must not be null
.matchingRule
- The matching rule to use to make the determination.
It must not be null
.true
if this entry contains an attribute with the
specified name and value, or false
if not.public final boolean hasAttributeValue(@NotNull java.lang.String attributeName, @NotNull byte[] attributeValue)
attributeName
- The name of the attribute for which to make the
determination. It must not be null
.attributeValue
- The value for which to make the determination. It
must not be null
.true
if this entry contains an attribute with the
specified name and value, or false
if not.public final boolean hasAttributeValue(@NotNull java.lang.String attributeName, @NotNull byte[] attributeValue, @NotNull MatchingRule matchingRule)
attributeName
- The name of the attribute for which to make the
determination. It must not be null
.attributeValue
- The value for which to make the determination. It
must not be null
.matchingRule
- The matching rule to use to make the determination.
It must not be null
.true
if this entry contains an attribute with the
specified name and value, or false
if not.public final boolean hasObjectClass(@NotNull java.lang.String objectClassName)
objectClassName
- The name of the object class for which to make the
determination. It must not be null
.true
if this entry contains the specified object class, or
false
if not.@NotNull public final java.util.Collection<Attribute> getAttributes()
@Nullable public final Attribute getAttribute(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute to retrieve. It must not
be null
.null
if the
specified attribute is not present in this entry.@Nullable public final Attribute getAttribute(@NotNull java.lang.String attributeName, @Nullable Schema schema)
attributeName
- The name of the attribute to retrieve. It must not
be null
.schema
- The schema to use to determine whether there may be
alternate names for the specified attribute. It may
be null
if no schema is available.null
if the
specified attribute is not present in this entry.@NotNull public final java.util.List<Attribute> getAttributesWithOptions(@NotNull java.lang.String baseName, @Nullable java.util.Set<java.lang.String> options)
baseName
- The base name (without any options) for the attribute to
retrieve. It must not be null
.options
- The set of options that should be included in the
attributes that are returned. It may be empty or
null
if all attributes with the specified base
name should be returned, regardless of the options that
they contain (if any).@Nullable public java.lang.String getAttributeValue(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to retrieve the
value. It must not be null
.null
if that
attribute is not available.@Nullable public byte[] getAttributeValueBytes(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to retrieve the
value. It must not be null
.null
if that attribute is not available.@Nullable public java.lang.Boolean getAttributeValueAsBoolean(@NotNull java.lang.String attributeName)
TRUE
. Values of "false", "f", "no", "n", "off", and
"0" will be interpreted as FALSE
.attributeName
- The name of the attribute for which to retrieve the
value. It must not be null
.null
if that attribute is not available or the value
cannot be parsed as a Boolean.@Nullable public java.util.Date getAttributeValueAsDate(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to retrieve the
value. It must not be null
.null
if that attribute is not available or the value
cannot be parsed as a Date.@Nullable public DN getAttributeValueAsDN(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to retrieve the
value. It must not be null
.null
if that attribute is not available or the value cannot be parsed
as a DN.@Nullable public java.lang.Integer getAttributeValueAsInteger(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to retrieve the
value. It must not be null
.null
if that attribute is not available or the value
cannot be parsed as an Integer.@Nullable public java.lang.Long getAttributeValueAsLong(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to retrieve the
value. It must not be null
.null
if that attribute is not available or the value
cannot be parsed as a Long.@Nullable public java.lang.String[] getAttributeValues(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to retrieve the
values. It must not be null
.null
if
that attribute is not available.@Nullable public byte[][] getAttributeValueByteArrays(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute for which to retrieve the
values. It must not be null
.null
if that attribute is not available.@Nullable public final Attribute getObjectClassAttribute()
null
if
that attribute not available.@Nullable public final java.lang.String[] getObjectClassValues()
null
if that attribute is not available.public boolean addAttribute(@NotNull Attribute attribute)
attribute
- The attribute to be added. It must not be null
.true
if the entry was updated, or false
because
the specified attribute already existed with all provided values.public boolean addAttribute(@NotNull java.lang.String attributeName, @NotNull java.lang.String attributeValue)
attributeName
- The name for the attribute to be added. It must
not be null
.attributeValue
- The value for the attribute to be added. It must
not be null
.true
if the entry was updated, or false
because
the specified attribute already existed with the given value.public boolean addAttribute(@NotNull java.lang.String attributeName, @NotNull byte[] attributeValue)
attributeName
- The name for the attribute to be added. It must
not be null
.attributeValue
- The value for the attribute to be added. It must
not be null
.true
if the entry was updated, or false
because
the specified attribute already existed with the given value.public boolean addAttribute(@NotNull java.lang.String attributeName, @NotNull java.lang.String... attributeValues)
attributeName
- The name for the attribute to be added. It must
not be null
.attributeValues
- The value for the attribute to be added. It must
not be null
.true
if the entry was updated, or false
because
the specified attribute already existed with all provided values.public boolean addAttribute(@NotNull java.lang.String attributeName, @NotNull byte[]... attributeValues)
attributeName
- The name for the attribute to be added. It must
not be null
.attributeValues
- The value for the attribute to be added. It must
not be null
.true
if the entry was updated, or false
because
the specified attribute already existed with all provided values.public boolean addAttribute(@NotNull java.lang.String attributeName, @NotNull java.util.Collection<java.lang.String> attributeValues)
attributeName
- The name for the attribute to be added. It must
not be null
.attributeValues
- The value for the attribute to be added. It must
not be null
.true
if the entry was updated, or false
because
the specified attribute already existed with all provided values.public boolean removeAttribute(@NotNull java.lang.String attributeName)
attributeName
- The name of the attribute to remove. It must not be
null
.true
if the attribute was removed from the entry, or
false
if it was not present.public boolean removeAttributeValue(@NotNull java.lang.String attributeName, @NotNull java.lang.String attributeValue)
attributeName
- The name of the attribute from which to remove the
value. It must not be null
.attributeValue
- The value to remove from the attribute. It must
not be null
.true
if the attribute value was removed from the entry, or
false
if it was not present.public boolean removeAttributeValue(@NotNull java.lang.String attributeName, @NotNull java.lang.String attributeValue, @Nullable MatchingRule matchingRule)
attributeName
- The name of the attribute from which to remove the
value. It must not be null
.attributeValue
- The value to remove from the attribute. It must
not be null
.matchingRule
- The matching rule to use for the attribute. It may
be null
to use the matching rule associated
with the attribute.true
if the attribute value was removed from the entry, or
false
if it was not present.public boolean removeAttributeValue(@NotNull java.lang.String attributeName, @NotNull byte[] attributeValue)
attributeName
- The name of the attribute from which to remove the
value. It must not be null
.attributeValue
- The value to remove from the attribute. It must
not be null
.true
if the attribute value was removed from the entry, or
false
if it was not present.public boolean removeAttributeValue(@NotNull java.lang.String attributeName, @NotNull byte[] attributeValue, @Nullable MatchingRule matchingRule)
attributeName
- The name of the attribute from which to remove the
value. It must not be null
.attributeValue
- The value to remove from the attribute. It must
not be null
.matchingRule
- The matching rule to use for the attribute. It may
be null
to use the matching rule associated
with the attribute.true
if the attribute value was removed from the entry, or
false
if it was not present.public boolean removeAttributeValues(@NotNull java.lang.String attributeName, @NotNull java.lang.String... attributeValues)
attributeName
- The name of the attribute from which to remove the
values. It must not be null
.attributeValues
- The set of values to remove from the attribute.
It must not be null
.true
if any attribute values were removed from the entry,
or false
none of them were present.public boolean removeAttributeValues(@NotNull java.lang.String attributeName, @NotNull byte[]... attributeValues)
attributeName
- The name of the attribute from which to remove the
values. It must not be null
.attributeValues
- The set of values to remove from the attribute.
It must not be null
.true
if any attribute values were removed from the entry,
or false
none of them were present.public void setAttribute(@NotNull Attribute attribute)
attribute
- The attribute to be included in this entry. It must not
be null
.public void setAttribute(@NotNull java.lang.String attributeName, @NotNull java.lang.String attributeValue)
attributeName
- The name to use for the attribute. It must not be
null
.attributeValue
- The value to use for the attribute. It must not be
null
.public void setAttribute(@NotNull java.lang.String attributeName, @NotNull byte[] attributeValue)
attributeName
- The name to use for the attribute. It must not be
null
.attributeValue
- The value to use for the attribute. It must not be
null
.public void setAttribute(@NotNull java.lang.String attributeName, @NotNull java.lang.String... attributeValues)
attributeName
- The name to use for the attribute. It must not be
null
.attributeValues
- The set of values to use for the attribute. It
must not be null
.public void setAttribute(@NotNull java.lang.String attributeName, @NotNull byte[]... attributeValues)
attributeName
- The name to use for the attribute. It must not be
null
.attributeValues
- The set of values to use for the attribute. It
must not be null
.public void setAttribute(@NotNull java.lang.String attributeName, @NotNull java.util.Collection<java.lang.String> attributeValues)
attributeName
- The name to use for the attribute. It must not be
null
.attributeValues
- The set of values to use for the attribute. It
must not be null
.public boolean matchesBaseAndScope(@NotNull java.lang.String baseDN, @NotNull SearchScope scope) throws LDAPException
baseDN
- The base DN for which to make the determination. It must
not be null
.scope
- The scope for which to make the determination. It must not
be null
.true
if this entry is within the range of the provided
base and scope, or false
if not.LDAPException
- If a problem occurs while making the determination.public boolean matchesBaseAndScope(@NotNull DN baseDN, @NotNull SearchScope scope) throws LDAPException
baseDN
- The base DN for which to make the determination. It must
not be null
.scope
- The scope for which to make the determination. It must not
be null
.true
if this entry is within the range of the provided
base and scope, or false
if not.LDAPException
- If a problem occurs while making the determination.@NotNull public static java.util.List<Modification> diff(@NotNull Entry sourceEntry, @NotNull Entry targetEntry, boolean ignoreRDN, @Nullable java.lang.String... attributes)
diff(sourceEntry, targetEntry, ignoreRDN, true, attributes)
.sourceEntry
- The source entry for which the set of modifications
should be generated.targetEntry
- The target entry, which is what the source entry
should look like if the returned modifications are
applied.ignoreRDN
- Indicates whether to ignore differences in the RDNs
of the provided entries. If this is false
,
then the resulting set of modifications may include
changes to the RDN attribute. If it is true
,
then differences in the entry DNs will be ignored.attributes
- The set of attributes to be compared. If this is
null
or empty, then all attributes will be
compared. Note that if a list of attributes is
specified, then matching will be performed only
against the attribute base name and any differences in
attribute options will be ignored.@NotNull public static java.util.List<Modification> diff(@NotNull Entry sourceEntry, @NotNull Entry targetEntry, boolean ignoreRDN, boolean reversible, @Nullable java.lang.String... attributes)
sourceEntry
- The source entry for which the set of modifications
should be generated.targetEntry
- The target entry, which is what the source entry
should look like if the returned modifications are
applied.ignoreRDN
- Indicates whether to ignore differences in the RDNs
of the provided entries. If this is false
,
then the resulting set of modifications may include
changes to the RDN attribute. If it is true
,
then differences in the entry DNs will be ignored.reversible
- Indicates whether to generate the diff in reversible
form. In reversible form, only the ADD or DELETE
modification types will be used so that source entry
could be reconstructed from the target and the
resulting modifications. In non-reversible form, only
the REPLACE modification type will be used. Attempts
to apply the modifications obtained when using
reversible form are more likely to fail if the entry
has been modified since the source and target forms
were obtained.attributes
- The set of attributes to be compared. If this is
null
or empty, then all attributes will be
compared. Note that if a list of attributes is
specified, then matching will be performed only
against the attribute base name and any differences in
attribute options will be ignored.@NotNull public static java.util.List<Modification> diff(@NotNull Entry sourceEntry, @NotNull Entry targetEntry, boolean ignoreRDN, boolean reversible, boolean byteForByte, @Nullable java.lang.String... attributes)
sourceEntry
- The source entry for which the set of modifications
should be generated.targetEntry
- The target entry, which is what the source entry
should look like if the returned modifications are
applied.ignoreRDN
- Indicates whether to ignore differences in the RDNs
of the provided entries. If this is false
,
then the resulting set of modifications may include
changes to the RDN attribute. If it is true
,
then differences in the entry DNs will be ignored.reversible
- Indicates whether to generate the diff in reversible
form. In reversible form, only the ADD or DELETE
modification types will be used so that source entry
could be reconstructed from the target and the
resulting modifications. In non-reversible form, only
the REPLACE modification type will be used. Attempts
to apply the modifications obtained when using
reversible form are more likely to fail if the entry
has been modified since the source and target forms
were obtained.byteForByte
- Indicates whether to use a byte-for-byte comparison to
identify which attribute values have changed. Using
byte-for-byte comparison requires additional
processing over using each attribute's associated
matching rule, but it can detect changes that would
otherwise be considered logically equivalent (e.g.,
changing the capitalization of a value that uses a
case-insensitive matching rule).attributes
- The set of attributes to be compared. If this is
null
or empty, then all attributes will be
compared. Note that if a list of attributes is
specified, then matching will be performed only
against the attribute base name and any differences in
attribute options will be ignored.@NotNull public static Entry mergeEntries(@NotNull Entry... entries)
entries
- The set of entries to be merged. At least one entry must
be provided.@NotNull public static Entry intersectEntries(@NotNull Entry... entries)
entries
- The set of entries to be intersected. At least one entry
must be provided.@NotNull public static Entry applyModifications(@NotNull Entry entry, boolean lenient, @NotNull Modification... modifications) throws LDAPException
entry
- The entry to be modified. It must not be
null
.lenient
- Indicates whether to exhibit a lenient behavior for
the modifications, which will cause it to ignore
problems like trying to add values that already
exist or to remove nonexistent attributes or values.modifications
- The set of modifications to apply to the entry. It
must not be null
or empty.LDAPException
- If a problem occurs while attempting to apply the
modifications.@NotNull public static Entry applyModifications(@NotNull Entry entry, boolean lenient, @NotNull java.util.List<Modification> modifications) throws LDAPException
entry
- The entry to be modified. It must not be
null
.lenient
- Indicates whether to exhibit a lenient behavior for
the modifications, which will cause it to ignore
problems like trying to add values that already
exist or to remove nonexistent attributes or values.modifications
- The set of modifications to apply to the entry. It
must not be null
or empty.LDAPException
- If a problem occurs while attempting to apply the
modifications.@NotNull public static Entry applyModifyDN(@NotNull Entry entry, @NotNull java.lang.String newRDN, boolean deleteOldRDN) throws LDAPException
entry
- The entry to be renamed. It must not be
null
.newRDN
- The new RDN to use for the entry. It must not be
null
.deleteOldRDN
- Indicates whether attribute values that were present
in the old RDN but are no longer present in the new
DN should be removed from the entry.LDAPException
- If a problem is encountered during modify DN
processing.@NotNull public static Entry applyModifyDN(@NotNull Entry entry, @NotNull java.lang.String newRDN, boolean deleteOldRDN, @Nullable java.lang.String newSuperiorDN) throws LDAPException
entry
- The entry to be renamed. It must not be
null
.newRDN
- The new RDN to use for the entry. It must not be
null
.deleteOldRDN
- Indicates whether attribute values that were present
in the old RDN but are no longer present in the new
DN should be removed from the entry.newSuperiorDN
- The new superior DN for the entry. If this is
null
, then the entry will remain below its
existing parent. If it is non-null
, then
the resulting DN will be a concatenation of the new
RDN and the new superior DN.LDAPException
- If a problem is encountered during modify DN
processing.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(@Nullable java.lang.Object o)
equals
in class java.lang.Object
o
- The object for which to make the determination.true
if the provided object is considered equal to this
entry, or false
if not.@NotNull public Entry duplicate()
@NotNull public final java.lang.String[] toLDIF()
toLDIF
in interface LDIFRecord
@NotNull public final java.lang.String[] toLDIF(int wrapColumn)
toLDIF
in interface LDIFRecord
wrapColumn
- The column at which long lines should be wrapped. A
value less than or equal to two indicates that no
wrapping should be performed.public final void toLDIF(@NotNull ByteStringBuffer buffer)
toLDIF
in interface LDIFRecord
buffer
- The buffer to which the LDIF representation of this entry
should be written.public final void toLDIF(@NotNull ByteStringBuffer buffer, int wrapColumn)
toLDIF
in interface LDIFRecord
buffer
- The buffer to which the LDIF representation of this
entry should be written.wrapColumn
- The column at which long lines should be wrapped. A
value less than or equal to two indicates that no
wrapping should be performed.@NotNull public final java.lang.String toLDIFString()
toLDIFString
in interface LDIFRecord
@NotNull public final java.lang.String toLDIFString(int wrapColumn)
toLDIFString
in interface LDIFRecord
wrapColumn
- The column at which long lines should be wrapped. A
value less than or equal to two indicates that no
wrapping should be performed.public final void toLDIFString(@NotNull java.lang.StringBuilder buffer)
toLDIFString
in interface LDIFRecord
buffer
- The buffer to which to append the LDIF representation of
this entry.public final void toLDIFString(@NotNull java.lang.StringBuilder buffer, int wrapColumn)
toLDIFString
in interface LDIFRecord
buffer
- The buffer to which to append the LDIF representation
of this entry.wrapColumn
- The column at which long lines should be wrapped. A
value less than or equal to two indicates that no
wrapping should be performed.@NotNull public final java.lang.String toString()
toString
in interface LDIFRecord
toString
in class java.lang.Object
public void toString(@NotNull java.lang.StringBuilder buffer)
toString
in interface LDIFRecord
buffer
- The buffer to which to append the string representation of
this entry.