Package com.isode.dsapi
Class AddEntry
java.lang.Object
com.isode.dsapi.GenericEntry
com.isode.dsapi.ChangeEntry
com.isode.dsapi.AddEntry
- All Implemented Interfaces:
Comparable<GenericEntry>
,Iterable<Attribute>
An AddEntry is used to store the contents of an entry to add to the
directory. It can be generated empty and then filled, or may be
loaded from an 'Add' LDIF change-record. Once constructed, it may
be applied to a directory, or saved to an LDIF file. Note that
only the addAttribute() call is supported, as only add-attributes
may be contained within an AddEntry. It cannot include attribute
replace or delete operations -- use a ModifyEntry for that.
- Author:
- jp
-
Field Summary
Fields inherited from class com.isode.dsapi.GenericEntry
attributeList, DS_Entry, logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttribute
(Attribute attr) Add attribute-values to the AddEntry.Returns an Iterator over the change-attributes associated with this AddEntry.boolean
Determine whether this entry contains any change-attributes (as would be returned by a call to getChangeIterator()).toString()
Returns a String representation of this Entry.Methods inherited from class com.isode.dsapi.ChangeEntry
append, deleteAttribute, diff, jni_diff, replaceAttribute
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
-
AddEntry
Create a new blank AddEntry using the 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
-
AddEntry
Create an AddEntry from an Entry.Note that any Attributes inside entry which contain no values are treated as if they were not present at all (i.e. they will not appear in the constructed object).
- Parameters:
entry
- the entry from which this object should be created.- Throws:
NullPointerException
- if entry is nullNativeLibraryException
- if an unrecoverable error was detected by the native library
-
-
Method Details
-
getChangeIterator
Returns an Iterator over the change-attributes associated with this AddEntry. The Iterator will contain only AddAttribute instances, since only AddAttribute instances can be stored in an AddEntry.- Overrides:
getChangeIterator
in classGenericEntry
- Returns:
- Iterator
-
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 AddEntry has modifications associated with it, false otherwise.
-
addAttribute
public void addAttribute(Attribute attr) throws BadValueException, NullPointerException, NativeLibraryException Add attribute-values to the AddEntry. 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:
-
toString
Returns a String representation of this Entry. The String contains the Entry's DN and a count of the number of attributes that the Entry contains.- Overrides:
toString
in classChangeEntry
- Returns:
- a String representation of the Entry.
-