@PublicAPI(stability=UNCOMMITTED, mayInstantiate=true, mayExtend=false, mayInvoke=true) public class Entry extends Object
Constructor and Description |
---|
Entry(Dn dn,
Map<ObjectClass,String> objectClasses,
Map<AttributeType,List<Attribute>> userAttributes,
Map<AttributeType,List<Attribute>> operationalAttributes)
Creates a new entry with the provided information.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(Attribute attribute)
Ensures that this entry contains the provided attribute and its values.
|
void |
addAttribute(Attribute attribute,
Collection<? super ByteString> duplicateValues)
Ensures that this entry contains the provided attribute and its values.
|
void |
addAttribute(Attribute attribute,
List<ByteString> duplicateValues)
Ensures that this entry contains the provided attribute and its values.
|
Entry |
addAttribute(String attributeDescription,
String... values)
Ensures that this entry contains the provided attribute and values.
|
void |
addObjectClass(ObjectClass oc)
Adds the provided objectClass to this entry.
|
void |
applyModification(Modification mod)
Applies the provided modification to this entry.
|
void |
applyModification(Modification mod,
boolean relaxConstraints)
Applies the provided modification to this entry.
|
void |
applyModifications(List<Modification> mods)
Applies all of the provided modifications to this entry.
|
boolean |
conformsToSchema(Entry parentEntry,
boolean parentProvided,
boolean validateNameForms,
boolean validateStructureRules,
LocalizableMessageBuilder invalidReason)
Indicates whether this entry conforms to the server's schema requirements.
|
static Entry |
decode(ByteSequenceReader entryBuffer,
CompressedSchema compressedSchema)
Decodes the provided byte array as an entry using the V3 encoding.
|
Entry |
duplicate()
Creates a duplicate of this entry that may be altered without impacting the information in this entry.
|
Entry |
duplicateWithVirtualAttributes()
Creates a duplicate of this entry that may be altered without impacting the information in this entry.
|
void |
encode(ByteStringBuilder buffer,
EntryEncodeConfig config)
Encodes this entry into a form that is suitable for long-term persistent storage.
|
boolean |
equals(Object o)
Indicates whether the provided object is equal to this entry.
|
Entry |
filterEntry(Set<String> attrNameList,
boolean omitValues,
boolean omitReal,
boolean omitVirtual)
Returns an entry containing only those attributes of this entry which match the provided criteria.
|
Dn |
getAliasedDN()
Retrieves the DN of the entry referenced by this alias entry.
|
Iterable<Attribute> |
getAllAttributes()
Returns an
Iterable containing all of the attributes in this entry, excluding the objectClass attribute. |
Iterable<Attribute> |
getAllAttributes(AttributeDescription attributeDescription)
Retrieves the requested attribute element(s) for the specified attribute description.
|
List<Attribute> |
getAllAttributes(AttributeType attributeType)
Retrieves the requested attribute element(s) for the specified attribute type.
|
List<Attribute> |
getAllAttributes(AttributeType attributeType,
boolean includeSubordinates)
Retrieves the requested attribute element(s) for the specified attribute type.
|
Iterable<Attribute> |
getAllAttributes(String nameOrOID)
Retrieves the requested attribute element(s) for the attribute with the specified name or OID.
|
Object |
getAttachment()
Retrieves the attachment for this entry.
|
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. |
List<Attribute> |
getAttribute(AttributeType attributeType)
Deprecated.
|
List<Attribute> |
getAttribute(AttributeType attributeType,
boolean includeSubordinates)
Deprecated.
|
List<Attribute> |
getAttribute(String nameOrOID)
Deprecated.
|
List<Attribute> |
getAttributes()
Deprecated.
|
Dn |
getName()
Retrieves the distinguished name for this entry.
|
Attribute |
getObjectClassAttribute()
Retrieves an attribute holding the objectclass information for this entry.
|
Map<ObjectClass,String> |
getObjectClasses()
Retrieves the set of objectclasses defined for this entry.
|
List<Attribute> |
getOperationalAttribute(AttributeDescription attributeDescription)
Retrieves the requested operational attribute element(s) for the specified attribute type.
|
List<Attribute> |
getOperationalAttribute(AttributeType attributeType)
Retrieves the requested operational attribute element(s) for the specified attribute type.
|
Map<AttributeType,List<Attribute>> |
getOperationalAttributes()
Retrieves the entire set of operational attributes for this entry.
|
String |
getProtocolElementName()
Retrieves the name of the protocol associated with this protocol element.
|
Set<String> |
getReferralURLs()
Retrieves the set of referral URLs that are included in this referral entry.
|
ObjectClass |
getStructuralObjectClass()
Retrieves the structural objectclass for this entry.
|
List<Attribute> |
getUserAttribute(AttributeType attributeType)
Retrieves the requested user attribute element(s) for the specified attribute type.
|
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 |
hasObjectClass(ObjectClass objectClass)
Indicates whether this entry has the specified objectclass.
|
boolean |
hasOperationalAttribute(AttributeType attributeType)
Indicates whether this entry contains the specified operational attribute.
|
boolean |
hasValue(AttributeDescription attributeDescription,
ByteString value)
Indicates whether this entry contains the specified attribute value.
|
boolean |
hasValue(AttributeType attributeType,
ByteString value)
Indicates whether this entry contains the specified attribute value.
|
void |
incrementAttribute(Attribute attribute)
Increments an attribute in this entry by the amount specified in the provided attribute.
|
boolean |
isAlias()
Indicates whether this entry meets the criteria to consider it an alias (e.g., it contains the "aliasObject"
objectclass and a "alias" attribute).
|
boolean |
isCollectiveAttributeSubentry()
Indicates whether the entry meets the criteria to consider it an RFC 3671 LDAP collective attributes subentry
(i.e., it contains the "collectiveAttributeSubentry" objectclass).
|
boolean |
isInheritedCollectiveAttributeSubentry()
Indicates whether the entry meets the criteria to consider it an inherited collective attributes subentry (i.e.,
it contains the "inheritedCollectiveAttributeSubentry" objectclass).
|
boolean |
isInheritedFromDNCollectiveAttributeSubentry()
Indicates whether the entry meets the criteria to consider it an inherited from DN collective attributes subentry
(i.e., it contains the "inheritedFromDNCollectiveAttributeSubentry" objectclass).
|
boolean |
isInheritedFromRDNCollectiveAttributeSubentry()
Indicates whether the entry meets the criteria to consider it an inherited from RDN collective attributes
subentry (i.e., it contains the "inheritedFromRDNCollectiveAttributeSubentry" objectclass).
|
boolean |
isLDAPSubentry()
Indicates whether this entry meets the criteria to consider it an LDAP subentry (i.e., it contains the
"ldapSubentry" objectclass).
|
boolean |
isPasswordPolicySubentry()
Indicates whether the entry meets the criteria to consider it a LDAP password policy subentry (i.e., it contains
the "pwdPolicy" objectclass of LDAP Password Policy Internet-Draft).
|
boolean |
isReferral()
Indicates whether this entry meets the criteria to consider it a referral (e.g., it contains the "referral"
objectclass and a "ref" attribute).
|
boolean |
isSubentry()
Indicates whether this entry meets the criteria to consider it an RFC 3672 LDAP subentry (i.e., it contains the
"subentry" objectclass).
|
boolean |
matchesBaseAndScope(Dn baseDN,
SearchScope scope)
Indicates whether this entry falls within the range of the provided search base DN and scope.
|
AttributeParser |
parseAttribute(String attributeDescription)
Returns a parser for the named attribute contained in this entry.
|
void |
processVirtualAttributes()
Performs any necessary virtual attribute processing for this entry.
|
void |
putAttribute(AttributeType attributeType,
List<Attribute> attributeList)
Puts the provided attribute in this entry.
|
boolean |
removeAttribute(Attribute attribute,
Collection<? super ByteString> missingValues)
Ensures that this entry does not contain the provided attribute values.
|
boolean |
removeAttribute(Attribute attribute,
List<ByteString> missingValues)
Ensures that this entry does not contain the provided attribute values.
|
boolean |
removeAttribute(AttributeType attributeType)
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 |
setAttachment(Object attachment)
Specifies the attachment for this entry.
|
void |
setDN(Dn dn)
Specifies the distinguished name for this entry.
|
List<StringBuilder> |
toLDIF()
Retrieves a list of the lines for this entry in LDIF form.
|
boolean |
toLDIF(LDIFExportConfig exportConfig)
Writes this entry in LDIF form according to the provided configuration.
|
String |
toLDIFString()
Retrieves a string representation of this entry in LDIF form.
|
void |
toSingleLineString(StringBuilder buffer)
Appends a single-line representation of this entry to the provided buffer.
|
String |
toString()
Retrieves a string representation of this protocol element.
|
public Entry(Dn dn, Map<ObjectClass,String> 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 Dn getName()
public void setDN(Dn dn)
dn
- The distinguished name for this entry.public Map<ObjectClass,String> getObjectClasses()
public boolean hasObjectClass(ObjectClass objectClass)
objectClass
- The objectclass for which to make the determination.true
if this entry has the specified objectclass, or false
if not.public ObjectClass getStructuralObjectClass()
null
if there is none for some reason. If there are
multiple structural classes in the entry, then the first will be returned.public void addObjectClass(ObjectClass oc) throws DirectoryException
oc
- The objectClass to add to this entry.DirectoryException
- If a problem occurs while attempting to add the objectclass to this entry.public Iterable<Attribute> getAllAttributes()
Iterable
containing all of the attributes in this entry, excluding the objectClass attribute.
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 Attribute getObjectClassAttribute()
null
if it does not have any
objectclass information.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 List<Attribute> getAllAttributes(AttributeType attributeType)
attributeType
- The attribute type to retrieve.public List<Attribute> getAllAttributes(AttributeType attributeType, boolean includeSubordinates)
attributeType
- The attribute type to retrieve.includeSubordinates
- Whether to include any subordinate attributes of the attribute type being retrieved.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 List<Attribute> getUserAttribute(AttributeType attributeType)
attributeType
- The attribute type to retrieve.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 List<Attribute> getOperationalAttribute(AttributeType attributeType)
attributeType
- The attribute type to retrieve.public List<Attribute> getOperationalAttribute(AttributeDescription attributeDescription)
attributeDescription
- The attribute description to retrieve.public void putAttribute(AttributeType attributeType, List<Attribute> attributeList)
attributeType
- The attribute type for the set of attributes to add.attributeList
- The set of attributes to add for the given type.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, String... 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 void 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.public 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 void incrementAttribute(Attribute attribute) throws DirectoryException
attribute
- The attribute identifying the attribute to be increment and the amount it is to be incremented by. The
attribute must contain a single value.DirectoryException
- If a problem occurs while attempting to increment the provided attribute. This may occur if the
provided attribute was not single valued or if it could not be parsed as an integer of if the
existing attribute values could not be parsed as integers.public boolean removeAttribute(AttributeType attributeType)
attributeType
- 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 boolean hasValue(AttributeDescription attributeDescription, ByteString 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 boolean hasValue(AttributeType attributeType, ByteString value)
attributeType
- The attribute type for the attribute.value
- The value for the attribute.true
if this entry contains the specified attribute value, false
otherwise.public void applyModification(Modification mod, boolean relaxConstraints) throws DirectoryException
mod
- The modification to apply to this entry.relaxConstraints
- indicates if the modification constraints are relaxed to match the ones of a set (add existing value
and delete absent value do not fail)DirectoryException
- If a problem occurs while attempting to apply the modification. Note that even if a problem occurs,
then the entry may have been altered in some way.public void applyModification(Modification mod) throws DirectoryException
mod
- The modification to apply to this entry.DirectoryException
- If a problem occurs while attempting to apply the modification. Note that even if a problem occurs,
then the entry may have been altered in some way.public void applyModifications(List<Modification> mods) throws DirectoryException
mods
- The modifications to apply to this entry.DirectoryException
- If a problem occurs while attempting to apply the modifications. Note that even if a problem occurs,
then the entry may have been altered in some way.public boolean conformsToSchema(Entry parentEntry, boolean parentProvided, boolean validateNameForms, boolean validateStructureRules, LocalizableMessageBuilder invalidReason)
parentEntry
- The entry that is the immediate parent of this entry, which may be checked for DIT structure rule
conformance. This may be null
if there is no parent or if it is unavailable to the caller.parentProvided
- Indicates whether the caller attempted to provide the parent. If not, then the parent entry will be
loaded on demand if it is required.validateNameForms
- Indicates whether to validate the entry against name form definitions. This should only be
true
for add and modify DN operations, as well as for for imports.validateStructureRules
- Indicates whether to validate the entry against DIT structure rule definitions. This should only be
true
for add and modify DN operations.invalidReason
- The buffer to which an explanation will be appended if this entry does not conform to the server's
schema configuration.true
if this entry conforms to the server's schema requirements, or false
if it does not.public Object getAttachment()
null
if there is none.public void setAttachment(Object attachment)
attachment
- The attachment for this entry, or null
if there should not be an attachment.public Entry duplicateWithVirtualAttributes()
This method is equivalent to the following code:
Entry e = entry.duplicate(); e.processVirtualAttributes();
duplicate()
public Entry duplicate()
Note: this method does not copy the virtual attributes.
To obtain the virtual attributes, run processVirtualAttributes()
after calling the current method.
duplicateWithVirtualAttributes()
public boolean isReferral()
true
if this entry meets the criteria to consider it a referral, or false
if not.public Set<String> getReferralURLs()
isReferral()
returns true
.null
if it is
not a referral.public boolean isAlias()
true
if this entry meets the criteria to consider it an alias, or false
if not.public Dn getAliasedDN() throws DirectoryException
isAlias()
returns true
.null
if it is not an alias.DirectoryException
- If there is an aliasedObjectName attribute but its value cannot be parsed as a DN.public boolean isLDAPSubentry()
true
if this entry meets the criteria to consider it an LDAP subentry, or false
if not.public boolean isSubentry()
true
if this entry meets the criteria to consider it an RFC 3672 LDAP subentry, or false
if not.public boolean isCollectiveAttributeSubentry()
true
if this entry meets the criteria to consider it an RFC 3671 LDAP collective attributes
subentry, or false
if not.public boolean isInheritedCollectiveAttributeSubentry()
true
if this entry meets the criteria to consider it an inherited collective attributes subentry,
or false
if not.public boolean isInheritedFromDNCollectiveAttributeSubentry()
true
if this entry meets the criteria to consider it an inherited from DN collective attributes
subentry, or false
if not.public boolean isInheritedFromRDNCollectiveAttributeSubentry()
true
if this entry meets the criteria to consider it an inherited from RDN collective attributes
subentry, or false
if not.public boolean isPasswordPolicySubentry()
true
if this entry meets the criteria to consider it a LDAP Password Policy Internet-Draft
subentry, or false
if not.public boolean matchesBaseAndScope(Dn baseDN, SearchScope scope)
baseDN
- The base DN for which to make the determination.scope
- The search scope for which to make the determination.true
if this entry is within the given base and scope, or false
if it is not.public void processVirtualAttributes()
public void encode(ByteStringBuilder buffer, EntryEncodeConfig config) throws DirectoryException
buffer
- The buffer to encode into.config
- The configuration that may be used to control how the entry is encoded.DirectoryException
- If a problem occurs while attempting to encode the entry.public static Entry decode(ByteSequenceReader entryBuffer, CompressedSchema compressedSchema) throws DirectoryException
entryBuffer
- The byte buffer containing the data to be decoded.compressedSchema
- The compressed schema manager to use when decoding tokenized schema elements.DirectoryException
- If the provided byte array cannot be decoded as an entry.public List<StringBuilder> toLDIF()
public boolean toLDIF(LDIFExportConfig exportConfig) throws IOException, LDIFException
exportConfig
- The configuration that specifies how the entry should be written.true
if the entry is actually written, or false
if it is not for some reason.IOException
- If a problem occurs while writing the information.LDIFException
- If a problem occurs while trying to determine whether to write the entry.public String getProtocolElementName()
public int hashCode()
public boolean equals(Object o)
public String toString()
public String toLDIFString()
public void toSingleLineString(StringBuilder buffer)
buffer
- The buffer to which the information should be written.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> attrNameList, boolean omitValues, boolean omitReal, boolean omitVirtual)
attrNameList
- The list of 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.@Deprecated public List<Attribute> getAttributes()
@Deprecated public List<Attribute> getAttribute(AttributeType attributeType)
attributeType
- The attribute type to retrieve.getAllAttributes(AttributeType)
@Deprecated public List<Attribute> getAttribute(AttributeType attributeType, boolean includeSubordinates)
attributeType
- The attribute type to retrieve.includeSubordinates
- Whether to include any subordinate attributes of the attribute type being retrieved.getAllAttributes(AttributeType,boolean)
@Deprecated public List<Attribute> getAttribute(String nameOrOID)
nameOrOID
- The name or OID of the attribute to returngetAllAttributes(String)
public void addAttribute(Attribute attribute, List<ByteString> duplicateValues)
attribute
- The attribute to add or merge with this entry.duplicateValues
- A list to which any duplicate values will be added.addAttribute(Attribute, Collection)
public boolean removeAttribute(Attribute attribute, List<ByteString> missingValues)
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.removeAttribute(Attribute, Collection)
Copyright 2010-2020 ForgeRock AS.