org.opends.server.types
Class Entry

java.lang.Object
  extended by 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 java.lang.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
Entry(DN dn, java.util.Map<ObjectClass,java.lang.String> objectClasses, java.util.Map<AttributeType,java.util.List<Attribute>> userAttributes, java.util.Map<AttributeType,java.util.List<Attribute>> operationalAttributes)
          Creates a new entry with the provided information.
 
Method Summary
 void addAttribute(Attribute attribute, java.util.List<AttributeValue> duplicateValues)
          Adds the provided attribute to this entry.
 void addObjectClass(AttributeValue objectClassName)
          Adds the objectClass with the given name to this entry.
 void addObjectClass(ObjectClass oc)
          Adds the provided objectClass to this entry.
 void addObjectClasses(java.util.Collection<AttributeValue> objectClassNames)
          Adds the objectclasses corresponding to the provided set of names to this entry.
 boolean allowsAttribute(AttributeType attributeType)
          Indicates whether the specified attribute type is allowed by any of the objectclasses associated with this entry.
 void applyModification(Modification mod)
          Applies the provided modification to this entry.
 void applyModifications(java.util.List<Modification> mods)
          Applies all of the provided modifications to this entry.
 boolean conformsToSchema(Entry parentEntry, boolean parentProvided, boolean validateNameForms, boolean validateStructureRules, MessageBuilder invalidReason)
          Indicates whether this entry conforms to the server's schema requirements.
static Entry decode(byte[] entryBytes)
          Decodes the provided byte array as an entry.
static Entry decode(byte[] entryBytes, CompressedSchema compressedSchema)
          Decodes the provided byte array as an entry.
static Entry decodeV1(byte[] entryBytes)
          Decodes the provided byte array as an entry using the V1 encoding.
static Entry decodeV2(byte[] entryBytes, CompressedSchema compressedSchema)
          Decodes the provided byte array as an entry using the V2 encoding.
 Entry duplicate(boolean processVirtual)
          Creates a duplicate of this entry that may be altered without impacting the information in this entry.
 java.util.List<Attribute> duplicateOperationalAttribute(AttributeType attributeType)
          Retrieves a duplicate of the operational attribute list for the specified type.
 java.util.List<Attribute> duplicateOperationalAttribute(AttributeType attributeType, java.util.Set<java.lang.String> options, boolean omitValues)
          Retrieves a copy of the requested operational attribute element(s) for the specified attribute type.
 java.util.List<Attribute> duplicateUserAttribute(AttributeType attributeType)
          Retrieves a duplicate of the user attribute list for the specified type.
 java.util.List<Attribute> duplicateUserAttribute(AttributeType attributeType, java.util.Set<java.lang.String> options, boolean omitValues)
          Retrieves a copy of the requested user attribute element(s) for the specified attribute type.
 Entry duplicateWithoutAttributes()
          Creates a duplicate of this entry without any attribute or objectclass information (i.e., it will just contain the DN and placeholders for adding attributes) and objectclasses.
 Entry duplicateWithoutOperationalAttributes(boolean typesOnly, boolean processVirtual)
          Creates a duplicate of this entry without any operational attributes that may be altered without impacting the information in this entry.
 byte[] encode(EntryEncodeConfig config)
          Encodes this entry into a form that is suitable for long-term persistent storage.
 byte[] encodeV1()
          Encodes this entry using the V1 encoding.
 byte[] encodeV2(EntryEncodeConfig config)
          Encodes this entry using the V2 encoding.
 boolean equals(java.lang.Object o)
          Indicates whether the provided object is equal to this entry.
 DN getAliasedDN()
          Retrieves the DN of the entry referenced by this alias entry.
 java.lang.Object getAttachment()
          Retrieves the attachment for this entry.
 java.util.List<Attribute> getAttribute(AttributeType attributeType)
          Retrieves the requested attribute element(s) for the specified attribute type.
 java.util.List<Attribute> getAttribute(AttributeType attributeType, boolean includeSubordinates)
          Retrieves the requested attribute element(s) for the specified attribute type.
 java.util.List<Attribute> getAttribute(AttributeType attributeType, boolean includeSubordinates, java.util.Set<java.lang.String> options)
          Retrieves the requested attribute element(s) for the specified attribute type.
 java.util.List<Attribute> getAttribute(AttributeType attributeType, java.util.Set<java.lang.String> options)
          Retrieves the requested attribute element(s) for the specified attribute type.
 java.util.List<Attribute> getAttribute(java.lang.String lowerName)
          Retrieves the requested attribute element(s) for the attribute with the specified name or OID.
 java.util.List<Attribute> getAttribute(java.lang.String lowerName, java.util.Set<java.lang.String> options)
          Retrieves the requested attribute element(s) for the attribute with the specified name or OID and set of options.
 java.util.List<Attribute> getAttributes()
          Retrieves the entire set of attributes for this entry.
