@PublicAPI(stability=UNCOMMITTED, mayInstantiate=true, mayInvoke=true) public class Entry extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Entry.RemoveOnceEntryIsMigrated
Marker annotation.
|
Constructor and Description |
---|
Entry(Dn dn)
Creates a new entry with the provided information.
|
Entry(Dn dn,
Map<ObjectClass,ByteString> objectClasses,
Map<AttributeType,List<Attribute>> userAttributes,
Map<AttributeType,List<Attribute>> operationalAttributes)
Creates a new entry with the provided information.
|
Entry(Entry entry)
Creates a new entry from the provided entry.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(Attribute attribute)
Ensures that this entry contains the provided attribute and its values.
|
boolean |
addAttribute(Attribute attribute,
Collection<? super ByteString> duplicateValues)
Ensures that this entry contains the provided attribute and its values.
|
Entry |
addAttribute(String attributeDescription,
Object... values)
Ensures that this entry contains the provided attribute and values.
|
Entry |
clearAttributes()
Removes all the attributes from this entry (optional operation).
|
boolean |
containsAttribute(Attribute attribute,
Collection<? super ByteString> missingValues)
Returns
true if this entry contains all of the attribute values contained in attribute . |
boolean |
containsAttribute(String attributeDescription,
Object value)
Indicates whether this entry contains the specified attribute value.
|
boolean |
equals(Object o)
Indicates whether the provided object is equal to this entry.
|
Entry |
filterEntry(Set<String> requiredAttrNames,
boolean omitValues,
boolean omitReal,
boolean omitVirtual)
Returns an entry containing only those attributes of this entry which match the provided criteria.
|
Iterable<Attribute> |
getAllAttributes()
Returns an
Iterable containing all of the attributes in this entry. |
Iterable<Attribute> |
getAllAttributes(AttributeDescription attributeDescription)
Retrieves the requested attribute element(s) for the specified attribute description.
|
Iterable<Attribute> |
getAllAttributes(String nameOrOID)
Retrieves the requested attribute element(s) for the attribute with the specified name or OID.
|
Attribute |
getAttribute(AttributeDescription attributeDescription)
Retrieves the requested attribute element for the specified attribute type and options or
null if this
entry does not contain an attribute with the specified attribute type and options. |
Attribute |
getAttribute(String attributeDescription)
Retrieves the requested attribute element for the specified attribute type and options or
null if this
entry does not contain an attribute with the specified attribute type and options. |
int |
getAttributeCount()
Returns the number of attributes in this entry.
|
Dn |
getName()
Retrieves the distinguished name for this entry.
|
Map<AttributeType,List<Attribute>> |
getOperationalAttributes()
Retrieves the entire set of operational attributes for this entry.
|
Map<AttributeType,List<Attribute>> |
getSuppressedAttributes()
Returns the attributes suppressed by virtual attributes.
|
Map<AttributeType,List<Attribute>> |
getUserAttributes()
Retrieves the entire set of user (i.e., non-operational) attributes for this entry.
|
boolean |
hasAttribute(AttributeDescription attributeDescription)
Indicates whether this entry contains the specified attribute with all of the options in the provided set.
|
boolean |
hasAttribute(AttributeType attributeType)
Indicates whether this entry contains the specified attribute.
|
int |
hashCode()
Retrieves a hash code for this entry.
|
boolean |
hasOperationalAttribute(AttributeType attributeType)
Indicates whether this entry contains the specified operational attribute.
|
AttributeParser |
parseAttribute(AttributeDescription attributeDescription)
Returns a parser for the named attribute contained in this entry.
|
AttributeParser |
parseAttribute(String attributeDescription)
Returns a parser for the named attribute contained in this entry.
|
static Entry |
processVirtualAttributes(Entry e)
Performs any necessary virtual attribute processing for this entry.
|
boolean |
removeAttribute(Attribute attribute,
Collection<? super ByteString> missingValues)
Ensures that this entry does not contain the provided attribute values.
|
boolean |
removeAttribute(AttributeDescription attributeDescription)
Removes all instances of the specified attribute type from this entry, including any instances with options.
|
void |
replaceAttribute(Attribute attribute)
Puts the provided attribute into this entry.
|
void |
setName(Dn dn)
Specifies the distinguished name for this entry.
|
static Entry |
shallowCopyOfEntry(Entry e)
Returns a shallow copy of this entry, the attributes are shared between this entry and the returned entry.
|
String |
toString()
Retrieves a string representation of this protocol element.
|
public Entry(Dn dn, Map<ObjectClass,ByteString> objectClasses, Map<AttributeType,List<Attribute>> userAttributes, Map<AttributeType,List<Attribute>> operationalAttributes)
dn
- The distinguished name for this entry.objectClasses
- The set of objectclasses for this entry as a mapping between the objectclass and the name to use to
reference it.userAttributes
- The set of user attributes for this entry as a mapping between the attribute type and the list of
attributes with that type.operationalAttributes
- The set of operational attributes for this entry as a mapping between the attribute type and the list
of attributes with that type.public Entry(Dn dn)
dn
- The distinguished name for this entry.public Entry(Entry entry)
entry
- Entry to copy to create the new one.public Dn getName()
public void setName(Dn dn)
dn
- The distinguished name for this entry.public Iterable<Attribute> getAllAttributes()
Iterable
containing all of the attributes in this entry.
The returned Iterable
may NOT be used to remove attributes.
Iterable
containing all of the attributes.public Map<AttributeType,List<Attribute>> getUserAttributes()
public Map<AttributeType,List<Attribute>> getOperationalAttributes()
public Map<AttributeType,List<Attribute>> getSuppressedAttributes()
public boolean hasAttribute(AttributeType attributeType)
attributeType
- The attribute type for which to make the determination.true
if this entry contains the specified attribute, or false
if not.public boolean hasAttribute(AttributeDescription attributeDescription)
attributeDescription
- The attribute description for which to make the determination.true
if this entry contains the specified attribute, or false
if not.public Iterable<Attribute> getAllAttributes(String nameOrOID)
AttributeType
argument.nameOrOID
- The name or OID of the attribute to returnpublic Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription)
attributeDescription
- The attribute description to retrieve.public AttributeParser parseAttribute(String attributeDescription) throws LocalizedIllegalArgumentException, NullPointerException
The attribute description will be decoded using the schema associated with this entry (usually the default schema).
attributeDescription
- The name of the attribute to be parsed.LocalizedIllegalArgumentException
- If attributeDescription
could not be decoded using the schema associated with this entry.NullPointerException
- If attributeDescription
was null
.public AttributeParser parseAttribute(AttributeDescription attributeDescription) throws LocalizedIllegalArgumentException, NullPointerException
The attribute description will be decoded using the schema associated with this entry (usually the default schema).
attributeDescription
- The name of the attribute to be parsed.LocalizedIllegalArgumentException
- If attributeDescription
could not be decoded using the schema associated with this entry.NullPointerException
- If attributeDescription
was null
.public boolean hasOperationalAttribute(AttributeType attributeType)
attributeType
- The attribute type for which to make the determination.true
if this entry contains the specified operational attribute, or false
if not.public void addAttribute(Attribute attribute)
This method handles object class additions but will not perform any object class validation. In particular, it will create default object classes when an object class is unknown.
This method implements LDAP modification add semantics, with the exception that it allows empty attributes to be added.
attribute
- The attribute to add or merge with this entry.public Entry addAttribute(String attributeDescription, Object... values)
attributeDescription
- The name of the attribute whose values are to be added.values
- The attribute values to be added to this entry, merging any existing attribute values.LocalizedIllegalArgumentException
- If attributeDescription
could not be decoded using the schema associated with this entry.UnsupportedOperationException
- If this entry does not permit attributes or their values to be added.NullPointerException
- If attributeDescription
was null
.public boolean addAttribute(Attribute attribute, Collection<? super ByteString> duplicateValues)
This method handles object class additions but will not perform any object class validation. In particular, it will create default object classes when an object class is unknown.
This method implements LDAP modification add semantics, with the exception that it allows empty attributes to be added.
attribute
- The attribute to add or merge with this entry.duplicateValues
- A list to which any duplicate values will be added.true
if the entry changed as a result of calling this method, false
otherwisepublic void replaceAttribute(Attribute attribute)
This method handles object class replacements but will not perform any object class validation. In particular, it will create default object classes when an object class is unknown.
This method implements LDAP modification replace semantics.
attribute
- The attribute to replace in this entry.public boolean removeAttribute(AttributeDescription attributeDescription)
attributeDescription
- The attribute type for the attribute to remove from this entry.true
if the attribute was found and removed, or false
if it was not present in the entry.public boolean removeAttribute(Attribute attribute, Collection<? super ByteString> missingValues)
This method handles object class deletions.
This method implements LDAP modification delete semantics.
attribute
- The attribute containing the information to use to perform the removal.missingValues
- A list to which any values contained in the provided attribute but not present in the entry will be
added.true
if the attribute type was present and the specified values that were present were removed,
or false
if the attribute type was not present in the entry. If the attribute type was present
but only contained some of the values in the provided attribute, then this method will return
true
but will add those values to the provided list.public Entry clearAttributes()
UnsupportedOperationException
- If this entry does not permit attributes to be removed.public boolean containsAttribute(Attribute attribute, Collection<? super ByteString> missingValues)
true
if this entry contains all of the attribute values contained in attribute
. If
attribute
is empty then this method will return true
if the attribute is present in this entry,
regardless of how many values it contains.attribute
- The attribute values whose presence in this entry is to be tested.missingValues
- A collection into which missing values will be added, or null
if missing values should not be
saved.true
if this entry contains all of the attribute values contained in attribute
.NullPointerException
- If attribute
was null
.public boolean containsAttribute(String attributeDescription, Object value)
attributeDescription
- The attribute description for the attribute.value
- The value for the attribute.true
if this entry contains the specified attribute value, false
otherwise.public static Entry shallowCopyOfEntry(Entry e)
Note: this method does not copy the virtual attributes. To obtain the virtual attributes, run
processVirtualAttributes(Entry)
after calling the current method.
e
- the entry to copypublic static Entry processVirtualAttributes(Entry e)
e
- the entry where to add virtual attributespublic int hashCode()
public boolean equals(Object o)
public String toString()
public Attribute getAttribute(String attributeDescription)
null
if this
entry does not contain an attribute with the specified attribute type and options.attributeDescription
- The attribute description to retrieve.null
if the
specified attribute type is not present in this entry with the provided set of options.public Attribute getAttribute(AttributeDescription attributeDescription)
null
if this
entry does not contain an attribute with the specified attribute type and options.attributeDescription
- The attribute description to retrieve.null
if the
specified attribute type is not present in this entry with the provided set of options.public Entry filterEntry(Set<String> requiredAttrNames, boolean omitValues, boolean omitReal, boolean omitVirtual)
requiredAttrNames
- The attributes to include, may include wild cards.omitValues
- Indicates whether to omit attribute values when processing.omitReal
- Indicates whether to exclude real attributes.omitVirtual
- Indicates whether to exclude virtual attributes.public int getAttributeCount()
Copyright 2010-2018 ForgeRock AS.