Class ModifyEntry
- All Implemented Interfaces:
Comparable<GenericEntry>
,Iterable<Attribute>
-
Field Summary
Fields inherited from class com.isode.dsapi.GenericEntry
attributeList, DS_Entry, logger
-
Constructor Summary
ConstructorsConstructorDescriptionModifyEntry
(DN dn) Create a new empty ModifyEntry using a specified DNModifyEntry
(Entry entry1, Entry entry2) Create a new ModifyEntry by comparing two Entry instances. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttribute
(Attribute attr) Specify attribute-values that should be added to the target entry when the ModifyEntry is applied.void
deleteAttribute
(Attribute attr) Specify an attribute or attribute-values to be deleted from the target entry when the ModifyEntry is applied.Returns an Iterator over the change-attributes associated with this ModifyEntry.boolean
Determine whether this entry contains any change-attributes (as would be returned by a call to getChangeIterator()).void
replaceAttribute
(Attribute attr) Specify an attribute that should be replaced in the target entry when the ModifyEntry is applied.toString()
Returns a String representation of this ModifyEntry.Methods inherited from class com.isode.dsapi.ChangeEntry
append, diff, jni_diff
Methods inherited from class com.isode.dsapi.GenericEntry
compareTo, finalize, getAttributeIterator, getDN, iterator, setDN, sortArrayByDN, toLDIF
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ModifyEntry
Create a new empty ModifyEntry using a specified DN- Parameters:
dn
- the distinguished name (must not be null)- Throws:
NullPointerException
- if dn is nullNativeLibraryException
- if an unrecoverable error was detected by the native library
-
ModifyEntry
Create a new ModifyEntry by comparing two Entry instances. The changes are generated to convert from the first Entry to the second -- so that means that applying the resulting ModifyEntry to the first Entry would give a new Entry with identical contents to the second. If either of the Entry references is null, then it is treated as an empty Entry. The DN is copied from the first of the Entry instances which isn't null.Note that the comparisons done to establish whether there is a difference are NOT standard attribute-value comparisons. This is because a change from "fred" to "Fred" is significant to humans and so should be passed through, even though the values normally compare equal. So the default is a case-sensitive strict comparison of the attribute value. However, this is not appropriate in all cases. Objectclass comparisons are made case-insensitive because changes in case make no difference to the underlying OID and are therefore not significant. DN is more complicated because case-differences in RDN types are not significant, but case-differences to values are significant. Currently case-differences in RDN types are considered significant even though strictly they shouldn't be. This can be resolved by normalizing the DN attributes before passing the entry to this routine.
Note that any Attributes inside entry1 or entry2 which contain no values are treated as if they were not present at all.
- Parameters:
entry1
- The source Entry, or null to use an empty entry as sourceentry2
- The target Entry, or null to use an empty entry as target- Throws:
NullPointerException
- if both arguments are nullNativeLibraryException
- if an unrecoverable error was detected by the native library
-
-
Method Details
-
getChangeIterator
Returns an Iterator over the change-attributes associated with this ModifyEntry. The Iterator will contain AddAttribute, DeleteAttribute and ReplaceAttribute instances.- Overrides:
getChangeIterator
in classGenericEntry
- Returns:
- Iterator or null
-
hasChanges
public boolean hasChanges()Determine whether this entry contains any change-attributes (as would be returned by a call to getChangeIterator()).- Overrides:
hasChanges
in classGenericEntry
- Returns:
- true if this entry has modifications associated with it, false otherwise.
-
deleteAttribute
Specify an attribute or attribute-values to be deleted from the target entry when the ModifyEntry is applied. If the Attribute contains values, then those specific values will be deleted. If the Attribute is empty, then all values for the specified attribute-type will be deleted. A copy is made of the Attribute argument as a DeleteAttribute.- Overrides:
deleteAttribute
in classChangeEntry
- Parameters:
attr
- Attribute containing values to be deleted, or empty to delete all. Must not be null.- Throws:
NullPointerException
- if attr is null.NativeLibraryException
- if an unrecoverable error was detected by the native library- See Also:
-
addAttribute
public void addAttribute(Attribute attr) throws BadValueException, NullPointerException, NativeLibraryException Specify attribute-values that should be added to the target entry when the ModifyEntry is applied. A copy is made of the Attribute as an AddAttribute.- Overrides:
addAttribute
in classChangeEntry
- Parameters:
attr
- Attribute containing values to be added. Must not be null.- Throws:
BadValueException
- if attr contains no values.NullPointerException
- if attr is null.NativeLibraryException
- if an unrecoverable error was detected by the native library- See Also:
-
replaceAttribute
Specify an attribute that should be replaced in the target entry when the ModifyEntry is applied. All the attribute-values of this attribute-type that are present in the target Entry are deleted before the new values are added. A copy is made of the argument Attribute as a ReplaceAttribute.- Overrides:
replaceAttribute
in classChangeEntry
- Parameters:
attr
- Attribute containing values to be replaced. Must not be null.- Throws:
NullPointerException
- if attr is null.NativeLibraryException
- if an unrecoverable error was detected by the native library- See Also:
-
toString
Returns a String representation of this ModifyEntry. The String contains the Entry's DN and number of changes.- Overrides:
toString
in classChangeEntry
- Returns:
- a String representation of the Entry.
-