<T> T
getAttributeValue(AttributeType attributeType, AttributeValueDecoder<T> decoder)
          Retrieves the requested attribute type from the entry and decodes a single value as an object of type T.
<T> java.util.Collection<T>
getAttributeValues(AttributeType attributeType, AttributeValueDecoder<? extends T> decoder, java.util.Collection<T> collection)
          Retrieves the requested attribute type from the entry and decodes any values as objects of type T and then places them in the specified collection.
 DN getDN()
          Retrieves the distinguished name for this entry.
 Attribute getObjectClassAttribute()
          Retrieves an attribute holding the objectclass information for this entry.
 java.util.Map<ObjectClass,java.lang.String> getObjectClasses()
          Retrieves the set of objectclasses defined for this entry.
 java.util.List<Attribute> getOperationalAttribute(AttributeType attributeType)
          Retrieves the requested operational attribute element(s) for the specified attribute type.
 java.util.List<Attribute> getOperationalAttribute(AttributeType attributeType, java.util.Set<java.lang.String> options)
          Retrieves the requested operational attribute element(s) for the specified attribute type.
 java.util.Map<AttributeType,java.util.List<Attribute>> getOperationalAttributes()
          Retrieves the entire set of operational attributes for this entry.
 java.lang.String getProtocolElementName()
          Retrieves the name of the protocol associated with this protocol element.
 java.util.LinkedHashSet<java.lang.String> getReferralURLs()
          Retrieves the set of referral URLs that are included in this referral entry.
 ObjectClass getStructuralObjectClass()
          Retrieves the structural objectclass for this entry.
 java.util.List<Attribute> getUserAttribute(AttributeType attributeType)
          Retrieves the requested user attribute element(s) for the specified attribute type.
 java.util.List<Attribute> getUserAttribute(AttributeType attributeType, java.util.Set<java.lang.String> options)
          Retrieves the requested user attribute element(s) for the specified attribute type.
 java.util.Map<AttributeType,java.util.List<Attribute>> getUserAttributes()
          Retrieves the entire set of user (i.e., non-operational) attributes for this entry.
 boolean hasAttribute(AttributeType attributeType)
          Indicates whether this entry contains the specified attribute.
 boolean hasAttribute(AttributeType attributeType, boolean includeSubordinates)
          Indicates whether this entry contains the specified attribute.
 boolean hasAttribute(AttributeType attributeType, boolean includeSubordinates, java.util.Set<java.lang.String> attributeOptions)
          Indicates whether this entry contains the specified attribute with all of the options in the provided set.
 boolean hasAttribute(AttributeType attributeType, java.util.Set<java.lang.String> attributeOptions)
          Indicates whether this entry contains the specified attribute with all of the options in the provided set.
 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 hasUserAttribute(AttributeType attributeType)
          Indicates whether this entry contains the specified user attribute.
 boolean hasValue(AttributeType attributeType, java.util.Set<java.lang.String> options, AttributeValue value)
          Indicates whether this entry contains the specified attribute value.
 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 isLDAPSubentry()
          Indicates whether this entry meets the criteria to consider it an LDAP subentry (i.e., it contains the "ldapSubentry" objectclass).
 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 matchesBaseAndScope(DN baseDN, SearchScope scope)
          Indicates whether this entry falls within the range of the provided search base DN and scope.
 void processVirtualAttributes()
          Performs any necessary virtual attribute processing for this entry.
 void processVirtualAttributes(boolean includeOperational)
          Performs any necessary virtual attribute processing for this entry.
 void putAttribute(AttributeType attributeType, java.util.List<Attribute> attributeList)
          Puts the provided attribute in this entry.
 boolean removeAttribute(Attribute attribute, java.util.List<AttributeValue> missingValues)
          Removes the provided attribute from this entry.
 boolean removeAttribute(AttributeType attributeType)
          Removes all instances of the specified attribute type from this entry, including any instances with options.
 boolean removeAttribute(AttributeType attributeType, java.util.Set<java.lang.String> options)
          Removes the attribute with the provided type and set of options from this entry.
 boolean requiresAttribute(AttributeType attributeType)
          Indicates whether the specified attribute type is required by any of the objectclasses associated with this entry.
 void setAttachment(java.lang.Object attachment)
          Specifies the attachment for this entry.
 void setDN(DN dn)
          Specifies the distinguished name for this entry.
 void setObjectClasses(java.util.Collection<AttributeValue> objectClassNames)
          Specifies the set of objectclasses for this entry.
 void stripRealAttributes()
          Strips out all real attributes from this entry so that it only contains virtual attributes.
 void stripVirtualAttributes()
          Strips out all virtual attributes from this entry so that it only contains real attributes.
 java.util.List<java.lang.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.
 java.lang.String toLDIFString()
          Retrieves a string representation of this entry in LDIF form.
 java.lang.String toSingleLineString()
          Retrieves a one-line representation of this entry.
 void toSingleLineString(java.lang.StringBuilder buffer)
          Appends a single-line representation of this entry to the provided buffer.
 java.lang.String toString()
          Retrieves a string representation of this protocol element.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this protocol element to the provided buffer.
 void toString(java.lang.StringBuilder buffer, int indent)
          Appends a string representation of this protocol element to the provided buffer.
 boolean virtualAttributeProcessingPerformed()
          Indicates whether virtual attribute processing has been performed for this entry.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Entry

