Class Entry
- java.lang.Object
-
- org.opends.server.types.Entry
-
- All Implemented Interfaces:
ProtocolElement
- Direct Known Subclasses:
SearchResultEntry
@PublicAPI(stability=UNCOMMITTED, mayInstantiate=true, mayExtend=false, mayInvoke=true) public class Entry extends Object implements ProtocolElement
This class defines a data structure for a Directory Server entry. It includes a DN and a set of attributes.
The entry also contains a volatile attachment object, which should be used to associate the entry with a special type of object that is based on its contents. For example, if the entry holds access control information, then the attachment might be an object that contains a representation of that access control definition in a more useful form. This is only useful if the entry is to be cached, since the attachment may be accessed if the entry is retrieved from the cache, but if the entry is retrieved from the backend repository it cannot be guaranteed to contain any attachment (and in most cases will not). This attachment is volatile in that it is not always guaranteed to be present, it may be removed or overwritten at any time, and it will be invalidated and removed if the entry is altered in any way.
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddAttribute(Attribute attribute)Ensures that this entry contains the provided attribute and its values, ignoring any duplicate value.voidaddAttribute(Attribute attribute, Collection<? super ByteString> duplicateValues)Ensures that this entry contains the provided attribute and its values.voidaddAttribute(Attribute attribute, List<ByteString> duplicateValues)Deprecated.voidaddObjectClass(ObjectClass oc)Adds the provided objectClass to this entry.voidapplyModification(Modification mod)Applies the provided modification to this entry.voidapplyModification(Modification mod, boolean relaxConstraints)Applies the provided modification to this entry.voidapplyModifications(List<Modification> mods)Applies all of the provided modifications to this entry.booleanconformsToSchema(Entry parentEntry, boolean parentProvided, boolean validateNameForms, boolean validateStructureRules, org.forgerock.i18n.LocalizableMessageBuilder invalidReason)Indicates whether this entry conforms to the server's schema requirements.static Entrydecode(ByteSequenceReader entryBuffer)Decodes the provided byte array as an entry.static Entrydecode(ByteSequenceReader entryBuffer, CompressedSchema compressedSchema)Decodes the provided byte array as an entry using the V3 encoding.Entryduplicate(boolean processVirtual)Creates a duplicate of this entry that may be altered without impacting the information in this entry.voidencode(ByteStringBuilder buffer, EntryEncodeConfig config)Encodes this entry into a form that is suitable for long-term persistent storage.booleanequals(Object o)Indicates whether the provided object is equal to this entry.EntryfilterEntry(Set<String> attrNameList, boolean omitValues, boolean omitReal, boolean omitVirtual)Returns an entry containing only those attributes of this entry which match the provided criteria.DNgetAliasedDN()Retrieves the DN of the entry referenced by this alias entry.Iterable<Attribute>getAllAttributes()Returns anIterablecontaining all of the attributes in this entry, excluding the objectClass attribute.Iterable<Attribute>getAllAttributes(String nameOrOID)Retrieves the requested attribute element(s) for the attribute with the specified name or OID.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.ObjectgetAttachment()Retrieves the attachment for this entry.List<Attribute>getAttribute(String nameOrOID)Deprecated.AttributegetAttribute(AttributeDescription attributeDescription)Retrieves the requested attribute element for the specified attribute type and options ornullif 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>getAttributes()Deprecated.DNgetName()Retrieves the distinguished name for this entry.AttributegetObjectClassAttribute()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.StringgetProtocolElementName()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.ObjectClassgetStructuralObjectClass()Retrieves the structural objectclass for this entry.ResultCodegetTypeConformsToSchemaError()Returns a error when entry type does not conform to a schema requirements.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.booleanhasAttribute(AttributeDescription attributeDescription)Indicates whether this entry contains the specified attribute with all of the options in the provided set.booleanhasAttribute(AttributeDescription attributeDescription, boolean includeSubordinates)Indicates whether this entry contains the specified attribute with all of the options in the provided set.booleanhasAttribute(AttributeType attributeType)Indicates whether this entry contains the specified attribute.booleanhasAttribute(AttributeType attributeType, boolean includeSubordinates)Indicates whether this entry contains the specified attribute.inthashCode()Retrieves a hash code for this entry.booleanhasObjectClass(ObjectClass objectClass)Indicates whether this entry has the specified objectclass.booleanhasOperationalAttribute(AttributeType attributeType)Indicates whether this entry contains the specified operational attribute.booleanhasUserAttribute(AttributeType attributeType)Indicates whether this entry contains the specified user attribute.booleanhasValue(AttributeDescription attributeDescription, ByteString value)Indicates whether this entry contains the specified attribute value.booleanhasValue(AttributeType attributeType, ByteString value)Indicates whether this entry contains the specified attribute value.voidincrementAttribute(Attribute attribute)Increments an attribute in this entry by the amount specified in the provided attribute.booleanisAlias()Indicates whether this entry meets the criteria to consider it an alias (e.g., it contains the "aliasObject" objectclass and a "alias" attribute).booleanisCollectiveAttributeSubentry()Indicates whether the entry meets the criteria to consider it an RFC 3671 LDAP collective attributes subentry (i.e., it contains the "collectiveAttributeSubentry" objectclass).booleanisInheritedCollectiveAttributeSubentry()Indicates whether the entry meets the criteria to consider it an inherited collective attributes subentry (i.e., it contains the "inheritedCollectiveAttributeSubentry" objectclass).booleanisInheritedFromDNCollectiveAttributeSubentry()Indicates whether the entry meets the criteria to consider it an inherited from DN collective attributes subentry (i.e., it contains the "inheritedFromDNCollectiveAttributeSubentry" objectclass).booleanisInheritedFromRDNCollectiveAttributeSubentry()Indicates whether the entry meets the criteria to consider it an inherited from RDN collective attributes subentry (i.e., it contains the "inheritedFromRDNCollectiveAttributeSubentry" objectclass).booleanisLDAPSubentry()Indicates whether this entry meets the criteria to consider it an LDAP subentry (i.e., it contains the "ldapSubentry" objectclass).booleanisPasswordPolicySubentry()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).booleanisReferral()Indicates whether this entry meets the criteria to consider it a referral (e.g., it contains the "referral" objectclass and a "ref" attribute).booleanisSubentry()Indicates whether this entry meets the criteria to consider it an RFC 3672 LDAP subentry (i.e., it contains the "subentry" objectclass).booleanmatchesBaseAndScope(DN baseDN, SearchScope scope)Indicates whether this entry falls within the range of the provided search base DN and scope.AttributeParserparseAttribute(String attributeDescription)Returns a parser for the named attribute contained in this entry.voidprocessVirtualAttributes()Performs any necessary virtual attribute processing for this entry.voidputAttribute(AttributeType attributeType, List<Attribute> attributeList)Puts the provided attribute in this entry.booleanremoveAttribute(AttributeType attributeType)Removes all instances of the specified attribute type from this entry, including any instances with options.booleanremoveAttribute(Attribute attribute, Collection<? super ByteString> missingValues)Ensures that this entry does not contain the provided attribute values.booleanremoveAttribute(Attribute attribute, List<ByteString> missingValues)Deprecated.voidreplaceAttribute(Attribute attribute)Puts the provided attribute into this entry.voidsetAttachment(Object attachment)Specifies the attachment for this entry.voidsetDN(DN dn)Specifies the distinguished name for this entry.List<StringBuilder>toLDIF()Retrieves a list of the lines for this entry in LDIF form.booleantoLDIF(LDIFExportConfig exportConfig)Writes this entry in LDIF form according to the provided configuration.StringtoLDIFString()Retrieves a string representation of this entry in LDIF form.voidtoSingleLineString(StringBuilder buffer)Appends a single-line representation of this entry to the provided buffer.StringtoString()Retrieves a string representation of this protocol element.voidtoString(StringBuilder buffer)Appends a string representation of this protocol element to the provided buffer.voidtoString(StringBuilder buffer, int indent)Appends a string representation of this protocol element to the provided buffer.
-
-
-
Constructor Detail
-
Entry
public 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.- Parameters:
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.
-
-
Method Detail
-
getName
public DN getName()
Retrieves the distinguished name for this entry.- Returns:
- The distinguished name for this entry.
-
setDN
public void setDN(DN dn)
Specifies the distinguished name for this entry.- Parameters:
dn- The distinguished name for this entry.
-
getObjectClasses
public Map<ObjectClass,String> getObjectClasses()
Retrieves the set of objectclasses defined for this entry. The caller should be allowed to modify the contents of this list, but if it does then it should also invalidate the attachment.- Returns:
- The set of objectclasses defined for this entry.
-
hasObjectClass
public boolean hasObjectClass(ObjectClass objectClass)
Indicates whether this entry has the specified objectclass.- Parameters:
objectClass- The objectclass for which to make the determination.- Returns:
trueif this entry has the specified objectclass, orfalseif not.
-
getStructuralObjectClass
public ObjectClass getStructuralObjectClass()
Retrieves the structural objectclass for this entry.- Returns:
- The structural objectclass for this entry, or
nullif there is none for some reason. If there are multiple structural classes in the entry, then the first will be returned.
-
addObjectClass
public void addObjectClass(ObjectClass oc) throws DirectoryException
Adds the provided objectClass to this entry.- Parameters:
oc- The objectClass to add to this entry.- Throws:
DirectoryException- If a problem occurs while attempting to add the objectclass to this entry.
-
getAllAttributes
public Iterable<Attribute> getAllAttributes()
Returns anIterablecontaining all of the attributes in this entry, excluding the objectClass attribute.The returned
Iterablemay NOT be used to remove attributes.- Returns:
- An
Iterablecontaining all of the attributes.
-
getUserAttributes
public Map<AttributeType,List<Attribute>> getUserAttributes()
Retrieves the entire set of user (i.e., non-operational) attributes for this entry. The caller should be allowed to modify the contents of this list, but if it does then it should also invalidate the attachment.- Returns:
- The entire set of user attributes for this entry.
-
getOperationalAttributes
public Map<AttributeType,List<Attribute>> getOperationalAttributes()
Retrieves the entire set of operational attributes for this entry. The caller should be allowed to modify the contents of this list, but if it does then it should also invalidate the attachment.- Returns:
- The entire set of operational attributes for this entry.
-
getObjectClassAttribute
public Attribute getObjectClassAttribute()
Retrieves an attribute holding the objectclass information for this entry. The returned attribute must not be altered.- Returns:
- An attribute holding the objectclass information for
this entry, or
nullif it does not have any objectclass information.
-
hasAttribute
public boolean hasAttribute(AttributeType attributeType)
Indicates whether this entry contains the specified attribute. Any subordinate attribute of the specified attribute will also be used in the determination.- Parameters:
attributeType- The attribute type for which to make the determination.- Returns:
trueif this entry contains the specified attribute, orfalseif not.
-
hasAttribute
public boolean hasAttribute(AttributeType attributeType, boolean includeSubordinates)
Indicates whether this entry contains the specified attribute.- Parameters:
attributeType- The attribute type for which to make the determination.includeSubordinates- Whether to include any subordinate attributes of the attribute type being retrieved.- Returns:
trueif this entry contains the specified attribute, orfalseif not.
-
hasAttribute
public boolean hasAttribute(AttributeDescription attributeDescription)
Indicates whether this entry contains the specified attribute with all of the options in the provided set. Any subordinate attribute of the specified attribute will also be used in the determination.- Parameters:
attributeDescription- The attribute description for which to make the determination.- Returns:
trueif this entry contains the specified attribute, orfalseif not.
-
hasAttribute
public boolean hasAttribute(AttributeDescription attributeDescription, boolean includeSubordinates)
Indicates whether this entry contains the specified attribute with all of the options in the provided set.- Parameters:
attributeDescription- The attribute description for which to make the determination.includeSubordinates- Whether to include any subordinate attributes of the attribute type being retrieved.- Returns:
trueif this entry contains the specified attribute, orfalseif not.
-
getAllAttributes
public List<Attribute> getAllAttributes(AttributeType attributeType)
Retrieves the requested attribute element(s) for the specified attribute type. The list returned may include multiple elements if the same attribute exists in the entry multiple times with different sets of options. It may also include any subordinate attributes of the attribute being retrieved.- Parameters:
attributeType- The attribute type to retrieve.- Returns:
- The requested attribute element(s) for the specified attribute type, or an empty list if the specified attribute type is not present in this entry.
-
getAllAttributes
public List<Attribute> getAllAttributes(AttributeType attributeType, boolean includeSubordinates)
Retrieves the requested attribute element(s) for the specified attribute type. The list returned may include multiple elements if the same attribute exists in the entry multiple times with different sets of options.- Parameters:
attributeType- The attribute type to retrieve.includeSubordinates- Whether to include any subordinate attributes of the attribute type being retrieved.- Returns:
- The requested attribute element(s) for the specified attribute type, or an empty list if the specified attribute type is not present in this entry.
-
getAllAttributes
public Iterable<Attribute> getAllAttributes(String nameOrOID)
Retrieves the requested attribute element(s) for the attribute with the specified name or OID. The list returned may include multiple elements if the same attribute exists in the entry multiple times with different sets of options. It may also include any subordinate attributes of the attribute being retrieved.
Note that this method should only be used in cases in which the Directory Server schema has no reference of an attribute type with the specified name. It is not as accurate or efficient as the version of this method that takes anAttributeTypeargument.- Parameters:
nameOrOID- The name or OID of the attribute to return- Returns:
- The requested attribute element(s) for the specified attribute type, or an empty list if the specified attribute type is not present in this entry.
-
getAllAttributes
public Iterable<Attribute> getAllAttributes(AttributeDescription attributeDescription)
Retrieves the requested attribute element(s) for the specified attribute description. The list returned may include multiple elements if the same attribute exists in the entry multiple times with different sets of options. It may also include any subordinate attributes of the attribute being retrieved.- Parameters:
attributeDescription- The attribute description to retrieve.- Returns:
- The requested attribute element(s) for the specified attribute type, or an empty list if the specified attribute type is not present in this entry with the provided set of options.
-
parseAttribute
public AttributeParser parseAttribute(String attributeDescription) throws org.forgerock.i18n.LocalizedIllegalArgumentException, NullPointerException
Returns a parser for the named attribute contained in this entry.The attribute description will be decoded using the schema associated with this entry (usually the default schema).
- Parameters:
attributeDescription- The name of the attribute to be parsed.- Returns:
- A parser for the named attribute.
- Throws:
org.forgerock.i18n.LocalizedIllegalArgumentException- IfattributeDescriptioncould not be decoded using the schema associated with this entry.NullPointerException- IfattributeDescriptionwasnull.
-
hasUserAttribute
public boolean hasUserAttribute(AttributeType attributeType)
Indicates whether this entry contains the specified user attribute.- Parameters:
attributeType- The attribute type for which to make the determination.- Returns:
trueif this entry contains the specified user attribute, orfalseif not.
-
getUserAttribute
public List<Attribute> getUserAttribute(AttributeType attributeType)
Retrieves the requested user attribute element(s) for the specified attribute type. The list returned may include multiple elements if the same attribute exists in the entry multiple times with different sets of options.- Parameters:
attributeType- The attribute type to retrieve.- Returns:
- The requested attribute element(s) for the specified attribute type, or an empty list if there is no such user attribute.
-
hasOperationalAttribute
public boolean hasOperationalAttribute(AttributeType attributeType)
Indicates whether this entry contains the specified operational attribute.- Parameters:
attributeType- The attribute type for which to make the determination.- Returns:
trueif this entry contains the specified operational attribute, orfalseif not.
-
getOperationalAttribute
public List<Attribute> getOperationalAttribute(AttributeType attributeType)
Retrieves the requested operational attribute element(s) for the specified attribute type. The list returned may include multiple elements if the same attribute exists in the entry multiple times with different sets of options.- Parameters:
attributeType- The attribute type to retrieve.- Returns:
- The requested attribute element(s) for the specified attribute type, or an empty list if there is no such operational attribute.
-
getOperationalAttribute
public List<Attribute> getOperationalAttribute(AttributeDescription attributeDescription)
Retrieves the requested operational attribute element(s) for the specified attribute type. The list returned may include multiple elements if the same attribute exists in the entry multiple times with different sets of options.- Parameters:
attributeDescription- The attribute description to retrieve.- Returns:
- The requested attribute element(s) for the specified attribute type, or an empty list if there is no such operational attribute with the specified set of options.
-
putAttribute
public void putAttribute(AttributeType attributeType, List<Attribute> attributeList)
Puts the provided attribute in this entry. If an attribute already exists with the provided type, it will be overwritten. Otherwise, a new attribute will be added. Note that no validation will be performed.- Parameters:
attributeType- The attribute type for the set of attributes to add.attributeList- The set of attributes to add for the given type.
-
addAttribute
public void addAttribute(Attribute attribute, Collection<? super ByteString> duplicateValues)
Ensures that this entry contains the provided attribute and its values. If an attribute with the provided type already exists, then its attribute values will be merged.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.
- Parameters:
attribute- The attribute to add or merge with this entry.duplicateValues- A list to which any duplicate values will be added.
-
addAttribute
public void addAttribute(Attribute attribute)
Ensures that this entry contains the provided attribute and its values, ignoring any duplicate value.- Parameters:
attribute- The attribute to add or merge with this entry.- See Also:
addAttribute(Attribute, Collection)
-
replaceAttribute
public void replaceAttribute(Attribute attribute)
Puts the provided attribute into this entry. If an attribute with the provided type and options already exists, then it will be replaced. If the provided attribute is empty then any existing attribute will be completely removed.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.
- Parameters:
attribute- The attribute to replace in this entry.
-
incrementAttribute
public void incrementAttribute(Attribute attribute) throws DirectoryException
Increments an attribute in this entry by the amount specified in the provided attribute.- Parameters:
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.- Throws:
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.
-
removeAttribute
public boolean removeAttribute(AttributeType attributeType)
Removes all instances of the specified attribute type from this entry, including any instances with options. If the provided attribute type is the objectclass type, then all objectclass values will be removed (but must be replaced for the entry to be valid). If the specified attribute type is not present in this entry, then this method will have no effect.- Parameters:
attributeType- The attribute type for the attribute to remove from this entry.- Returns:
trueif the attribute was found and removed, orfalseif it was not present in the entry.
-
removeAttribute
public boolean removeAttribute(Attribute attribute, Collection<? super ByteString> missingValues)
Ensures that this entry does not contain the provided attribute values. If the provided attribute is empty, then all values of the associated attribute type will be removed. Otherwise, only the specified values will be removed.This method handles object class deletions.
This method implements LDAP modification delete semantics.
- Parameters:
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.- Returns:
trueif the attribute type was present and the specified values that were present were removed, orfalseif 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 returntruebut will add those values to the provided list.
-
hasValue
public boolean hasValue(AttributeDescription attributeDescription, ByteString value)
Indicates whether this entry contains the specified attribute value.- Parameters:
attributeDescription- The attribute description for the attribute.value- The value for the attribute.- Returns:
trueif this entry contains the specified attribute value,falseotherwise.
-
hasValue
public boolean hasValue(AttributeType attributeType, ByteString value)
Indicates whether this entry contains the specified attribute value.- Parameters:
attributeType- The attribute type for the attribute.value- The value for the attribute.- Returns:
trueif this entry contains the specified attribute value,falseotherwise.
-
applyModification
public void applyModification(Modification mod, boolean relaxConstraints) throws DirectoryException
Applies the provided modification to this entry. No schema checking will be performed.- Parameters:
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)- Throws:
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.
-
applyModification
public void applyModification(Modification mod) throws DirectoryException
Applies the provided modification to this entry. No schema checking will be performed.- Parameters:
mod- The modification to apply to this entry.- Throws:
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.
-
applyModifications
public void applyModifications(List<Modification> mods) throws DirectoryException
Applies all of the provided modifications to this entry.- Parameters:
mods- The modifications to apply to this entry.- Throws:
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.
-
getTypeConformsToSchemaError
public ResultCode getTypeConformsToSchemaError()
Returns a error when entry type does not conform to a schema requirements. Otherwise returnsnull
-
conformsToSchema
public boolean conformsToSchema(Entry parentEntry, boolean parentProvided, boolean validateNameForms, boolean validateStructureRules, org.forgerock.i18n.LocalizableMessageBuilder invalidReason)
Indicates whether this entry conforms to the server's schema requirements. The checks performed by this method include:- Make sure that all required attributes are present, either in the list of user or operational attributes.
- Make sure that all user attributes are allowed by at least one of the objectclasses. The operational attributes will not be checked in this manner.
- Make sure that all single-valued attributes contained in the entry have only a single value.
- Make sure that the entry contains a single structural objectclass.
- Make sure that the entry complies with any defined name forms, DIT content rules, and DIT structure rules.
- Parameters:
parentEntry- The entry that is the immediate parent of this entry, which may be checked for DIT structure rule conformance. This may benullif 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 betruefor 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 betruefor 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.- Returns:
trueif this entry conforms to the server's schema requirements, orfalseif it does not.
-
getAttachment
public Object getAttachment()
Retrieves the attachment for this entry.- Returns:
- The attachment for this entry, or
nullif there is none.
-
setAttachment
public void setAttachment(Object attachment)
Specifies the attachment for this entry. This will replace any existing attachment that might be defined.- Parameters:
attachment- The attachment for this entry, ornullif there should not be an attachment.
-
duplicate
public Entry duplicate(boolean processVirtual)
Creates a duplicate of this entry that may be altered without impacting the information in this entry.- Parameters:
processVirtual- Indicates whether virtual attribute processing should be performed for the entry.- Returns:
- A duplicate of this entry that may be altered without impacting the information in this entry.
-
isReferral
public 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).- Returns:
trueif this entry meets the criteria to consider it a referral, orfalseif not.
-
getReferralURLs
public Set<String> getReferralURLs()
Retrieves the set of referral URLs that are included in this referral entry. This should only be called ifisReferral()returnstrue.- Returns:
- The set of referral URLs that are included in this entry
if it is a referral, or
nullif it is not a referral.
-
isAlias
public 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).- Returns:
trueif this entry meets the criteria to consider it an alias, orfalseif not.
-
getAliasedDN
public DN getAliasedDN() throws DirectoryException
Retrieves the DN of the entry referenced by this alias entry. This should only be called ifisAlias()returnstrue.- Returns:
- The DN of the entry referenced by this alias entry, or
nullif it is not an alias. - Throws:
DirectoryException- If there is an aliasedObjectName attribute but its value cannot be parsed as a DN.
-
isLDAPSubentry
public boolean isLDAPSubentry()
Indicates whether this entry meets the criteria to consider it an LDAP subentry (i.e., it contains the "ldapSubentry" objectclass).- Returns:
trueif this entry meets the criteria to consider it an LDAP subentry, orfalseif not.
-
isSubentry
public boolean isSubentry()
Indicates whether this entry meets the criteria to consider it an RFC 3672 LDAP subentry (i.e., it contains the "subentry" objectclass).- Returns:
trueif this entry meets the criteria to consider it an RFC 3672 LDAP subentry, orfalseif not.
-
isCollectiveAttributeSubentry
public 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).- Returns:
trueif this entry meets the criteria to consider it an RFC 3671 LDAP collective attributes subentry, orfalseif not.
-
isInheritedCollectiveAttributeSubentry
public boolean isInheritedCollectiveAttributeSubentry()
Indicates whether the entry meets the criteria to consider it an inherited collective attributes subentry (i.e., it contains the "inheritedCollectiveAttributeSubentry" objectclass).- Returns:
trueif this entry meets the criteria to consider it an inherited collective attributes subentry, orfalseif not.
-
isInheritedFromDNCollectiveAttributeSubentry
public 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).- Returns:
trueif this entry meets the criteria to consider it an inherited from DN collective attributes subentry, orfalseif not.
-
isInheritedFromRDNCollectiveAttributeSubentry
public 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).- Returns:
trueif this entry meets the criteria to consider it an inherited from RDN collective attributes subentry, orfalseif not.
-
isPasswordPolicySubentry
public 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).- Returns:
trueif this entry meets the criteria to consider it a LDAP Password Policy Internet-Draft subentry, orfalseif not.
-
matchesBaseAndScope
public boolean matchesBaseAndScope(DN baseDN, SearchScope scope)
Indicates whether this entry falls within the range of the provided search base DN and scope.- Parameters:
baseDN- The base DN for which to make the determination.scope- The search scope for which to make the determination.- Returns:
trueif this entry is within the given base and scope, orfalseif it is not.
-
processVirtualAttributes
public void processVirtualAttributes()
Performs any necessary virtual attribute processing for this entry. This should only be called at the time the entry is decoded or created within the backend.
-
encode
public void encode(ByteStringBuilder buffer, EntryEncodeConfig config) throws DirectoryException
Encodes this entry into a form that is suitable for long-term persistent storage. The encoding will have a version number so that if the way we store entries changes in the future we will still be able to read entries encoded in an older format.- Parameters:
buffer- The buffer to encode into.config- The configuration that may be used to control how the entry is encoded.- Throws:
DirectoryException- If a problem occurs while attempting to encode the entry.
-
decode
public static Entry decode(ByteSequenceReader entryBuffer) throws DirectoryException
Decodes the provided byte array as an entry.- Parameters:
entryBuffer- The byte array containing the data to be decoded.- Returns:
- The decoded entry.
- Throws:
DirectoryException- If the provided byte array cannot be decoded as an entry.
-
decode
public static Entry decode(ByteSequenceReader entryBuffer, CompressedSchema compressedSchema) throws DirectoryException
Decodes the provided byte array as an entry using the V3 encoding.- Parameters:
entryBuffer- The byte buffer containing the data to be decoded.compressedSchema- The compressed schema manager to use when decoding tokenized schema elements.- Returns:
- The decoded entry.
- Throws:
DirectoryException- If the provided byte array cannot be decoded as an entry.
-
toLDIF
public List<StringBuilder> toLDIF()
Retrieves a list of the lines for this entry in LDIF form. Long lines will not be wrapped automatically.- Returns:
- A list of the lines for this entry in LDIF form.
-
toLDIF
public boolean toLDIF(LDIFExportConfig exportConfig) throws IOException, LDIFException
Writes this entry in LDIF form according to the provided configuration.- Parameters:
exportConfig- The configuration that specifies how the entry should be written.- Returns:
trueif the entry is actually written, orfalseif it is not for some reason.- Throws:
IOException- If a problem occurs while writing the information.LDIFException- If a problem occurs while trying to determine whether to write the entry.
-
getProtocolElementName
public String getProtocolElementName()
Retrieves the name of the protocol associated with this protocol element.- Specified by:
getProtocolElementNamein interfaceProtocolElement- Returns:
- The name of the protocol associated with this protocol element.
-
hashCode
public int hashCode()
Retrieves a hash code for this entry.
-
equals
public boolean equals(Object o)
Indicates whether the provided object is equal to this entry. In order for the object to be considered equal, it must be an entry with the same DN, set of object classes, and set of user and operational attributes.
-
toString
public String toString()
Retrieves a string representation of this protocol element.
-
toString
public void toString(StringBuilder buffer)
Appends a string representation of this protocol element to the provided buffer.- Specified by:
toStringin interfaceProtocolElement- Parameters:
buffer- The buffer into which the string representation should be written.
-
toString
public void toString(StringBuilder buffer, int indent)
Appends a string representation of this protocol element to the provided buffer.- Specified by:
toStringin interfaceProtocolElement- Parameters:
buffer- The buffer into which the string representation should be written.indent- The number of spaces that should be used to indent the resulting string representation.
-
toLDIFString
public String toLDIFString()
Retrieves a string representation of this entry in LDIF form.- Returns:
- A string representation of this entry in LDIF form.
-
toSingleLineString
public void toSingleLineString(StringBuilder buffer)
Appends a single-line representation of this entry to the provided buffer.- Parameters:
buffer- The buffer to which the information should be written.
-
getAttribute
public Attribute getAttribute(AttributeDescription attributeDescription)
Retrieves the requested attribute element for the specified attribute type and options ornullif this entry does not contain an attribute with the specified attribute type and options.- Parameters:
attributeDescription- The attribute description to retrieve.- Returns:
- The requested attribute element for the specified
attribute type and options, or
nullif the specified attribute type is not present in this entry with the provided set of options.
-
filterEntry
public 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.- Parameters:
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.- Returns:
- An entry containing only those attributes of this entry which match the provided criteria.
-
getAttributes
@Deprecated public List<Attribute> getAttributes()
Deprecated.Retrieves the entire set of attributes for this entry. This includes both user and operational attributes.- Returns:
- The entire set of attributes for this entry.
-
getAttribute
@Deprecated public List<Attribute> getAttribute(AttributeType attributeType)
Deprecated.Kept for ABI compatibility.- Parameters:
attributeType- The attribute type to retrieve.- Returns:
- The requested attributes.
- See Also:
getAllAttributes(AttributeType)
-
getAttribute
@Deprecated public List<Attribute> getAttribute(AttributeType attributeType, boolean includeSubordinates)
Deprecated.Kept for ABI compatibility.- Parameters:
attributeType- The attribute type to retrieve.includeSubordinates- Whether to include any subordinate attributes of the attribute type being retrieved.- Returns:
- The requested attributes.
- See Also:
getAllAttributes(AttributeType,boolean)
-
getAttribute
@Deprecated public List<Attribute> getAttribute(String nameOrOID)
Deprecated.Kept for ABI compatibility.- Parameters:
nameOrOID- The name or OID of the attribute to return- Returns:
- The requested attributes.
- See Also:
getAllAttributes(String)
-
addAttribute
@Deprecated public void addAttribute(Attribute attribute, List<ByteString> duplicateValues)
Deprecated.Ensures that this entry contains the provided attribute and its values.- Parameters:
attribute- The attribute to add or merge with this entry.duplicateValues- A list to which any duplicate values will be added.- See Also:
addAttribute(Attribute, Collection)
-
removeAttribute
@Deprecated public boolean removeAttribute(Attribute attribute, List<ByteString> missingValues)
Deprecated.Ensures that this entry does not contain the provided attribute values.- Parameters:
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.- Returns:
- whether the attribute type was present and the specified values that were present were removed.
- See Also:
removeAttribute(Attribute, Collection)
-
-