Class EntryHistoricalAttribute
- java.lang.Object
-
- org.opends.server.replication.plugin.EntryHistoricalAttribute
-
- All Implemented Interfaces:
Iterable<ByteString>
,Collection<ByteString>
,Attribute
public final class EntryHistoricalAttribute extends Object implements Attribute
A specializedAttribute
implementations that performs lazy conversion ofEntryHistorical
(ds-sync-hist) meta-data to its LDAP attribute representation as well as from its compact org.opends.server.backends.pluggable.ID2Entry representation.This class optimizes for all conversions except for conversions to and from LDAP Attributes since these are rarely needed in practice - it is rare for a client application to read the
ds-sync-hist
attribute or modify it directly.
-
-
Constructor Summary
Constructors Constructor Description EntryHistoricalAttribute(Supplier<EntryHistorical> delayedEntryHistorical)
Creates a new ds-sync-hist attribute whose content will be lazily computed using the provided supplier.EntryHistoricalAttribute(EntryHistorical entryHistorical)
Creates a new ds-sync-hist attribute whose content is based on the provided historical information.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(Object... values)
Adds all of the provided attribute values to this attribute if they are not already present (optional operation).boolean
add(ByteString value)
Addsvalue
to this attribute if it is not already present (optional operation).boolean
addAll(Collection<? extends ByteString> values)
Adds all of the attribute values contained invalues
to this attribute if they are not already present (optional operation).<T> boolean
addAll(Collection<T> values, Collection<? super T> duplicateValues)
Adds all of the attribute values contained invalues
to this attribute if they are not already present (optional operation).void
clear()
Removes all of the attribute values from this attribute (optional operation).boolean
contains(Object value)
Returnstrue
if this attribute containsvalue
.boolean
containsAll(Collection<?> values)
Returnstrue
if this attribute contains all of the attribute values contained invalues
.boolean
equals(Object object)
Returnstrue
ifobject
is an attribute which is equal to this attribute.ByteString
firstValue()
Returns the first attribute value in this attribute.void
forEach(Consumer<? super ByteString> action)
AttributeDescription
getAttributeDescription()
Returns the attribute description of this attribute, which includes its attribute type and any options.EntryHistorical
getEntryHistoricalForRead(Dn dn)
Returns the historical information associated with this attribute, computing it if needed.EntryHistorical
getEntryHistoricalForUpdate(Dn dn)
Returns the historical information associated with this attribute, computing it if needed.int
hashCode()
Returns the hash code for this attribute.boolean
isEmpty()
Returnstrue
if this attribute contains no attribute values.boolean
isVirtual()
Indicates whether this is a virtual attribute (dynamically computed) rather than a real attribute (persisted).Iterator<ByteString>
iterator()
Returns an iterator over the attribute values in this attribute.ConditionResult
matchesApproximateAssertion(Assertion assertion, ByteSequence rawAssertion)
Indicates whether this attribute matches the specified assertion using the attribute's default approximate matching rule.ConditionResult
matchesEqualityAssertion(Assertion assertion, ByteSequence rawAssertion)
Indicates whether this attribute matches the specified assertion using the attribute's default equality matching rule.ConditionResult
matchesGreaterOrEqualAssertion(Assertion assertion, ByteSequence rawAssertion)
Indicates whether this attribute matches the specified assertion using the attribute's default ordering matching rule.ConditionResult
matchesLessOrEqualAssertion(Assertion assertion, ByteSequence rawAssertion)
Indicates whether this attribute matches the specified assertion using the attribute's default ordering matching rule.ConditionResult
matchesSubstringAssertion(Assertion assertion, ByteSequence rawInitialSubstring, List<? extends ByteSequence> rawAnySubstrings, ByteSequence rawFinalSubstring)
Indicates whether this attribute matches the specified assertion using the attribute's default ordering matching rule.Stream<ByteString>
parallelStream()
AttributeParser
parse()
Returns a parser for this attribute which can be used for decoding values as different types of object.boolean
remove(Object value)
Removesvalue
from this attribute if it is present (optional operation).boolean
removeAll(Collection<?> values)
Removes all of the attribute values contained invalues
from this attribute if they are present (optional operation).<T> boolean
removeAll(Collection<T> values, Collection<? super T> missingValues)
Removes all of the attribute values contained invalues
from this attribute if they are present (optional operation).boolean
removeIf(Predicate<? super ByteString> filter)
boolean
retainAll(Collection<?> values)
Retains only the attribute values in this attribute which are contained invalues
(optional operation).<T> boolean
retainAll(Collection<T> values, Collection<? super T> missingValues)
Retains only the attribute values in this attribute which are contained invalues
(optional operation).int
size()
Returns the number of attribute values in this attribute.Spliterator<ByteString>
spliterator()
Stream<ByteString>
stream()
ByteString[]
toArray()
Returns an array containing all of the attribute values contained in this attribute.<T> T[]
toArray(T[] array)
Returns an array containing all of the attribute values in this attribute; the runtime type of the returned array is that of the specified array.String
toString()
Returns a string representation of this attribute.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.forgerock.opendj.ldap.Attribute
firstValueAsString, getAttributeDescriptionAsString, isReal, put, put
-
Methods inherited from interface java.util.Collection
toArray
-
-
-
-
Constructor Detail
-
EntryHistoricalAttribute
public EntryHistoricalAttribute(Supplier<EntryHistorical> delayedEntryHistorical)
Creates a new ds-sync-hist attribute whose content will be lazily computed using the provided supplier.- Parameters:
delayedEntryHistorical
- The supplier to be invoked in order to compute the attribute's content.
-
EntryHistoricalAttribute
public EntryHistoricalAttribute(EntryHistorical entryHistorical)
Creates a new ds-sync-hist attribute whose content is based on the provided historical information.- Parameters:
entryHistorical
- The historical information from which the attribute values will be computed.
-
-
Method Detail
-
getEntryHistoricalForRead
public EntryHistorical getEntryHistoricalForRead(Dn dn)
Returns the historical information associated with this attribute, computing it if needed. This method should only be used when the caller does not intend to update the returned historical information.- Parameters:
dn
- The name of the entry containing this attribute.- Returns:
- The historical information associated with this attribute, computing it if needed.
-
getEntryHistoricalForUpdate
public EntryHistorical getEntryHistoricalForUpdate(Dn dn)
Returns the historical information associated with this attribute, computing it if needed. This method should be used when the caller intends to update the returned historical information.- Parameters:
dn
- The name of the entry containing this attribute.- Returns:
- The historical information associated with this attribute, computing it if needed.
-
getAttributeDescription
public AttributeDescription getAttributeDescription()
Description copied from interface:Attribute
Returns the attribute description of this attribute, which includes its attribute type and any options.- Specified by:
getAttributeDescription
in interfaceAttribute
- Returns:
- The attribute description.
-
isVirtual
public boolean isVirtual()
Description copied from interface:Attribute
Indicates whether this is a virtual attribute (dynamically computed) rather than a real attribute (persisted).
-
isEmpty
public boolean isEmpty()
Description copied from interface:Attribute
Returnstrue
if this attribute contains no attribute values.- Specified by:
isEmpty
in interfaceAttribute
- Specified by:
isEmpty
in interfaceCollection<ByteString>
- Returns:
true
if this attribute contains no attribute values.
-
add
public boolean add(ByteString value)
Description copied from interface:Attribute
Addsvalue
to this attribute if it is not already present (optional operation). If this attribute already containsvalue
, the call leaves the attribute unchanged and returnsfalse
.- Specified by:
add
in interfaceAttribute
- Specified by:
add
in interfaceCollection<ByteString>
- Parameters:
value
- The attribute value to be added to this attribute.- Returns:
true
if this attribute changed as a result of this call.
-
add
public boolean add(Object... values)
Description copied from interface:Attribute
Adds all of the provided attribute values to this attribute if they are not already present (optional operation).Any attribute values which are not instances of
ByteString
will be converted using theByteString.valueOfObject(Object)
method.
-
addAll
public boolean addAll(Collection<? extends ByteString> values)
Description copied from interface:Attribute
Adds all of the attribute values contained invalues
to this attribute if they are not already present (optional operation).An invocation of this method is equivalent to:
attribute.addAll(values, null);
- Specified by:
addAll
in interfaceAttribute
- Specified by:
addAll
in interfaceCollection<ByteString>
- Parameters:
values
- The attribute values to be added to this attribute.- Returns:
true
if this attribute changed as a result of this call.
-
addAll
public <T> boolean addAll(Collection<T> values, Collection<? super T> duplicateValues)
Description copied from interface:Attribute
Adds all of the attribute values contained invalues
to this attribute if they are not already present (optional operation). Any attribute values which are already present will be added toduplicateValues
if specified.Any attribute values which are not instances of
ByteString
will be converted using theByteString.valueOfObject(Object)
method.- Specified by:
addAll
in interfaceAttribute
- Type Parameters:
T
- The type of the attribute value objects being added.- Parameters:
values
- The attribute values to be added to this attribute.duplicateValues
- A collection into which duplicate values will be added, ornull
if duplicate values should not be saved.- Returns:
true
if this attribute changed as a result of this call.
-
clear
public void clear()
Description copied from interface:Attribute
Removes all of the attribute values from this attribute (optional operation). This attribute will be empty after this call returns.- Specified by:
clear
in interfaceAttribute
- Specified by:
clear
in interfaceCollection<ByteString>
-
contains
public boolean contains(Object value)
Description copied from interface:Attribute
Returnstrue
if this attribute containsvalue
.If
value
is not an instance ofByteString
then it will be converted using theByteString.valueOfObject(Object)
method.- Specified by:
contains
in interfaceAttribute
- Specified by:
contains
in interfaceCollection<ByteString>
- Parameters:
value
- The attribute value whose presence in this attribute is to be tested.- Returns:
true
if this attribute containsvalue
, orfalse
if not.
-
containsAll
public boolean containsAll(Collection<?> values)
Description copied from interface:Attribute
Returnstrue
if this attribute contains all of the attribute values contained invalues
.Any attribute values which are not instances of
ByteString
will be converted using theByteString.valueOfObject(Object)
method.- Specified by:
containsAll
in interfaceAttribute
- Specified by:
containsAll
in interfaceCollection<ByteString>
- Parameters:
values
- The attribute values whose presence in this attribute is to be tested.- Returns:
true
if this attribute contains all of the attribute values contained invalues
, orfalse
if not.
-
equals
public boolean equals(Object object)
Description copied from interface:Attribute
Returnstrue
ifobject
is an attribute which is equal to this attribute. Two attributes are considered equal if their attribute descriptions are equal, they both have the same number of attribute values, and every attribute value contained in the first attribute is also contained in the second attribute.- Specified by:
equals
in interfaceAttribute
- Specified by:
equals
in interfaceCollection<ByteString>
- Overrides:
equals
in classObject
- Parameters:
object
- The object to be tested for equality with this attribute.- Returns:
true
ifobject
is an attribute which is equal to this attribute, orfalse
if not.
-
firstValue
public ByteString firstValue()
Description copied from interface:Attribute
Returns the first attribute value in this attribute.- Specified by:
firstValue
in interfaceAttribute
- Returns:
- The first attribute value in this attribute.
-
hashCode
public int hashCode()
Description copied from interface:Attribute
Returns the hash code for this attribute. It will be calculated as the sum of the hash codes of the attribute description and all of the attribute values.- Specified by:
hashCode
in interfaceAttribute
- Specified by:
hashCode
in interfaceCollection<ByteString>
- Overrides:
hashCode
in classObject
- Returns:
- The hash code for this attribute.
-
iterator
public Iterator<ByteString> iterator()
Description copied from interface:Attribute
Returns an iterator over the attribute values in this attribute. The attribute values are returned in no particular order, unless the implementation of this attribute provides such a guarantee.- Specified by:
iterator
in interfaceAttribute
- Specified by:
iterator
in interfaceCollection<ByteString>
- Specified by:
iterator
in interfaceIterable<ByteString>
- Returns:
- An iterator over the attribute values in this attribute.
-
matchesApproximateAssertion
public ConditionResult matchesApproximateAssertion(Assertion assertion, ByteSequence rawAssertion)
Description copied from interface:Attribute
Indicates whether this attribute matches the specified assertion using the attribute's default approximate matching rule.- Specified by:
matchesApproximateAssertion
in interfaceAttribute
- Parameters:
assertion
- The attribute value assertion compiled using the attribute's default approximate matching rule.rawAssertion
- The raw assertion value whose syntax is compatible with the attribute's default approximate matching rule.- Returns:
ConditionResult.FALSE
if the assertion does not match any values in this attribute,ConditionResult.TRUE
if the assertion matches at least one value in this attribute, orConditionResult.UNDEFINED
if the assertion does not match any values in this attribute, but one or more values could not be compared because they are incompatible with the matching rule.
-
matchesEqualityAssertion
public ConditionResult matchesEqualityAssertion(Assertion assertion, ByteSequence rawAssertion)
Description copied from interface:Attribute
Indicates whether this attribute matches the specified assertion using the attribute's default equality matching rule.- Specified by:
matchesEqualityAssertion
in interfaceAttribute
- Parameters:
assertion
- The attribute value assertion compiled using the attribute's default equality matching rule.rawAssertion
- The raw assertion value whose syntax is compatible with the attribute's default equality matching rule.- Returns:
ConditionResult.FALSE
if the assertion does not match any values in this attribute,ConditionResult.TRUE
if the assertion matches at least one value in this attribute, orConditionResult.UNDEFINED
if the assertion does not match any values in this attribute, but one or more values could not be compared because they are incompatible with the matching rule.
-
matchesGreaterOrEqualAssertion
public ConditionResult matchesGreaterOrEqualAssertion(Assertion assertion, ByteSequence rawAssertion)
Description copied from interface:Attribute
Indicates whether this attribute matches the specified assertion using the attribute's default ordering matching rule.- Specified by:
matchesGreaterOrEqualAssertion
in interfaceAttribute
- Parameters:
assertion
- The attribute value assertion compiled using the attribute's default ordering matching rule.rawAssertion
- The raw assertion value whose syntax is compatible with the attribute's default ordering matching rule.- Returns:
ConditionResult.FALSE
if the assertion does not match any values in this attribute,ConditionResult.TRUE
if the assertion matches at least one value in this attribute, orConditionResult.UNDEFINED
if the assertion does not match any values in this attribute, but one or more values could not be compared because they are incompatible with the matching rule.
-
matchesLessOrEqualAssertion
public ConditionResult matchesLessOrEqualAssertion(Assertion assertion, ByteSequence rawAssertion)
Description copied from interface:Attribute
Indicates whether this attribute matches the specified assertion using the attribute's default ordering matching rule.- Specified by:
matchesLessOrEqualAssertion
in interfaceAttribute
- Parameters:
assertion
- The attribute value assertion compiled using the attribute's default ordering matching rule.rawAssertion
- The raw assertion value whose syntax is compatible with the attribute's default ordering matching rule.- Returns:
ConditionResult.FALSE
if the assertion does not match any values in this attribute,ConditionResult.TRUE
if the assertion matches at least one value in this attribute, orConditionResult.UNDEFINED
if the assertion does not match any values in this attribute, but one or more values could not be compared because they are incompatible with the matching rule.
-
matchesSubstringAssertion
public ConditionResult matchesSubstringAssertion(Assertion assertion, ByteSequence rawInitialSubstring, List<? extends ByteSequence> rawAnySubstrings, ByteSequence rawFinalSubstring)
Description copied from interface:Attribute
Indicates whether this attribute matches the specified assertion using the attribute's default ordering matching rule.- Specified by:
matchesSubstringAssertion
in interfaceAttribute
- Parameters:
assertion
- The attribute value assertion compiled using the attribute's default ordering matching rule.rawInitialSubstring
- The assertion's initial sub-string, may benull
if eitherrawFinalSubstring
orrawAnySubstrings
are specified.rawAnySubstrings
- The assertion's intermediate sub-strings, may be empty if eitherrawFinalSubstring
orrawAnySubstrings
are specified.rawFinalSubstring
- The final sub-string, may benull
if eitherrawInitialSubstring
orrawAnySubstrings
are specified.- Returns:
ConditionResult.FALSE
if the assertion does not match any values in this attribute,ConditionResult.TRUE
if the assertion matches at least one value in this attribute, orConditionResult.UNDEFINED
if the assertion does not match any values in this attribute, but one or more values could not be compared because they are incompatible with the matching rule.
-
parse
public AttributeParser parse()
Description copied from interface:Attribute
Returns a parser for this attribute which can be used for decoding values as different types of object.
-
remove
public boolean remove(Object value)
Description copied from interface:Attribute
Removesvalue
from this attribute if it is present (optional operation). If this attribute does not containvalue
, the call leaves the attribute unchanged and returnsfalse
.If
value
is not an instance ofByteString
then it will be converted using theByteString.valueOfObject(Object)
method.- Specified by:
remove
in interfaceAttribute
- Specified by:
remove
in interfaceCollection<ByteString>
- Parameters:
value
- The attribute value to be removed from this attribute.- Returns:
true
if this attribute changed as a result of this call.
-
removeAll
public boolean removeAll(Collection<?> values)
Description copied from interface:Attribute
Removes all of the attribute values contained invalues
from this attribute if they are present (optional operation).Any attribute values which are not instances of
ByteString
will be converted using theByteString.valueOfObject(Object)
method.An invocation of this method is equivalent to:
attribute.removeAll(values, null);
- Specified by:
removeAll
in interfaceAttribute
- Specified by:
removeAll
in interfaceCollection<ByteString>
- Parameters:
values
- The attribute values to be removed from this attribute.- Returns:
true
if this attribute changed as a result of this call.
-
removeAll
public <T> boolean removeAll(Collection<T> values, Collection<? super T> missingValues)
Description copied from interface:Attribute
Removes all of the attribute values contained invalues
from this attribute if they are present (optional operation). Any attribute values which are not already present will be added tomissingValues
if specified.Any attribute values which are not instances of
ByteString
will be converted using theByteString.valueOfObject(Object)
method.- Specified by:
removeAll
in interfaceAttribute
- Type Parameters:
T
- The type of the attribute value objects being removed.- Parameters:
values
- The attribute values to be removed from this attribute.missingValues
- A collection into which missing values will be added, ornull
if missing values should not be saved.- Returns:
true
if this attribute changed as a result of this call.
-
retainAll
public boolean retainAll(Collection<?> values)
Description copied from interface:Attribute
Retains only the attribute values in this attribute which are contained invalues
(optional operation).Any attribute values which are not instances of
ByteString
will be converted using theByteString.valueOfObject(Object)
method.An invocation of this method is equivalent to:
attribute.retainAll(values, null);
- Specified by:
retainAll
in interfaceAttribute
- Specified by:
retainAll
in interfaceCollection<ByteString>
- Parameters:
values
- The attribute values to be retained in this attribute.- Returns:
true
if this attribute changed as a result of this call.
-
retainAll
public <T> boolean retainAll(Collection<T> values, Collection<? super T> missingValues)
Description copied from interface:Attribute
Retains only the attribute values in this attribute which are contained invalues
(optional operation). Any attribute values which are not already present will be added tomissingValues
if specified.Any attribute values which are not instances of
ByteString
will be converted using theByteString.valueOfObject(Object)
method.- Specified by:
retainAll
in interfaceAttribute
- Type Parameters:
T
- The type of the attribute value objects being retained.- Parameters:
values
- The attribute values to be retained in this attribute.missingValues
- A collection into which missing values will be added, ornull
if missing values should not be saved.- Returns:
true
if this attribute changed as a result of this call.
-
size
public int size()
Description copied from interface:Attribute
Returns the number of attribute values in this attribute.- Specified by:
size
in interfaceAttribute
- Specified by:
size
in interfaceCollection<ByteString>
- Returns:
- The number of attribute values in this attribute.
-
toArray
public ByteString[] toArray()
Description copied from interface:Attribute
Returns an array containing all of the attribute values contained in this attribute.If this attribute makes any guarantees as to what order its attribute values are returned by its iterator, this method must return the attribute values in the same order.
The returned array will be "safe" in that no references to it are maintained by this attribute. The caller is thus free to modify the returned array.
- Specified by:
toArray
in interfaceAttribute
- Specified by:
toArray
in interfaceCollection<ByteString>
- Returns:
- An array containing all of the attribute values contained in this attribute.
-
toArray
public <T> T[] toArray(T[] array)
Description copied from interface:Attribute
Returns an array containing all of the attribute values in this attribute; the runtime type of the returned array is that of the specified array.If the set fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this attribute. If this attribute fits in the specified array with room to spare (i.e., the array has more elements than this attribute), the elements in the array immediately following the end of the set is set to
null
.If this attribute makes any guarantees as to what order its attribute values are returned by its iterator, this method must return the attribute values in the same order.
- Specified by:
toArray
in interfaceAttribute
- Specified by:
toArray
in interfaceCollection<ByteString>
- Type Parameters:
T
- The type of elements contained inarray
.- Parameters:
array
- An array into which the elements of this attribute should be put.- Returns:
- An array containing all of the attribute values contained in this attribute.
-
toString
public String toString()
Description copied from interface:Attribute
Returns a string representation of this attribute.
-
removeIf
public boolean removeIf(Predicate<? super ByteString> filter)
- Specified by:
removeIf
in interfaceCollection<ByteString>
-
spliterator
public Spliterator<ByteString> spliterator()
- Specified by:
spliterator
in interfaceCollection<ByteString>
- Specified by:
spliterator
in interfaceIterable<ByteString>
-
stream
public Stream<ByteString> stream()
- Specified by:
stream
in interfaceCollection<ByteString>
-
parallelStream
public Stream<ByteString> parallelStream()
- Specified by:
parallelStream
in interfaceCollection<ByteString>
-
forEach
public void forEach(Consumer<? super ByteString> action)
- Specified by:
forEach
in interfaceIterable<ByteString>
-
-