public Entry(DN dn,
             java.util.Map<ObjectClass,java.lang.String> objectClasses,
             java.util.Map<AttributeType,java.util.List<Attribute>> userAttributes,
             java.util.Map<AttributeType,java.util.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

getDN

public DN getDN()
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 java.util.Map<ObjectClass,java.lang.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:
true if this entry has the specified objectclass, or false if not.

getStructuralObjectClass

public ObjectClass getStructuralObjectClass()
Retrieves the structural objectclass for this entry.

Returns:
The structural objectclass for this entry, or null if there is none for some reason. If there are multiple structural classes in the entry, then the first will be returned.

setObjectClasses

public void setObjectClasses(java.util.Collection<AttributeValue> objectClassNames)
                      throws DirectoryException
Specifies the set of objectclasses for this entry.

Parameters:
objectClassNames - The values containing the names or OIDs of the objectClasses for this entry.
Throws:
DirectoryException - If a problem occurs while attempting to set the objectclasses for this entry.

addObjectClass

public void addObjectClass(AttributeValue objectClassName)
                    throws DirectoryException
Adds the objectClass with the given name to this entry.

Parameters:
objectClassName - The value containing the name or OID of the objectClass to add to this entry.
Throws:
DirectoryException - If a problem occurs while attempting to add the objectclass to this entry.

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.

addObjectClasses

public void addObjectClasses(java.util.Collection<AttributeValue> objectClassNames)
                      throws DirectoryException
Adds the objectclasses corresponding to the provided set of names to this entry.

Parameters:
objectClassNames - The values containing the names or OIDs of the objectClasses to add to this entry.
Throws:
DirectoryException - If a problem occurs while attempting to add the set of objectclasses to this entry.

getAttributes

public java.util.List<Attribute> getAttributes()
Retrieves the entire set of attributes for this entry. This will include both user and operational attributes. The caller must not modify the contents of this list. Also note that this method is less efficient than calling either (or both) getUserAttributes or getOperationalAttributes, so it should only be used when calls to those methods are not appropriate.

Returns:
The entire set of attributes for this entry.

getUserAttributes

public java.util.Map<AttributeType,java.util.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 java.util.Map<AttributeType,java.util.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 null if 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:
true if this entry contains the specified attribute, or false if 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:
true if this entry contains the specified attribute, or false if not.

hasAttribute

public boolean hasAttribute(AttributeType attributeType,
                            java.util.Set<java.lang.String> attributeOptions)
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:
attributeType - The attribute type for which to make the determination.
attributeOptions - The set of options to use in the determination.
Returns:
true if this entry contains the specified attribute, or false if not.

hasAttribute

public boolean hasAttribute(AttributeType attributeType,
                            boolean includeSubordinates,
                            java.util.Set<java.lang.String> attributeOptions)
Indicates whether this entry contains the specified attribute with all of the options in the provided set.

Parameters:
attributeType - The attribute type for which to make the determination.
includeSubordinates - Whether to include any subordinate attributes of the attribute type being retrieved.
attributeOptions - The set of options to use in the determination.
Returns:
true if this entry contains the specified attribute, or false if not.

getAttribute

public java.util.List<Attribute> getAttribute(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 null if the specified attribute type is not present in this entry.

getAttribute

public java.util.List<Attribute> getAttribute(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 null if the specified attribute type is not present in this entry.

getAttribute

public java.util.List<Attribute> getAttribute(java.lang.String lowerName)
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 an AttributeType argument.

Parameters:
lowerName - The name or OID of the attribute to return, formatted in all lowercase characters.
Returns:
The requested attribute element(s) for the specified attribute type, or null if the specified attribute type is not present in this entry.

getAttribute

public java.util.List<Attribute> getAttribute(AttributeType attributeType,
                                              java.util.Set<java.lang.String> options)
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.
options - The set of attribute options to include in matching elements.
Returns:
The requested attribute element(s) for the specified attribute type, or null if the specified attribute type is not present in this entry with the provided set of options.

getAttribute

public java.util.List<Attribute> getAttribute(AttributeType attributeType,
                                              boolean includeSubordinates,
                                              java.util.Set<java.lang.String> options)
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.
options - The set of attribute options to include in matching elements.
Returns:
The requested attribute element(s) for the specified attribute type, or null if the specified attribute type is not present in this entry with the provided set of options.

getAttribute

public java.util.List<Attribute> getAttribute(java.lang.String lowerName,
                                              java.util.Set<java.lang.String> options)
Retrieves the requested attribute element(s) for the attribute with the specified name or OID and set of options. The list returned may include multiple elements if the same attribute exists in the entry multiple times with different sets of matching options.

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 an AttributeType argument.

Parameters:
lowerName - The name or OID of the attribute to return, formatted in all lowercase characters.
options - The set of attribute options to include in matching elements.
Returns:
The requested attribute element(s) for the specified attribute type, or null if the specified attribute type is not present in this entry.

getAttributeValue

public final <T> T getAttributeValue(AttributeType attributeType,
                                     AttributeValueDecoder<T> decoder)
                          throws DirectoryException
Retrieves the requested attribute type from the entry and decodes a single value as an object of type T.

If the requested attribute type is not present then null is returned. If more than one attribute value is present, then the first value found will be decoded and returned.

The attribute value is decoded using the specified AttributeValueDecoder.

Type Parameters:
T - Decode the attribute value to an object of this type.
Parameters:
attributeType - The attribute type to retrieve.
decoder - The attribute value decoder.
Returns:
The decoded attribute value or null if no attribute value having the specified attribute type was found.
Throws:
DirectoryException - If the requested attribute value could not be decoded successfully.

getAttributeValues

public final <T> java.util.Collection<T> getAttributeValues(AttributeType attributeType,
                                                            AttributeValueDecoder<? extends T> decoder,
                                                            java.util.Collection<T> collection)
                                                 throws DirectoryException
Retrieves the requested attribute type from the entry and decodes any values as objects of type T and then places them in the specified collection.

If the requested attribute type is not present then no decoded values will be added to the container.

The attribute value is decoded using the specified AttributeValueDecoder.

Type Parameters:
T - Decode the attribute values to objects of this type.
Parameters:
attributeType - The attribute type to retrieve.
decoder - The attribute value decoder.
collection - The collection to which decoded values should be added.
Returns:
The collection containing the decoded attribute value.
Throws:
DirectoryException - If one or more of the requested attribute values could not be decoded successfully.

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:
true if this entry contains the specified user attribute, or false if not.

getUserAttribute

public java.util.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 null if there is no such user attribute.

getUserAttribute

public java.util.List<Attribute> getUserAttribute(AttributeType attributeType,
                                                  java.util.Set<java.lang.String> options)
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.
options - The set of attribute options to include in matching elements.
Returns:
The requested attribute element(s) for the specified attribute type, or null if there is no such user attribute with the specified set of options.

duplicateUserAttribute

public java.util.List<Attribute> duplicateUserAttribute(AttributeType attributeType)
Retrieves a duplicate of the user attribute list for the specified type.

Parameters:
attributeType - The attribute type for which to retrieve a duplicate attribute list.
Returns:
A duplicate of the requested attribute list, or null if there is no such user attribute.

duplicateUserAttribute

public java.util.List<Attribute> duplicateUserAttribute(AttributeType attributeType,
                                                        java.util.Set<java.lang.String> options,
                                                        boolean omitValues)
Retrieves a copy of 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.
options - The set of attribute options to include in matching elements.
omitValues - true if the values are to be omitted.
Returns:
A copy of the requested attribute element(s) for the specified attribute type, or null if there is no such user attribute with the specified set of options.

duplicateOperationalAttribute

public java.util.List<Attribute> duplicateOperationalAttribute(AttributeType attributeType,
                                                               java.util.Set<java.lang.String> options,
                                                               boolean omitValues)
Retrieves a copy of 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.
options - The set of attribute options to include in matching elements.
omitValues - true if the values are to be omitted.
Returns:
A copy of the requested attribute element(s) for the specified attribute type, or null if there is no such user attribute with the specified set of options.

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:
true if this entry contains the specified operational attribute, or false if not.

getOperationalAttribute

public java.util.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 null if there is no such operational attribute.

getOperationalAttribute

public java.util.List<Attribute> getOperationalAttribute(AttributeType attributeType,
                                                         java.util.Set<java.lang.String> options)
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.
options - The set of attribute options to include in matching elements.
Returns:
The requested attribute element(s) for the specified attribute type, or null if there is no such operational attribute with the specified set of options.

duplicateOperationalAttribute

public java.util.List<Attribute> duplicateOperationalAttribute(AttributeType attributeType)
Retrieves a duplicate of the operational attribute list for the specified type.

Parameters:
attributeType - The attribute type for which to retrieve a duplicate attribute list.
Returns:
A duplicate of the requested attribute list, or null if there is no such operational attribute.

putAttribute

public void putAttribute(AttributeType attributeType,
                         java.util.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,
                         java.util.List<AttributeValue> duplicateValues)
Adds the provided attribute to this entry. If an attribute with the provided type already exists, then the values will be merged.

Parameters:
attribute - The attribute to add or merge with this entry.
duplicateValues - A list to which any duplicate values will be added.

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:
true if the attribute was found and removed, or false if it was not present in the entry.

removeAttribute

public boolean removeAttribute(AttributeType attributeType,
                               java.util.Set<java.lang.String> options)
Removes the attribute with the provided type and set of options from this entry. Only the instance with the exact set of options provided will be removed. This has no effect if the specified attribute is not present in this entry with the given set of options.

Parameters:
attributeType - The attribute type for the attribute to remove from this entry.
options - The set of attribute options to use when determining which attribute to remove.
Returns:
true if the attribute was found and removed, or false if it was not present in the entry.

removeAttribute

public boolean removeAttribute(Attribute attribute,
                               java.util.List<AttributeValue> missingValues)
Removes the provided attribute from this entry. If the given attribute does not have any values, then all values of the associated attribute type (taking into account the options in the provided type) will be removed. Otherwise, only the specified values will be removed.

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:
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.

allowsAttribute

public boolean allowsAttribute(AttributeType attributeType)
Indicates whether the specified attribute type is allowed by any of the objectclasses associated with this entry.

Parameters:
attributeType - The attribute type for which to make the determination.
Returns:
true if the specified attribute is allowed by any of the objectclasses associated with this entry, or false if it is not.

requiresAttribute

public boolean requiresAttribute(AttributeType attributeType)
Indicates whether the specified attribute type is required by any of the objectclasses associated with this entry.

Parameters:
attributeType - The attribute type for which to make the determination.
Returns:
true if the specified attribute is required by any of the objectclasses associated with this entry, o rfalse if it is not.

hasValue

public boolean hasValue(AttributeType attributeType,
                        java.util.Set<java.lang.String> options,
                        AttributeValue value)
Indicates whether this entry contains the specified attribute value.

Parameters:
attributeType - The attribute type for the attribute.
options - The set of options for the attribute.
value - The value for the attribute.
Returns:
true if this entry contains the specified attribute value, or false if it does not.

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(java.util.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.

conformsToSchema

public boolean conformsToSchema(Entry parentEntry,
                                boolean parentProvided,
                                boolean validateNameForms,
                                boolean validateStructureRules,
                                MessageBuilder invalidReason)
Indicates whether this entry conforms to the server's schema requirements. The checks performed by this method include:

Parameters:
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.
Returns:
true if this entry conforms to the server's schema requirements, or false if it does not.

getAttachment

public java.lang.Object getAttachment()
Retrieves the attachment for this entry.

Returns:
The attachment for this entry, or null if there is none.

setAttachment

public void setAttachment(java.lang.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, or null if 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.

duplicateWithoutOperationalAttributes

public Entry duplicateWithoutOperationalAttributes(boolean typesOnly,
                                                   boolean processVirtual)
Creates a duplicate of this entry without any operational attributes that may be altered without impacting the information in this entry.

Parameters:
typesOnly - Indicates whether to include attribute types only without values.
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 and that does not contain any operational attributes.

duplicateWithoutAttributes

public Entry duplicateWithoutAttributes()
Creates a duplicate of this entry without any attribute or objectclass information (i.e., it will just contain the DN and placeholders for adding attributes) and objectclasses.

Returns:
A duplicate of this entry that may be altered without impacting the information in this entry and that does not contain attribute or objectclass information.

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:
true if this entry meets the criteria to consider it a referral, or false if not.

getReferralURLs

public java.util.LinkedHashSet<java.lang.String> getReferralURLs()
Retrieves the set of referral URLs that are included in this referral entry. This should only be called if isReferral() returns true.

Returns:
The set of referral URLs that are included in this entry if it is a referral, or null if 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:
true if this entry meets the criteria to consider it an alias, or false if not.

getAliasedDN

public DN getAliasedDN()
                throws DirectoryException
Retrieves the DN of the entry referenced by this alias entry. This should only be called if isAlias() returns true.

Returns:
The DN of the entry referenced by this alias entry, or null if 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:
true if this entry meets the criteria to consider it an LDAP subentry, or false if 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:
true if this entry is within the given base and scope, or false if 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.


processVirtualAttributes

public void processVirtualAttributes(boolean includeOperational)
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.

Parameters:
includeOperational - Indicates whether to include operational attributes.

virtualAttributeProcessingPerformed

public boolean virtualAttributeProcessingPerformed()
Indicates whether virtual attribute processing has been performed for this entry.

Returns:
true if virtual attribute processing has been performed for this entry, or false if not.

stripRealAttributes

public void stripRealAttributes()
Strips out all real attributes from this entry so that it only contains virtual attributes.


stripVirtualAttributes

public void stripVirtualAttributes()
Strips out all virtual attributes from this entry so that it only contains real attributes.


encode

public byte[] encode(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:
config - The configuration that may be used to control how the entry is encoded.
Returns:
The entry encoded in a form that is suitable for long-term persistent storage.
Throws:
DirectoryException - If a problem occurs while attempting to encode the entry.

encodeV1

public byte[] encodeV1()
Encodes this entry using the V1 encoding.

Returns:
The entry encoded in the V1 encoding.

encodeV2

public byte[] encodeV2(EntryEncodeConfig config)
                throws DirectoryException
Encodes this entry using the V2 encoding.

Parameters:
config - The configuration that should be used to encode the entry.
Returns:
The entry encoded in the V2 encoding.
Throws:
DirectoryException - If a problem occurs while attempting to encode the entry.

decode

public static Entry decode(byte[] entryBytes)
                    throws DirectoryException
Decodes the provided byte array as an entry.

Parameters:
entryBytes - 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(byte[] entryBytes,
                           CompressedSchema compressedSchema)
                    throws DirectoryException
Decodes the provided byte array as an entry.

Parameters:
entryBytes - The byte array 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.

decodeV1

public static Entry decodeV1(byte[] entryBytes)
                      throws DirectoryException
Decodes the provided byte array as an entry using the V1 encoding.

Parameters:
entryBytes - 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.

decodeV2

public static Entry decodeV2(byte[] entryBytes,
                             CompressedSchema compressedSchema)
                      throws DirectoryException
Decodes the provided byte array as an entry using the V2 encoding.

Parameters:
entryBytes - The byte array 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 java.util.List<java.lang.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 java.io.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:
true if the entry is actually written, or false if it is not for some reason.
Throws:
java.io.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 java.lang.String getProtocolElementName()
Retrieves the name of the protocol associated with this protocol element.

Specified by:
getProtocolElementName in interface ProtocolElement
Returns:
The name of the protocol associated with this protocol element.

hashCode

public int hashCode()
Retrieves a hash code for this entry.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code for this entry.

equals

public boolean equals(java.lang.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.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object for which to make the determination.
Returns:
true if the provided object may be considered equal to this entry, or false if not.

toString

public java.lang.String toString()
Retrieves a string representation of this protocol element.

Specified by:
toString in interface ProtocolElement
Overrides:
toString in class java.lang.Object
Returns:
A string representation of this protocol element.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this protocol element to the provided buffer.

Specified by:
toString in interface ProtocolElement
Parameters:
buffer - The buffer into which the string representation should be written.

toString

public void toString(java.lang.StringBuilder buffer,
                     int indent)
Appends a string representation of this protocol element to the provided buffer.

Specified by:
toString in interface ProtocolElement
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 java.lang.String toLDIFString()
Retrieves a string representation of this entry in LDIF form.

Returns:
A string representation of this entry in LDIF form.

toSingleLineString

public java.lang.String toSingleLineString()
Retrieves a one-line representation of this entry.

Returns:
A one-line representation of this entry.

toSingleLineString

public void toSingleLineString(java.lang.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.