Class DefaultEntry
- All Implemented Interfaces:
Externalizable, Serializable, Cloneable, Iterable<Attribute>, Entry
This class is final, it should not be extended.
- Author:
- Apache Directory Project
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of DefaultEntry.DefaultEntry(String dn) Creates a new instance of DefaultEntry, with a Dn.DefaultEntry(String dn, Object... elements) Creates a new instance of DefaultEntry, with a Dn and a list of IDs.DefaultEntry(Dn dn) Creates a new instance of DefaultEntry, with a Dn.DefaultEntry(Dn dn, Object... elements) Creates a new instance of DefaultEntry, with a Dn and a list of IDs.DefaultEntry(SchemaManager schemaManager) Creates a new instance of DefaultEntry, schema aware.DefaultEntry(SchemaManager schemaManager, String dn) Creates a new instance of DefaultEntry, schema aware.DefaultEntry(SchemaManager schemaManager, String dn, Object... elements) Creates a new instance of DefaultEntry, with a Dn and a list of IDs.DefaultEntry(SchemaManager schemaManager, Entry entry) Creates a new instance of DefaultEntry, copying another entry.DefaultEntry(SchemaManager schemaManager, Dn dn) Creates a new instance of DefaultEntry, schema aware.DefaultEntry(SchemaManager schemaManager, Dn dn, Object... elements) Creates a new instance of DefaultEntry, with a Dn and a list of IDs. -
Method Summary
Modifier and TypeMethodDescriptionAdd some binary values to the current Entry.Add some String values to the current Entry.Add some Values to the current Entry.add(String upId, AttributeType attributeType, byte[]... values) Add an attribute (represented by its AttributeType and some binary values) into an entry.add(String upId, AttributeType attributeType, String... values) Add an attribute (represented by its AttributeType and some String values) into an entry.add(String upId, AttributeType attributeType, Value... values) Add an attribute (represented by its AttributeType and some values) into an entry.Add some Attributes to the current Entry.add(AttributeType attributeType, byte[]... values) Add an attribute (represented by its AttributeType and some binary values) into an entry.add(AttributeType attributeType, String... values) Add an attribute (represented by its AttributeType and some String values) into an entry.add(AttributeType attributeType, Value... values) Add an attribute (represented by its AttributeType and some values) into an entry.voidclear()Remove all the attributes for this entry.clone()Clone an entry.booleanChecks if an entry contains an attribute with some binary values.booleanChecks if an entry contains an attribute with some String values.booleanChecks if an entry contains an attribute with some values.booleanChecks if an entry contains a list of attributes.booleancontains(AttributeType attributeType, byte[]... values) Checks if an entry contains an attribute with some given binary values.booleancontains(AttributeType attributeType, String... values) Checks if an entry contains an attribute with some given String values.booleancontains(AttributeType attributeType, Value... values) Checks if an entry contains an attribute with some given binary values.booleancontainsAttribute(String... attributes) Checks if an entry contains some specific attributes.booleancontainsAttribute(AttributeType attributeType) Checks if an entry contains a specific AttributeType.protected voidcreateAttribute(String upId, AttributeType attributeType, byte[]... values) Add a new EntryAttribute, with its upId.protected voidcreateAttribute(String upId, AttributeType attributeType, String... values) Add a new EntryAttribute, with its upId.protected voidcreateAttribute(String upId, AttributeType attributeType, Value... values) Add a new EntryAttribute, with its upId.booleanReturns the attribute with the specified alias.get(AttributeType attributeType) Returns the attribute associated with an AttributeTypeGets all the attributesprotected AttributeTypegetAttributeType(String upId) Returns the attributeType from an Attribute ID.getDn()Get this entry's Dn.inthashCode()Get the hash code of this ClientEntry.booleanhasObjectClass(String... objectClasses) Tells if an entry as some specific ObjectClasses valuesbooleanhasObjectClass(Attribute... objectClasses) Tells if an entry has some specific ObjectClasses AttributesbooleanTells if the Entry is schema awareiterator()Returns an enumeration containing the zero or more attributes in the collection.Put an attribute (represented by its ID and some binary values) into an entry.Put an attribute (represented by its ID and some String values) into an entry.Put an attribute (represented by its ID and some values) into an entry.put(String upId, AttributeType attributeType, byte[]... values) Places a new attribute with the supplied AttributeType and some binary values into the attribute collection.put(String upId, AttributeType attributeType, String... values) Places a new attribute with the supplied AttributeType and some String values into the attribute collection.put(String upId, AttributeType attributeType, Value... values) Places a new attribute with the supplied AttributeType and some values into the attribute collection.Places attributes in the attribute collection.put(AttributeType attributeType, byte[]... values) Places a new attribute with the supplied AttributeType and binary values into the attribute collection.put(AttributeType attributeType, String... values) Places a new attribute with the supplied AttributeType and String values into the attribute collection.put(AttributeType attributeType, Value... values) Places a new attribute with the supplied AttributeType and some values into the attribute collection.voidbooleanRemoves the specified binary values from an attribute.booleanRemoves the specified String values from an attribute.booleanRemoves the specified values from an attribute.Removes the specified attributes.booleanremove(AttributeType attributeType, byte[]... values) Removes the specified binary values from an attribute.booleanremove(AttributeType attributeType, String... values) Removes the specified String values from an attribute.booleanremove(AttributeType attributeType, Value... values) Removes the specified values from an attribute.voidremoveAttributes(String... attributes) Removes the attribute with the specified alias.voidremoveAttributes(AttributeType... attributes) Removes the attribute with the specified AttributeTypes.voidSet this entry's Dn.voidSet this entry's Dn.Shallow clone an entry.intsize()Returns the number of attributes.toString()A pretty-pinter for EntriesvoidThis is the place where we serialize entries, and all theirs elements.Methods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
DefaultEntry
public DefaultEntry()Creates a new instance of DefaultEntry.This entry must be initialized before being used !
-
DefaultEntry
Creates a new instance of DefaultEntry, schema aware.
No attributes will be created.
- Parameters:
schemaManager- The reference to the schemaManager
-
DefaultEntry
Creates a new instance of DefaultEntry, with a Dn.- Parameters:
dn- The String Dn for this serverEntry. Can be null.- Throws:
LdapInvalidDnException- If the Dn is invalid
-
DefaultEntry
Creates a new instance of DefaultEntry, with a Dn.- Parameters:
dn- The Dn for this serverEntry. Can be null.
-
DefaultEntry
Creates a new instance of DefaultEntry, schema aware.
No attributes will be created.
- Parameters:
schemaManager- The reference to the schemaManagerdn- The String Dn for this serverEntry. Can be null.- Throws:
LdapInvalidDnException- If the Dn is invalid
-
DefaultEntry
Creates a new instance of DefaultEntry, schema aware.
No attributes will be created.
- Parameters:
schemaManager- The reference to the schemaManagerdn- The Dn for this serverEntry. Can be null.
-
DefaultEntry
Creates a new instance of DefaultEntry, with a Dn and a list of IDs.- Parameters:
dn- The Dn for this serverEntry. Can be null.elements- The list of elements to inject in the entry- Throws:
LdapException- If the elements are invalidLdapException- If the provided Dn or elements are invalid
-
DefaultEntry
Creates a new instance of DefaultEntry, with a Dn and a list of IDs.- Parameters:
dn- The Dn for this serverEntry. Can be null.elements- The list of attributes to create.- Throws:
LdapException- If the provided Dn or elements are invalid
-
DefaultEntry
public DefaultEntry(SchemaManager schemaManager, String dn, Object... elements) throws LdapException Creates a new instance of DefaultEntry, with a Dn and a list of IDs.- Parameters:
schemaManager- The SchemaManagerdn- The Dn for this serverEntry. Can be null.elements- The list of attributes to create.- Throws:
LdapException- If the provided Dn or elements are invalid
-
DefaultEntry
Creates a new instance of DefaultEntry, with a Dn and a list of IDs.- Parameters:
schemaManager- The reference to the schemaManagerdn- The Dn for this serverEntry. Can be null.elements- The list of attributes to create.- Throws:
LdapException- If the provided Dn or Elements are invalid
-
DefaultEntry
Creates a new instance of DefaultEntry, copying another entry.
No attributes will be created.
- Parameters:
schemaManager- The reference to the schemaManagerentry- the entry to copy- Throws:
LdapException- If the provided entry is invalid
-
-
Method Details
-
createAttribute
protected void createAttribute(String upId, AttributeType attributeType, byte[]... values) throws LdapInvalidAttributeValueException Add a new EntryAttribute, with its upId. If the upId is null, default to the AttributeType name. Updates the AttributeMap.- Parameters:
upId- The user provided ID for the attribute to createattributeType- The AttributeType to usevalues- The values to add to this attribute- Throws:
LdapInvalidAttributeValueException- If one of the value is incorrect
-
createAttribute
protected void createAttribute(String upId, AttributeType attributeType, String... values) throws LdapInvalidAttributeValueException Add a new EntryAttribute, with its upId. If the upId is null, default to the AttributeType name. Updates the AttributeMap.- Parameters:
upId- The user provided ID for the attribute to createattributeType- The AttributeType to usevalues- The values to add to this attribute- Throws:
LdapInvalidAttributeValueException- If one of the value is incorrect
-
createAttribute
protected void createAttribute(String upId, AttributeType attributeType, Value... values) throws LdapInvalidAttributeValueException Add a new EntryAttribute, with its upId. If the upId is null, default to the AttributeType name. Updates the AttributeMap.- Parameters:
upId- The user provided ID for the attribute to createattributeType- The AttributeType to usevalues- The values to add to this attribute- Throws:
LdapInvalidAttributeValueException- If one of the value is incorrect
-
getAttributeType
Returns the attributeType from an Attribute ID.- Parameters:
upId- The ID we are looking for- Returns:
- The found attributeType
- Throws:
LdapException- If the lookup failed
-
add
Add an attribute (represented by its AttributeType and some binary values) into an entry.
If we already have an attribute with the same values, the duplicated values are not added (duplicated values are not allowed)
If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.
- Specified by:
addin interfaceEntry- Parameters:
attributeType- The attribute Type.values- The list of binary values to inject. It can be empty.- Returns:
- the modified entry
- Throws:
LdapException- If the attribute does not exist
-
add
Add an attribute (represented by its AttributeType and some String values) into an entry.
If we already have an attribute with the same values, the duplicated values are not added (duplicated values are not allowed)
If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.
- Specified by:
addin interfaceEntry- Parameters:
attributeType- The attribute Typevalues- The list of binary values to inject. It can be empty- Returns:
- the modified entry
- Throws:
LdapException- If the attribute does not exist
-
add
Add an attribute (represented by its AttributeType and some values) into an entry.
If we already have an attribute with the same values, the duplicated values are not added (duplicated values are not allowed)
If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.
- Specified by:
addin interfaceEntry- Parameters:
attributeType- The attribute Typevalues- The list of binary values to inject. It can be empty- Returns:
- the modified entry
- Throws:
LdapException- If the attribute does not exist
-
add
Add an attribute (represented by its AttributeType and some binary values) into an entry. Set the User Provider ID at the same time
If we already have an attribute with the same values, the duplicated values are not added (duplicated values are not allowed)
If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.
- Specified by:
addin interfaceEntry- Parameters:
upId- The user provided ID for the added AttributeTypeattributeType- The attribute Type.values- The list of binary values to add. It can be empty.- Returns:
- the modified entry
- Throws:
LdapException- If the attribute does not exist
-
add
Add an attribute (represented by its AttributeType and some values) into an entry. Set the User Provider ID at the same time
If we already have an attribute with the same values, nothing is done (duplicated values are not allowed)
If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.
- Specified by:
addin interfaceEntry- Parameters:
upId- The user provided ID for the added AttributeTypeattributeType- The attribute Type.values- The list of values to add. It can be empty.- Returns:
- the modified entry
- Throws:
LdapException- If the attribute does not exist
-
add
Add an attribute (represented by its AttributeType and some String values) into an entry. Set the User Provider ID at the same time
If we already have an attribute with the same values, the duplicated values are not added (duplicated values are not allowed)
If the value cannot be added, or if the AttributeType is null or invalid, a LdapException is thrown.
- Specified by:
addin interfaceEntry- Parameters:
upId- The user provided ID for the added AttributeTypeattributeType- The attribute Type.values- The list of String values to add. It can be empty.- Returns:
- the modified entry
- Throws:
LdapException- If the attribute does not exist
-
add
Add some Attributes to the current Entry.- Specified by:
addin interfaceEntry- Parameters:
attributes- The attributes to add- Returns:
- the modified entry
- Throws:
LdapException- If we can't add any of the attributes
-
add
Add some binary values to the current Entry.- Specified by:
addin interfaceEntry- Parameters:
upId- The user provided ID of the attribute we want to add some values tovalues- The list of binary values to add- Returns:
- the modified entry
- Throws:
LdapException- If we can't add any of the values
-
add
Add some String values to the current Entry.- Specified by:
addin interfaceEntry- Parameters:
upId- The user provided ID of the attribute we want to add some values tovalues- The list of String values to add- Returns:
- the modified entry
- Throws:
LdapException- If we can't add any of the values
-
add
Add some Values to the current Entry.- Specified by:
addin interfaceEntry- Parameters:
upId- The user provided ID of the attribute we want to add some values tovalues- The list of Values to add- Returns:
- the modified entry
- Throws:
LdapException- If we can't add any of the values
-
clone
Clone an entry. All the element are duplicated, so a modification on the original object won't affect the cloned object, as a modification on the cloned object has no impact on the original object -
shallowClone
Shallow clone an entry. We don't clone the Attributes- Specified by:
shallowClonein interfaceEntry- Returns:
- a shallow copy of this entry
-
contains
Checks if an entry contains a list of attributes.
If the list is null or empty, this method will return
trueif the entry has no attribute,falseotherwise. -
containsAttribute
Checks if an entry contains some specific attributes.- Specified by:
containsAttributein interfaceEntry- Parameters:
attributes- The Attributes to look for.- Returns:
trueif the attributes are all found within the entry.
-
containsAttribute
Checks if an entry contains a specific AttributeType.- Specified by:
containsAttributein interfaceEntry- Parameters:
attributeType- The AttributeType to look for.- Returns:
trueif the attribute is found within the entry.
-
contains
Checks if an entry contains an attribute with some given binary values. -
contains
Checks if an entry contains an attribute with some given String values. -
contains
Checks if an entry contains an attribute with some given binary values. -
contains
Checks if an entry contains an attribute with some binary values. -
contains
Checks if an entry contains an attribute with some String values. -
contains
Checks if an entry contains an attribute with some values. -
get
Returns the attribute with the specified alias. The return value is
nullif no match is found.An Attribute with an id different from the supplied alias may be returned: for example a call with 'cn' may in some implementations return an Attribute whose getId() field returns 'commonName'.
-
get
Returns the attribute associated with an AttributeType -
getAttributes
Gets all the attributes- Specified by:
getAttributesin interfaceEntry- Returns:
- The combined set of all the attributes.
-
put
Put an attribute (represented by its ID and some binary values) into an entry.
If the attribute already exists, the previous attribute will be replaced and returned.
-
put
Put an attribute (represented by its ID and some String values) into an entry.
If the attribute already exists, the previous attribute will be replaced and returned.
-
put
Put an attribute (represented by its ID and some values) into an entry.
If the attribute already exists, the previous attribute will be replaced and returned.
-
put
Places attributes in the attribute collection.
If there is already an attribute with the same ID as any of the new attributes, the old ones are removed from the collection and are returned by this method. If there was no attribute with the same ID the return value is
null.- Specified by:
putin interfaceEntry- Parameters:
attributes- the attributes to be put- Returns:
- the old attributes with the same OID, if exist; otherwise
null - Throws:
LdapException- if the operation fails
-
put
Places a new attribute with the supplied AttributeType and binary values into the attribute collection.
If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.
This method provides a mechanism to put an attribute with a
nullvalue: the value may benull.- Specified by:
putin interfaceEntry- Parameters:
attributeType- the type of the new attribute to be putvalues- the binary values of the new attribute to be put- Returns:
- the old attribute with the same identifier, if exists; otherwise
null - Throws:
LdapException- if there are failures
-
put
Places a new attribute with the supplied AttributeType and String values into the attribute collection.
If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.
This method provides a mechanism to put an attribute with a
nullvalue: the value may benull.- Specified by:
putin interfaceEntry- Parameters:
attributeType- the type of the new attribute to be putvalues- the String values of the new attribute to be put- Returns:
- the old attribute with the same identifier, if exists; otherwise
null - Throws:
LdapException- if there are failures
-
put
Places a new attribute with the supplied AttributeType and some values into the attribute collection.
If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.
This method provides a mechanism to put an attribute with a
nullvalue: the value may benull.- Specified by:
putin interfaceEntry- Parameters:
attributeType- the type of the new attribute to be putvalues- the values of the new attribute to be put- Returns:
- the old attribute with the same identifier, if exists; otherwise
null - Throws:
LdapException- if there are failures
-
put
public Attribute put(String upId, AttributeType attributeType, byte[]... values) throws LdapException Places a new attribute with the supplied AttributeType and some binary values into the attribute collection.
The given User provided ID will be used for this new AttributeEntry.
If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.
This method provides a mechanism to put an attribute with a
nullvalue: the value may benull.- Specified by:
putin interfaceEntry- Parameters:
upId- The User Provided ID to be stored into the AttributeEntryattributeType- The attributeType to usevalues- The values to store- Returns:
- the old attribute with the same identifier, if exists; otherwise
null - Throws:
LdapException- if there are failures.
-
put
public Attribute put(String upId, AttributeType attributeType, String... values) throws LdapException Places a new attribute with the supplied AttributeType and some String values into the attribute collection.
The given User provided ID will be used for this new AttributeEntry.
If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.
This method provides a mechanism to put an attribute with a
nullvalue: the value may benull.- Specified by:
putin interfaceEntry- Parameters:
upId- The User Provided ID to be stored into the AttributeEntryattributeType- the type of the new attribute to be putvalues- the String values of the new attribute to be put- Returns:
- the old attribute with the same identifier, if exists; otherwise
null - Throws:
LdapException- if there are failures.
-
put
public Attribute put(String upId, AttributeType attributeType, Value... values) throws LdapException Places a new attribute with the supplied AttributeType and some values into the attribute collection.
The given User provided ID will be used for this new AttributeEntry.
If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.
This method provides a mechanism to put an attribute with a
nullvalue: the value may benull.- Specified by:
putin interfaceEntry- Parameters:
upId- The User Provided ID to be stored into the AttributeEntryattributeType- the type of the new attribute to be putvalues- the values of the new attribute to be put- Returns:
- the old attribute with the same identifier, if exists; otherwise
null - Throws:
LdapException- if there are failures.
-
remove
Removes the specified attributes. The removed attributes are returned by this method. If there were no attribute the return value isnull.- Specified by:
removein interfaceEntry- Parameters:
attributes- the attributes to be removed- Returns:
- the removed attribute, if exists; otherwise
null - Throws:
LdapException- If the removal failed
-
remove
Removes the specified binary values from an attribute.
If at least one value is removed, this method returns
true.If there is no more value after having removed the values, the attribute will be removed too.
If the attribute does not exist, nothing is done and the method returns
false- Specified by:
removein interfaceEntry- Parameters:
attributeType- The attribute typevalues- the values to be removed- Returns:
trueif at least a value is removed,falseif not all the values have been removed or if the attribute does not exist.- Throws:
LdapException- If the removal failed
-
remove
Removes the specified String values from an attribute.
If at least one value is removed, this method returns
true.If there is no more value after having removed the values, the attribute will be removed too.
If the attribute does not exist, nothing is done and the method returns
false- Specified by:
removein interfaceEntry- Parameters:
attributeType- The attribute typevalues- the values to be removed- Returns:
trueif at least a value is removed,falseif not all the values have been removed or if the attribute does not exist.- Throws:
LdapException- If the removal failed
-
remove
Removes the specified values from an attribute.
If at least one value is removed, this method returns
true.If there is no more value after having removed the values, the attribute will be removed too.
If the attribute does not exist, nothing is done and the method returns
false- Specified by:
removein interfaceEntry- Parameters:
attributeType- The attribute typevalues- the values to be removed- Returns:
trueif at least a value is removed,falseif not all the values have been removed or if the attribute does not exist.- Throws:
LdapException- If the removal failed
-
removeAttributes
Removes the attribute with the specified AttributeTypes.
The removed attribute are returned by this method.
If there is no attribute with the specified AttributeTypes, the return value is
null.- Specified by:
removeAttributesin interfaceEntry- Parameters:
attributes- the AttributeTypes to be removed
-
removeAttributes
Removes the attribute with the specified alias.
The removed attribute are returned by this method.
If there is no attribute with the specified alias, the return value is
null.- Specified by:
removeAttributesin interfaceEntry- Parameters:
attributes- an aliased name of the attribute to be removed
-
remove
Removes the specified binary values from an attribute.
If at least one value is removed, this method returns
true.If there is no more value after having removed the values, the attribute will be removed too.
If the attribute does not exist, nothing is done and the method returns
false- Specified by:
removein interfaceEntry- Parameters:
upId- The attribute IDvalues- the values to be removed- Returns:
trueif at least a value is removed,falseif not all the values have been removed or if the attribute does not exist.- Throws:
LdapException- If the removal failed
-
remove
Removes the specified String values from an attribute.
If at least one value is removed, this method returns
true.If there is no more value after having removed the values, the attribute will be removed too.
If the attribute does not exist, nothing is done and the method returns
false- Specified by:
removein interfaceEntry- Parameters:
upId- The attribute IDvalues- the attributes to be removed- Returns:
trueif at least a value is removed,falseif not all the values have been removed or if the attribute does not exist.- Throws:
LdapException- If the provided values are invalid
-
remove
Removes the specified values from an attribute.
If at least one value is removed, this method returns
true.If there is no more value after having removed the values, the attribute will be removed too.
If the attribute does not exist, nothing is done and the method returns
false- Specified by:
removein interfaceEntry- Parameters:
upId- The attribute IDvalues- the attributes to be removed- Returns:
trueif at least a value is removed,falseif not all the values have been removed or if the attribute does not exist.- Throws:
LdapException- if the attribute does not exists
-
getDn
-
setDn
-
setDn
Set this entry's Dn.- Specified by:
setDnin interfaceEntry- Parameters:
dn- The String Dn associated with this entry- Throws:
LdapInvalidDnException- if the provided Dn is invalid
-
clear
-
iterator
Returns an enumeration containing the zero or more attributes in the collection. The behavior of the enumeration is not specified if the attribute collection is changed. -
size
-
writeExternal
This is the place where we serialize entries, and all theirs elements.
The structure used to store the entry is the following :- [Dn] : If it's null, stores an empty Dn
- [attributes number] : the number of attributes.
- [attribute]* : each attribute, if we have some
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
hashCode
-
hasObjectClass
Tells if an entry as some specific ObjectClasses values- Specified by:
hasObjectClassin interfaceEntry- Parameters:
objectClasses- The ObjectClasses we want to check- Returns:
trueif all the ObjectClasses value are present in the ObjectClass attribute
-
hasObjectClass
Tells if an entry has some specific ObjectClasses Attributes- Specified by:
hasObjectClassin interfaceEntry- Parameters:
objectClasses- The ObjectClasses we want to check- Returns:
trueif the ObjectClasses Attribute are present in the ObjectClass attribute
-
isSchemaAware
public boolean isSchemaAware()Tells if the Entry is schema aware- Specified by:
isSchemaAwarein interfaceEntry- Returns:
- true if the Entry is schema aware
-
equals
-
toString
-
toString
-