Package com.isode.dsapi
Class ChangeEntry
java.lang.Object
com.isode.dsapi.GenericEntry
com.isode.dsapi.ChangeEntry
- All Implemented Interfaces:
Comparable<GenericEntry>
,Iterable<Attribute>
- Direct Known Subclasses:
AddEntry
,DeleteEntry
,ModifyEntry
,RenameEntry
An abstract class which acts to group the four different types of
change-entries found on an LDIF file: ModifyEntry, AddEntry,
DeleteEntry and RenameEntry. Each of these represents an operation
that can be performed on a directory.
- Author:
- jp
-
Field Summary
Fields inherited from class com.isode.dsapi.GenericEntry
attributeList, DS_Entry, logger
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Constructor used by the native library to create a blank object.protected
ChangeEntry
(int type, DN dn) Constructor used by sub-classes to create a blank object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttribute
(Attribute attr) Add an 'add attribute-values' change to an AddEntry or ModifyEntry.void
Appends an existing change-attribute to the ChangeEntry.void
deleteAttribute
(Attribute attr) Add a 'delete attribute-values' change to a ModifyEntry.static ChangeEntry
Calculate the difference between two possibly-null Entry references, giving as a result an AddEntry, ModifyEntry or DeleteEntry instance.protected void
Calculate differences and save in the current ModifyEntry or AddEntry.void
replaceAttribute
(Attribute attr) Add a 'replace attribute-values' change to a ModifyEntry.toString()
Returns a String representation of this entry.Methods inherited from class com.isode.dsapi.GenericEntry
compareTo, finalize, getAttributeIterator, getChangeIterator, getDN, hasChanges, 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
-
ChangeEntry
protected ChangeEntry()Constructor used by the native library to create a blank object. -
ChangeEntry
Constructor used by sub-classes to create a blank object.- Parameters:
type
- 'N' normal, 'A' add, 'M' modify, 'D' delete, 'R' rename (ModDN)dn
- Base DN, or null
-
-
Method Details
-
diff
Calculate the difference between two possibly-null Entry references, giving as a result an AddEntry, ModifyEntry or DeleteEntry instance. If 'entry1' is null, an AddEntry results; if 'entry2' is null, a DeleteEntry results; otherwise a ModifyEntry results.Note that any Attributes inside entry1 or entry2 which contain no values are treated as if they were not present at all.
- Parameters:
entry1
- initial entry, or null for 'absent'entry2
- target entry, or null for 'absent'- Returns:
- Either an AddEntry, DeleteEntry or ModifyEntry
-
addAttribute
public void addAttribute(Attribute attr) throws BadValueException, NullPointerException, NativeLibraryException Add an 'add attribute-values' change to an AddEntry or ModifyEntry.- Parameters:
attr
- Attribute containing values to be added.- Throws:
BadValueException
- if attr contains no values.NullPointerException
- if attr is null.NativeLibraryException
- if an unrecoverable error was detected by the native library
-
replaceAttribute
Add a 'replace attribute-values' change to a ModifyEntry.- Parameters:
attr
- Attribute containing values to replace current values when change is applied.- Throws:
NullPointerException
- if attr is null.NativeLibraryException
- if an unrecoverable error was detected by the native library
-
deleteAttribute
Add a 'delete attribute-values' change to a ModifyEntry.- Parameters:
attr
- Attribute containing values to delete when change is applied, or containing no values to delete all.- Throws:
NullPointerException
- if attr is null.NativeLibraryException
- if an unrecoverable error was detected by the native library
-
append
Appends an existing change-attribute to the ChangeEntry. The attribute must be an instance of AddAttribute, ReplaceAttribute or DeleteAttribute -- for example, as returned from the ChangeEntry iterator. This is intended to allow a ChangeEntry to be built up from selected changes from another ChangeEntry.- Parameters:
attr
- AddAttribute, ReplaceAttribute or DeleteAttribute- Throws:
BadValueException
- if attr is an AddAttribute which contains no values.NullPointerException
- if attr is null.NativeLibraryException
- if an unrecoverable error was detected by the native library- Since:
- R15.0
-
jni_diff
Calculate differences and save in the current ModifyEntry or AddEntry. 'entry1' or 'entry2' may be null to compare to/from an empty Entry. 'type' is 'M' to generate a modify-entry, or 'A' to generate an add-entry. -
toString
Returns a String representation of this entry.- Overrides:
toString
in classGenericEntry
- Returns:
- a String representation of the entry.
-